OpenBSD manual page server

Manual Page Search Parameters

D2I_PKCS12(3) Library Functions Manual D2I_PKCS12(3)

d2i_PKCS12, i2d_PKCS12, d2i_PKCS12_bio, i2d_PKCS12_bio, d2i_PKCS12_fp, i2d_PKCS12_fp, d2i_PKCS12_MAC_DATA, i2d_PKCS12_MAC_DATA, d2i_PKCS12_SAFEBAG, i2d_PKCS12_SAFEBAG, d2i_PKCS12_BAGS, i2d_PKCS12_BAGSdecode and encode PKCS#12 structures

#include <openssl/pkcs12.h>

PKCS12 *
d2i_PKCS12(PKCS12 **val_out, const unsigned char **der_in, long length);

int
i2d_PKCS12(PKCS12 *val_in, unsigned char **der_out);

PKCS12 *
d2i_PKCS12_bio(BIO *in_bio, PKCS12 **val_out);

int
i2d_PKCS12_bio(BIO *out_bio, PKCS12 *val_in);

PKCS12 *
d2i_PKCS12_fp(FILE *in_fp, PKCS12 **val_out);

int
i2d_PKCS12_fp(FILE *out_fp, PKCS12 *val_in);

PKCS12_MAC_DATA *
d2i_PKCS12_MAC_DATA(PKCS12_MAC_DATA **val_out, const unsigned char **der_in, long length);

int
i2d_PKCS12_MAC_DATA(PKCS12_MAC_DATA *val_in, unsigned char **der_out);

PKCS12_SAFEBAG *
d2i_PKCS12_SAFEBAG(PKCS12_SAFEBAG **val_out, const unsigned char **der_in, long length);

int
i2d_PKCS12_SAFEBAG(PKCS12_SAFEBAG *val_in, unsigned char **der_out);

PKCS12_BAGS *
d2i_PKCS12_BAGS(PKCS12_BAGS **val_out, const unsigned char **der_in, long length);

int
i2d_PKCS12_BAGS(PKCS12_BAGS *val_in, unsigned char **der_out);

These functions decode and encode PKCS#12 structures. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

() and () decode and encode an ASN.1 PFX (personal information exchange) structure defined in RFC 7292 section 4. (), (), (), and () are similar except that they decode or encode using a BIO or FILE pointer.

() and () decode and encode an ASN.1 MacData structure defined in RFC 7292 section 4.

() and () decode and encode an ASN.1 SafeBag structure defined in RFC 7292 section 4.2.

() and () decode and encode the bagValue field of an ASN.1 SafeBag structure.

d2i_PKCS12(), d2i_PKCS12_bio(), and d2i_PKCS12_fp() return a PKCS12 object or NULL if an error occurs.

d2i_PKCS12_MAC_DATA(), d2i_PKCS12_SAFEBAG(), and d2i_PKCS12_BAGS() return a PKCS12_MAC_DATA, PKCS12_SAFEBAG, or PKCS12_BAGS object, respectively, or NULL if an error occurs.

i2d_PKCS12(), i2d_PKCS12_MAC_DATA(), i2d_PKCS12_SAFEBAG(), and i2d_PKCS12_BAGS() return the number of bytes successfully encoded or a negative value if an error occurs.

i2d_PKCS12_bio() and i2d_PKCS12_fp() return 1 for success or 0 if an error occurs.

ASN1_item_d2i(3), PKCS12_create(3), PKCS12_new(3), PKCS12_parse(3), PKCS12_SAFEBAG_new(3)

RFC 7292: PKCS #12: Personal Information Exchange Syntax

d2i_PKCS12(), i2d_PKCS12(), d2i_PKCS12_bio(), i2d_PKCS12_bio(), d2i_PKCS12_fp(), i2d_PKCS12_fp(), d2i_PKCS12_MAC_DATA(), i2d_PKCS12_MAC_DATA(), d2i_PKCS12_SAFEBAG(), i2d_PKCS12_SAFEBAG(), d2i_PKCS12_BAGS(), and i2d_PKCS12_BAGS() first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6.

March 21, 2018 OpenBSD-7.3