public static OpenSSLKey getInstance(ECPublicKey ecPublicKey) throws InvalidKeyException {
   try {
     OpenSSLECGroupContext group = OpenSSLECGroupContext.getInstance(ecPublicKey.getParams());
     OpenSSLECPointContext pubKey =
         OpenSSLECPointContext.getInstance(
             NativeCrypto.get_EC_GROUP_type(group.getNativeRef()), group, ecPublicKey.getW());
     return new OpenSSLKey(
         NativeCrypto.EVP_PKEY_new_EC_KEY(group.getNativeRef(), pubKey.getNativeRef(), null));
   } catch (Exception e) {
     throw new InvalidKeyException(e);
   }
 }