Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix nightly manual

This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.

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, 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.

SEE ALSO

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.
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org