EVP_PKCS82PKEY(3) Library Functions Manual EVP_PKCS82PKEY(3)
NAME
EVP_PKCS82PKEY, EVP_PKEY2PKCS8 — convert between EVP_PKEY and PKCS#8 PrivateKeyInfo
SYNOPSIS
#include <openssl/x509.h>
EVP_PKEY *
EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *keyinfo);
PKCS8_PRIV_KEY_INFO *
EVP_PKEY2PKCS8(EVP_PKEY *pkey);
DESCRIPTION
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, GOST2001, and RSA. Application programs can add additional algorithms using EVP_PKEY_asn1_add0(3).
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.
SEE ALSO
EVP_PKEY_asn1_add0(3), EVP_PKEY_base_id(3), EVP_PKEY_new(3), PKCS8_pkey_set0(3), PKCS8_PRIV_KEY_INFO_new(3), X509_ALGOR_get0(3)
HISTORY
These functions first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6. GNU October 25, 2021 EVP_PKCS82PKEY(3)