RawECPrivateKey(final ECPrivateKey original) { super(original); s = original.getS(); params = original.getParams(); }
boolean isEqual(final ECPrivateKey key) { return super.isEqual(key) && Objects.equals(s, key.getS()) && Objects.equals(params, key.getParams()); } }
AlgorithmParameterSpec spec = k.getParams(); SigType type; if (spec.equals(SigType.ECDSA_SHA256_P256.getParams()))
ECPoint g = spec.getGenerator(); ECPoint w = ECUtil.scalarMult(g, s, curve); ECPublicKeySpec ecks = new ECPublicKeySpec(w, ecpriv.getParams()); KeyFactory eckf = KeyFactory.getInstance("EC"); ECPublicKey ecpub = (ECPublicKey) eckf.generatePublic(ecks);
RawECPrivateKey(final ECPrivateKey original) { super(original); s = original.getS(); params = original.getParams(); }
RawECPrivateKey(final ECPrivateKey original) { super(original); s = original.getS(); params = original.getParams(); }
public static boolean compareECKeys(ECPrivateKey k1, ECPrivateKey k2) { if (Objects.equals(k1, k2)) { return true; } else if (k1 == null || k2 == null) { return false; // both null is covered by Objects#equals } else { return Objects.equals(k1.getS(), k2.getS()) && compareECParams(k1.getParams(), k2.getParams()); } }
public static boolean compareECKeys(ECPrivateKey k1, ECPrivateKey k2) { if (Objects.equals(k1, k2)) { return true; } else if (k1 == null || k2 == null) { return false; // both null is covered by Objects#equals } else { return Objects.equals(k1.getS(), k2.getS()) && compareECParams(k1.getParams(), k2.getParams()); } }
private static ECParameterSpec getECParameterSpec(String curve, boolean isPrivate) throws Exception { KeyPair pair = generateECKeyPair(curve); return isPrivate ? ((ECPublicKey) pair.getPublic()).getParams() : ((ECPrivateKey) pair.getPrivate()).getParams(); }
public BCECPrivateKey( ECPrivateKey key, ProviderConfiguration configuration) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); this.configuration = configuration; }
public BCECPrivateKey( ECPrivateKey key, ProviderConfiguration configuration) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); this.configuration = configuration; }
public BCDSTU4145PrivateKey( ECPrivateKey key) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); }
public BCECGOST3410PrivateKey( ECPrivateKey key) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); }
public JCEECPrivateKey( ECPrivateKey key) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); }
public BCECGOST3410_2012PrivateKey( ECPrivateKey key) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); }
public JCEECPrivateKey( ECPrivateKey key) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); }
public BCDSTU4145PrivateKey( ECPrivateKey key) { this.d = key.getS(); this.algorithm = key.getAlgorithm(); this.ecSpec = key.getParams(); }
static OpenSSLKey wrapPlatformKey(ECPrivateKey ecPrivateKey) throws InvalidKeyException { OpenSSLECGroupContext group; try { group = OpenSSLECGroupContext.getInstance(ecPrivateKey.getParams()); } catch (InvalidAlgorithmParameterException e) { throw new InvalidKeyException("Unknown group parameters", e); } return wrapPlatformKey(ecPrivateKey, group); }
/** * Checks that the public key's params is the same as the private key's params, and the public key * is a valid point on the private key's curve. * * @since 1.1.0 */ public static void validatePublicKey(ECPublicKey publicKey, ECPrivateKey privateKey) throws GeneralSecurityException { validatePublicKeySpec(publicKey, privateKey); checkPointOnCurve(publicKey.getW(), privateKey.getParams().getCurve()); }
public static OpenSSLKey getInstance(ECPrivateKey ecPrivateKey) throws InvalidKeyException { try { OpenSSLECGroupContext group = OpenSSLECGroupContext.getInstance(ecPrivateKey .getParams()); final BigInteger privKey = ecPrivateKey.getS(); return new OpenSSLKey(NativeCrypto.EVP_PKEY_new_EC_KEY(group.getContext(), 0, privKey.toByteArray())); } catch (Exception e) { throw new InvalidKeyException(e); } }