/** * Creates an ECKey that cannot be used for signing, only verifying signatures, from the given point. The * compression state of pub will be preserved. * * @param pub - * * @return - */ public static ECKey fromPublicOnly(ECPoint pub) { return new ECKey(null, pub); }
/** * Creates an ECKey that simply trusts the caller to ensure that point is really the result of multiplying the * generator point by the private key. This is used to speed things up when you know you have the right values * already. The compression state of pub will be preserved. * * @param priv - * @param pub - * * @return - */ public static ECKey fromPrivateAndPrecalculatedPublic(BigInteger priv, ECPoint pub) { return new ECKey(priv, pub); }
/** * Creates an ECKey given the private key only. * * @param privKey - * * @return - */ public static ECKey fromPrivate(BigInteger privKey) { return new ECKey(privKey, CURVE.getG() .multiply(privKey)); }
/** * Creates an ECKey that cannot be used for signing, only verifying signatures, from the given encoded point. * The compression state of pub will be preserved. * * @param pub - * * @return - */ public static ECKey fromPublicOnly(byte[] pub) { return new ECKey(null, CURVE.getCurve() .decodePoint(pub)); }
/** * Creates an ECKey that simply trusts the caller to ensure that point is really the result of multiplying the * generator point by the private key. This is used to speed things up when you know you have the right values * already. The compression state of the point will be preserved. * * @param priv - * @param pub - * * @return - */ public static ECKey fromPrivateAndPrecalculatedPublic(byte[] priv, byte[] pub) { check(priv != null, "Private key must not be null"); check(pub != null, "Public key must not be null"); return new ECKey(new BigInteger(1, priv), CURVE.getCurve() .decodePoint(pub)); }