libressl-EVP_PKCS82PKEY(3)

libressl-EVP_PKCS82PKEY3

Convert between evp_pkey and pkcs#8 privatekeyinfo

Usage

Crypto Library (libcrypto, -lcrypto)

#include <openssl/x509.h>

EVP_PKEY *

EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *keyinfo);

PKCS8_PRIV_KEY_INFO *

EVP_PKEY2PKCS8(EVP_PKEY *pkey);

Overview

EVP_PKCS82PKEY() extracts the private key from a PKCS#8 PrivateKeyInfo structure.

EVP_PKEY2PKCS8() creates a PKCS#8 PrivateKeyInfo structure representing the private key contained in pkey.

Supported algorithms include DH, DSA, EC, and RSA.

Return values

These functions return a newly allocated object or NULL if the algorithm indicated in keyinfo or pkey is unsupported or if memory allocation, decoding, or encoding fails.

History

These functions first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6.

From libressl 4.4.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's mdoc source.