PrivateKey getPrivateKey() throws NoSuchAlgorithmException {
        switch (NativeCrypto.EVP_PKEY_type(ctx)) {
            case NativeConstants.EVP_PKEY_RSA:
                return OpenSSLRSAPrivateKey.getInstance(this);
            case NativeConstants.EVP_PKEY_EC:
                return new OpenSSLECPrivateKey(this);
            default:
                throw new NoSuchAlgorithmException("unknown PKEY type");
        }
    }
Parse a public key in PEM encoding from the provided input stream.

@throws InvalidKeyException if parsing fails
common/src/main/java/org/conscrypt/OpenSSLKey.java