D2I_PKCS7(3)

NAME
d2i_PKCS7, i2d_PKCS7, d2i_PKCS7_bio, i2d_PKCS7_bio, d2i_PKCS7_fp, i2d_PKCS7_fp, d2i_PKCS7_DIGEST, i2d_PKCS7_DIGEST, d2i_PKCS7_ENCRYPT, i2d_PKCS7_ENCRYPT, d2i_PKCS7_ENC_CONTENT, i2d_PKCS7_ENC_CONTENT, d2i_PKCS7_ENVELOPE, i2d_PKCS7_ENVELOPE, d2i_PKCS7_ISSUER_AND_SERIAL, i2d_PKCS7_ISSUER_AND_SERIAL, d2i_PKCS7_RECIP_INFO, i2d_PKCS7_RECIP_INFO, d2i_PKCS7_SIGNED, i2d_PKCS7_SIGNED, d2i_PKCS7_SIGNER_INFO, i2d_PKCS7_SIGNER_INFO, d2i_PKCS7_SIGN_ENVELOPE, i2d_PKCS7_SIGN_ENVELOPE - decode and encode PKCS#7 data structures

SYNOPSIS
#include <openssl/pkcs7.h>
PKCS7 *
d2i_PKCS7(PKCS7 **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7(PKCS7 *val_in, unsigned char **der_out);
PKCS7 *
d2i_PKCS7_bio(BIO *in_bio, PKCS7 **val_out);
int
i2d_PKCS7_bio(BIO *out_bio, PKCS7 *val_in);
PKCS7 *
d2i_PKCS7_fp(FILE *in_fp, PKCS7 **val_out);
int
i2d_PKCS7_fp(FILE *out_fp, PKCS7 *val_in);
PKCS7_DIGEST *
d2i_PKCS7_DIGEST(PKCS7_DIGEST **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_DIGEST(PKCS7_DIGEST *val_in, unsigned char **der_out);
PKCS7_ENCRYPT *
d2i_PKCS7_ENCRYPT(PKCS7_ENCRYPT **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_ENCRYPT(PKCS7_ENCRYPT *val_in, unsigned char **der_out);
PKCS7_ENC_CONTENT *
d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *val_in, unsigned char **der_out);
PKCS7_ENVELOPE *
d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *val_in, unsigned char **der_out);
PKCS7_ISSUER_AND_SERIAL *
d2i_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL *val_in, unsigned char **der_out);
PKCS7_RECIP_INFO *
d2i_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO *val_in, unsigned char **der_out);
PKCS7_SIGNED *
d2i_PKCS7_SIGNED(PKCS7_SIGNED **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_SIGNED(PKCS7_SIGNED *val_in, unsigned char **der_out);
PKCS7_SIGNER_INFO *
d2i_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO *val_in, unsigned char **der_out);
PKCS7_SIGN_ENVELOPE *
d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **val_out, const unsigned char **der_in, long length);
int
i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *val_in, unsigned char **der_out);

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

d2i_PKCS7() and i2d_PKCS7() decode and encode an ASN.1 ContentInfo structure defined in RFC 2315 section 7. d2i_PKCS7_bio(), i2d_PKCS7_bio(), d2i_PKCS7_fp(), and i2d_PKCS7_fp() are similar except that they decode or encode using a BIO or FILE pointer.

d2i_PKCS7_DIGEST() and i2d_PKCS7_DIGEST() decode and encode an ASN.1 DigestedData structure defined in RFC 2315 section 12.

d2i_PKCS7_ENCRYPT() and i2d_PKCS7_ENCRYPT() decode and encode an ASN.1 EncryptedData structure defined in RFC 2315 section 13.

d2i_PKCS7_ENC_CONTENT() and i2d_PKCS7_ENC_CONTENT() decode and encode an ASN.1 EncryptedContentInfo structure defined in RFC 2315 section 10.1.

d2i_PKCS7_ENVELOPE() and i2d_PKCS7_ENVELOPE() decode and encode an ASN.1 EnvelopedData structure defined in RFC 2315 section 10.

