---
name: "libressl-EVP_PKCS82PKEY"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-EVP_PKCS82PKEY"
---

# libressl-EVP\_PKCS82PKEY(3)

convert between EVP\_PKEY and PKCS#8 PrivateKeyInfo

## NAME

**EVP\_PKCS82PKEY**, **EVP\_PKEY2PKCS8** – convert between EVP\_PKEY and PKCS#8 PrivateKeyInfo

## SYNOPSIS

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*);

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