1 7 package java.security.spec; 8 9 import java.math.BigInteger ; 10 import java.util.Arrays ; 11 12 23 public class ECFieldFp implements ECField { 24 25 private BigInteger p; 26 27 35 public ECFieldFp(BigInteger p) { 36 if (p.signum() != 1) { 37 throw new IllegalArgumentException ("p is not positive"); 38 } 39 this.p = p; 40 } 41 42 47 public int getFieldSize() { 48 return p.bitLength(); 49 }; 50 51 55 public BigInteger getP() { 56 return p; 57 } 58 59 66 public boolean equals(Object obj) { 67 if (this == obj) return true; 68 if (obj instanceof ECFieldFp ) { 69 return (p.equals(((ECFieldFp )obj).p)); 70 } 71 return false; 72 } 73 74 78 public int hashCode() { 79 return p.hashCode(); 80 } 81 } 82 | Popular Tags |