d2i_PKCS7_ISSUER_AND_SERIAL() and i2d_PKCS7_ISSUER_AND_SERIAL() decode and encode an ASN.1 IssuerAndSerialNumber structure defined in RFC 2315 section 6.7.

d2i_PKCS7_RECIP_INFO() and i2d_PKCS7_RECIP_INFO() decode and encode an ASN.1 RecipientInfo structure defined in RFC 2315 section 10.2.

d2i_PKCS7_SIGNED() and i2d_PKCS7_SIGNED() decode and encode an ASN.1 SignedData structure defined in RFC 2315 section 9.

d2i_PKCS7_SIGNER_INFO() and i2d_PKCS7_SIGNER_INFO() decode and encode an ASN.1 SignerInfo structure defined in RFC 2315 section 9.2.

d2i_PKCS7_SIGN_ENVELOPE() and i2d_PKCS7_SIGN_ENVELOPE() decode and encode an ASN.1 SignedAndEnvelopedData structure defined in RFC 2315 section 11.

RETURN VALUES
d2i_PKCS7(), d2i_PKCS7_bio(), and d2i_PKCS7_fp() return a PKCS7 object or NULL if an error occurs.

d2i_PKCS7_DIGEST(), d2i_PKCS7_ENCRYPT(), d2i_PKCS7_ENC_CONTENT(), d2i_PKCS7_ENVELOPE(), d2i_PKCS7_ISSUER_AND_SERIAL(), d2i_PKCS7_RECIP_INFO(), d2i_PKCS7_SIGNED(), d2i_PKCS7_SIGNER_INFO(), and d2i_PKCS7_SIGN_ENVELOPE() return an object of the respective type or NULL if an error occurs.

i2d_PKCS7(), i2d_PKCS7_DIGEST(), i2d_PKCS7_ENCRYPT(), i2d_PKCS7_ENC_CONTENT(), i2d_PKCS7_ENVELOPE(), i2d_PKCS7_ISSUER_AND_SERIAL(), i2d_PKCS7_RECIP_INFO(), i2d_PKCS7_SIGNED(), i2d_PKCS7_SIGNER_INFO(), and i2d_PKCS7_SIGN_ENVELOPE() return the number of bytes successfully encoded or a negative value if an error occurs.

i2d_PKCS7_bio() and i2d_PKCS7_fp() return 1 for success or 0 if an error occurs.

SEE ALSO
ASN1_item_d2i(3), i2d_PKCS7_bio_stream(3), PEM_write_bio_PKCS7_stream(3), PEM_write_PKCS7(3), PKCS7_new(3), SMIME_write_PKCS7(3)

STANDARDS
RFC 2315: PKCS #7: Cryptographic Message Syntax Version 1.5

HISTORY
d2i_PKCS7(), i2d_PKCS7(), d2i_PKCS7_bio(), i2d_PKCS7_bio(), d2i_PKCS7_fp(), i2d_PKCS7_fp(), d2i_PKCS7_DIGEST(), i2d_PKCS7_DIGEST(), d2i_PKCS7_ENCRYPT(), i2d_PKCS7_ENCRYPT(), d2i_PKCS7_ENC_CONTENT(), i2d_PKCS7_ENC_CONTENT(), d2i_PKCS7_ENVELOPE(), i2d_PKCS7_ENVELOPE(), d2i_PKCS7_ISSUER_AND_SERIAL(), i2d_PKCS7_ISSUER_AND_SERIAL(), d2i_PKCS7_RECIP_INFO(), i2d_PKCS7_RECIP_INFO(), d2i_PKCS7_SIGNED(), i2d_PKCS7_SIGNED(), d2i_PKCS7_SIGNER_INFO(), i2d_PKCS7_SIGNER_INFO(), d2i_PKCS7_SIGN_ENVELOPE(), and i2d_PKCS7_SIGN_ENVELOPE() first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4.