D2I_PKCS12(3)

NAME
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_BAGS - decode and encode PKCS#12 structures

SYNOPSIS
#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);

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

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

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

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

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

RETURN VALUES
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.

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

STANDARDS
RFC 7292: PKCS #12: Personal Information Exchange Syntax