public OpenSSLECPrivateKey(ECPrivateKeySpec ecKeySpec) throws InvalidKeySpecException {
   try {
     group = OpenSSLECGroupContext.getInstance(ecKeySpec.getParams());
     final BigInteger privKey = ecKeySpec.getS();
     key =
         new OpenSSLKey(
             NativeCrypto.EVP_PKEY_new_EC_KEY(group.getContext(), 0, privKey.toByteArray()));
   } catch (Exception e) {
     throw new InvalidKeySpecException(e);
   }
 }
Example #2
0
 public JCEECPrivateKey(String algorithm, ECPrivateKeySpec spec) {
   this.algorithm = algorithm;
   this.d = spec.getS();
   this.ecSpec = spec.getParams();
 }