/** * Decompress a compressed public key (x co-ord and low-bit of y-coord). * * @param xBN - * @param yBit - * @return - */ private static ECPoint decompressKey(BigInteger xBN, boolean yBit) { X9IntegerConverter x9 = new X9IntegerConverter(); byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve())); compEnc[0] = (byte) (yBit ? 0x03 : 0x02); return CURVE.getCurve().decodePoint(compEnc); }
X9ECParameters x9 = NISTNamedCurves.getByName("P-224"); // or whatever curve you want to use ECPoint g = x9.getG(); BigInteger n = x9.getN(); int nBitLength = n.bitLength(); BigInteger x; do { x = new BigInteger(nBitLength, random); } while (x.equals(ZERO) || (x.compareTo(n) >= 0)); ECPoint randomPoint = g.multiply(x);
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) { X9IntegerConverter x9 = new X9IntegerConverter(); byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve())); compEnc[0] = (byte) (yBit ? 0x03 : 0x02); return CURVE.getCurve().decodePoint(compEnc); }
static BigInteger n() { return CURVE.getN(); }
public X962Parameters( X9ECParameters ecParameters) { this.params = ecParameters.toASN1Primitive(); }
public X9ECParameters( ECCurve curve, ECPoint g, BigInteger n, BigInteger h, byte[] seed) { this(curve, new X9ECPoint(g), n, h, seed); }
public ECPoint getG() { return g.getPoint(); }
public X9Curve( ECCurve curve, byte[] seed) { this.curve = curve; this.seed = seed; setFieldIdentifier(); }
static X9ECParameters getX9Parameters(ASN1ObjectIdentifier curveOID) { return ECNamedCurveTable.getByOID(curveOID); } }
public synchronized X9ECParameters getParameters() { if (params == null) { params = createParameters(); } return params; }
/** * return an enumeration of the names of the available curves. * * @return an enumeration of the names of the available curves. */ public static Enumeration getNames() { return org.spongycastle.asn1.x9.ECNamedCurveTable.getNames(); } }
/** * Return the ASN.1 entry representing the Curve. * * @return the X9Curve for the curve in these parameters. */ public X9Curve getCurveEntry() { return new X9Curve(curve, seed); }
static BigInteger n() { return CURVE.getN(); }
public X962Parameters( X9ECParameters ecParameters) { this.params = ecParameters.toASN1Primitive(); }
public X9Curve( ECCurve curve, byte[] seed) { this.curve = curve; this.seed = seed; setFieldIdentifier(); }
public X9ECParameters getParameters() { if (params == null) { params = createParameters(); } return params; }
static BigInteger n() { return CURVE.getN(); }
public X9Curve( ECCurve curve) { this.curve = curve; this.seed = null; setFieldIdentifier(); }
public X9Curve( ECCurve curve) { this.curve = curve; this.seed = null; setFieldIdentifier(); }