public boolean equals(Object obj) { return this == obj || (obj instanceof ECCurve && equals((ECCurve)obj)); }
public boolean equals(Object obj) { return this == obj || (obj instanceof ECCurve && equals((ECCurve)obj)); }
public boolean equals( Object obj) { if (this == obj) { return true; } if ((obj instanceof ECDomainParameters)) { ECDomainParameters other = (ECDomainParameters)obj; return this.curve.equals(other.curve) && this.G.equals(other.G) && this.n.equals(other.n) && this.h.equals(other.h); } return false; }
public static ECPoint importPoint(ECCurve c, ECPoint p) { ECCurve cp = p.getCurve(); if (!c.equals(cp)) { throw new IllegalArgumentException("Point must be on the same curve"); } return c.importPoint(p); }
public static ECPoint importPoint(ECCurve c, ECPoint p) { ECCurve cp = p.getCurve(); if (!c.equals(cp)) { throw new IllegalArgumentException("Point must be on the same curve"); } return c.importPoint(p); }
public static ECPoint cleanPoint(ECCurve c, ECPoint p) { ECCurve cp = p.getCurve(); if (!c.equals(cp)) { throw new IllegalArgumentException("Point must be on the same curve"); } return c.decodePoint(p.getEncoded(false)); }
/** * Base Constructor. * <p> * The cofactor is used to calculate the output block length (maxOutlen) according to * <pre> * max_outlen = largest multiple of 8 less than ((field size in bits) - (13 + log2(cofactor)) * </pre> * * @param securityStrength maximum security strength to be associated with these parameters * @param p the P point. * @param q the Q point. * @param cofactor cofactor associated with the domain parameters for the point generation. */ public DualECPoints(int securityStrength, ECPoint p, ECPoint q, int cofactor) { if (!p.getCurve().equals(q.getCurve())) { throw new IllegalArgumentException("points need to be on the same curve"); } this.securityStrength = securityStrength; this.p = p; this.q = q; this.cofactor = cofactor; }
/** * Base Constructor. * <p> * The cofactor is used to calculate the output block length (maxOutlen) according to * <pre> * max_outlen = largest multiple of 8 less than ((field size in bits) - (13 + log2(cofactor)) * </pre> * * @param securityStrength maximum security strength to be associated with these parameters * @param p the P point. * @param q the Q point. * @param cofactor cofactor associated with the domain parameters for the point generation. */ public DualECPoints(int securityStrength, ECPoint p, ECPoint q, int cofactor) { if (!p.getCurve().equals(q.getCurve())) { throw new IllegalArgumentException("points need to be on the same curve"); } this.securityStrength = securityStrength; this.p = p; this.q = q; this.cofactor = cofactor; }
public static Curve valueOf(ECCurve v) throws Exception { for (Curve c : Curve.values()) { if (ECNamedCurveTable.getParameterSpec(c.toString()).getCurve().equals(v)) { return c; } } throw new Exception(ErrorCode.UnknownCurve); }
public static Curve valueOf(ECCurve v) throws Exception { for (Curve c : Curve.values()) { if (ECNamedCurveTable.getParameterSpec(c.toString()).getCurve().equals(v)) { return c; } } throw new Exception(ErrorCode.UnknownCurve); }
public static NamedGroup getNamedCuveFromECCurve(ECCurve unknownCurve) { for (NamedGroup group : NamedGroup.values()) { ECNamedCurveParameterSpec parameterSpec = ECNamedCurveTable.getParameterSpec(group.name()); if (parameterSpec.getCurve().equals(unknownCurve)) { return group; } } return null; }
public static boolean areOnSameCurve(ECDomainParameters a, ECDomainParameters b) { // TODO Move to ECDomainParameters.equals() or other utility method? return a.getCurve().equals(b.getCurve()) && a.getG().equals(b.getG()) && a.getN().equals(b.getN()) && a.getH().equals(b.getH()); }
public boolean equals(Object o) { if (!(o instanceof ECParameterSpec)) { return false; } ECParameterSpec other = (ECParameterSpec)o; return this.getCurve().equals(other.getCurve()) && this.getG().equals(other.getG()); }
public static ASN1ObjectIdentifier getNamedCurveOid( ECParameterSpec ecParameterSpec) { for (Enumeration names = ECNamedCurveTable.getNames(); names.hasMoreElements();) { String name = (String)names.nextElement(); X9ECParameters params = ECNamedCurveTable.getByName(name); if (params.getN().equals(ecParameterSpec.getN()) && params.getH().equals(ecParameterSpec.getH()) && params.getCurve().equals(ecParameterSpec.getCurve()) && params.getG().equals(ecParameterSpec.getG())) { return org.bouncycastle.asn1.x9.ECNamedCurveTable.getOID(name); } } return null; }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { if (!curve.equals(p.getCurve())) { throw new IllegalStateException(); } BigInteger n = p.getCurve().getOrder(); BigInteger[] ab = glvEndomorphism.decomposeScalar(k.mod(n)); BigInteger a = ab[0], b = ab[1]; ECPointMap pointMap = glvEndomorphism.getPointMap(); if (glvEndomorphism.hasEfficientPointMap()) { return ECAlgorithms.implShamirsTrickWNaf(p, a, pointMap, b); } return ECAlgorithms.implShamirsTrickWNaf(p, a, pointMap.map(p), b); } }
protected ECPoint multiplyPositive(ECPoint p, BigInteger k) { if (!curve.equals(p.getCurve())) { throw new IllegalStateException(); } BigInteger n = p.getCurve().getOrder(); BigInteger[] ab = glvEndomorphism.decomposeScalar(k.mod(n)); BigInteger a = ab[0], b = ab[1]; ECPointMap pointMap = glvEndomorphism.getPointMap(); if (glvEndomorphism.hasEfficientPointMap()) { return ECAlgorithms.implShamirsTrickWNaf(p, a, pointMap, b); } return ECAlgorithms.implShamirsTrickWNaf(p, a, pointMap.map(p), b); } }