Exemplo n.º 1
0
 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);
   }
 }