static OpenSSLKey getInstance(ECPublicKey ecPublicKey) throws InvalidKeyException {
        try {
            OpenSSLECGroupContext group = OpenSSLECGroupContext
                    .getInstance(ecPublicKey.getParams());
            OpenSSLECPointContext pubKey = OpenSSLECPointContext.getInstance(group,
                    ecPublicKey.getW());
            return new OpenSSLKey(NativeCrypto.EVP_PKEY_new_EC_KEY(group.getNativeRef(),
                    pubKey.getNativeRef(), null));
        } catch (Exception e) {
            throw new InvalidKeyException(e);
        }
    }
An implementation of a {@link java.security.PublicKey} for EC keys based on BoringSSL.
common/src/main/java/org/conscrypt/OpenSSLECPublicKey.java