OpenBSD manual page server

Manual Page Search Parameters

D2I_PKCS8_PRIV_KEY_INFO(3) Library Functions Manual D2I_PKCS8_PRIV_KEY_INFO(3)

d2i_PKCS8_PRIV_KEY_INFO, i2d_PKCS8_PRIV_KEY_INFO, d2i_PKCS8_PRIV_KEY_INFO_bio, i2d_PKCS8_PRIV_KEY_INFO_bio, d2i_PKCS8_PRIV_KEY_INFO_fp, i2d_PKCS8_PRIV_KEY_INFO_fpdecode and encode PKCS#8 private key

#include <openssl/x509.h>

PKCS8_PRIV_KEY_INFO *
d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **val_out, const unsigned char **der_in, long length);

int
i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *val_in, unsigned char **der_out);

PKCS8_PRIV_KEY_INFO *
d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *in_bio, PKCS8_PRIV_KEY_INFO **val_out);

int
i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *out_bio, PKCS8_PRIV_KEY_INFO *val_in);

PKCS8_PRIV_KEY_INFO *
d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *in_fp, PKCS8_PRIV_KEY_INFO **val_out);

int
i2d_PKCS8_PRIV_KEY_INFO_fp(BIO *out_fp, PKCS8_PRIV_KEY_INFO *val_in);

() and () decode and encode an ASN.1 PrivateKeyInfo structure defined in RFC 5208 section 5.

(), (), (), and () are similar except that they decode or encode using a BIO or FILE pointer.

For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

These functions all use unencrypted DER format. To store private keys in encrypted form, consider d2i_PKCS8PrivateKey_bio(3) or PEM_write_PKCS8PrivateKey(3).

d2i_PKCS8_PRIV_KEY_INFO(), d2i_PKCS8_PRIV_KEY_INFO_bio(), and d2i_PKCS8_PRIV_KEY_INFO_fp() return a PKCS8_PRIV_KEY_INFO object or NULL if an error occurs.

i2d_PKCS8_PRIV_KEY_INFO() returns the number of bytes successfully encoded or a negative value if an error occurs.

i2d_PKCS8_PRIV_KEY_INFO_bio() and i2d_PKCS8_PRIV_KEY_INFO_fp() return 1 for success or 0 if an error occurs.

ASN1_item_d2i(3), d2i_PKCS8PrivateKey_bio(3), d2i_PrivateKey(3), PEM_write_PKCS8_PRIV_KEY_INFO(3), PKCS8_PRIV_KEY_INFO_new(3)

RFC 5208: PKCS#8: Private-Key Information Syntax Specification

d2i_PKCS8_PRIV_KEY_INFO() and i2d_PKCS8_PRIV_KEY_INFO() first appeared in OpenSSL 0.9.3. d2i_PKCS8_PRIV_KEY_INFO_bio(), i2d_PKCS8_PRIV_KEY_INFO_bio(), d2i_PKCS8_PRIV_KEY_INFO_fp(), and i2d_PKCS8_PRIV_KEY_INFO_fp() first appeared in OpenSSL 0.9.4. All these functions have been available since OpenBSD 2.6.

March 21, 2018 OpenBSD-7.3