PKCS7_NEW(3)

NAME
PKCS7_new, PKCS7_free, PKCS7_SIGNED_new, PKCS7_SIGNED_free, PKCS7_ENVELOPE_new, PKCS7_ENVELOPE_free, PKCS7_SIGN_ENVELOPE_new, PKCS7_SIGN_ENVELOPE_free, PKCS7_DIGEST_new, PKCS7_DIGEST_free, PKCS7_ENCRYPT_new, PKCS7_ENCRYPT_free, PKCS7_ENC_CONTENT_new, PKCS7_ENC_CONTENT_free, PKCS7_SIGNER_INFO_new, PKCS7_SIGNER_INFO_free, PKCS7_RECIP_INFO_new, PKCS7_RECIP_INFO_free, PKCS7_ISSUER_AND_SERIAL_new, PKCS7_ISSUER_AND_SERIAL_free - PKCS#7 data structures

SYNOPSIS
libcrypto
#include <openssl/pkcs7.h>
PKCS7 *
PKCS7_new(void);
void
PKCS7_free(PKCS7 *p7);
PKCS7_SIGNED *
PKCS7_SIGNED_new(void);
void
PKCS7_SIGNED_free(PKCS7_SIGNED *signed);
PKCS7_ENVELOPE *
PKCS7_ENVELOPE_new(void);
void
PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *envelope);
PKCS7_SIGN_ENVELOPE *
PKCS7_SIGN_ENVELOPE_new(void);
void
PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *signed_envelope);
PKCS7_DIGEST *
PKCS7_DIGEST_new(void);
void
PKCS7_DIGEST_free(PKCS7_DIGEST *digested);
PKCS7_ENCRYPT *
PKCS7_ENCRYPT_new(void);
void
PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *encrypted);
PKCS7_ENC_CONTENT *
PKCS7_ENC_CONTENT_new(void);
void
PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *content);
PKCS7_SIGNER_INFO *
PKCS7_SIGNER_INFO_new(void);
void
PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *signer);
PKCS7_RECIP_INFO *
PKCS7_RECIP_INFO_new(void);
void
PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *recip);
PKCS7_ISSUER_AND_SERIAL *
PKCS7_ISSUER_AND_SERIAL_new(void);
void
PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *cert);

DESCRIPTION
PKCS#7 is an ASN.1-based format for transmitting data that has cryptography applied to it, in particular signed and encrypted data.

PKCS7_new() allocates and initializes an empty PKCS7 object, representing an ASN.1 ContentInfo structure defined in RFC 2315 section 7. It is the top-level data structure able to hold any kind of content that can be transmitted using PKCS#7. It can be used recursively in PKCS7_SIGNED and PKCS7_DIGEST objects. PKCS7_free() frees p7.

PKCS7_SIGNED_new() allocates and initializes an empty PKCS7_SIGNED object, representing an ASN.1 SignedData structure defined in RFC 2315 section 9. It can be used inside PKCS7 objects and holds any kind of content together with signatures by zero or more signers and information about the signing algorithm and certificates used. PKCS7_SIGNED_free() frees signed.

PKCS7_ENVELOPE_new() allocates and initializes an empty PKCS7_ENVELOPE object, representing an ASN.1 EnvelopedData structure defined in RFC 2315 section 10. It can be used inside PKCS7 objects and holds any kind of encrypted content together with content-encryption keys for one or more recipients. PKCS7_ENVELOPE_free() frees envelope.

PKCS7_SIGN_ENVELOPE_new() allocates and initializes an empty PKCS7_SIGN_ENVELOPE object, representing an ASN.1 SignedAndEnvelopedData structure defined in RFC 2315 section 11. It can be used inside PKCS7 objects and holds any kind of encrypted content together with signatures by one or more signers, information about the signing algorithm and certificates used, and content-encryption keys for one or more recipients. PKCS7_SIGN_ENVELOPE_free() frees signed_envelope.

PKCS7_DIGEST_new() allocates and initializes an empty PKCS7_DIGEST object, representing an ASN.1 DigestedData structure defined in RFC 2315 section 12. It can be used inside PKCS7 objects and holds any kind of content together with a message digest for checking its integrity and information about the algorithm used. PKCS7_DIGEST_free() frees digested.

PKCS7_ENCRYPT_new() allocates and initializes an empty PKCS7_ENCRYPT object, representing an ASN.1 EncryptedData structure defined in RFC 2315 section 13. It can be used inside PKCS7 objects and holds any kind of encrypted content. Keys are not included and need to be communicated separately. PKCS7_ENCRYPT_free() frees encrypted.

PKCS7_ENC_CONTENT_new() allocates and initializes an empty PKCS7_ENC_CONTENT object, representing an ASN.1 EncryptedContentInfo structure defined in RFC 2315 section 10.1. It can be used inside PKCS7_ENVELOPE, PKCS7_SIGN_ENVELOPE, and PKCS7_ENCRYPT objects and holds encrypted content together with information about the encryption algorithm used. PKCS7_ENC_CONTENT_free() frees content.

PKCS7_SIGNER_INFO_new() allocates and initializes an empty PKCS7_SIGNER_INFO object, representing an ASN.1 SignerInfo structure defined in RFC 2315 section 9.2. It can be used inside PKCS7_SIGNED and PKCS7_SIGN_ENVELOPE objects and holds a signature together with information about the signer and the algorithms used. PKCS7_SIGNER_INFO_free() frees signer.

PKCS7_RECIP_INFO_new() allocates and initializes an empty PKCS7_RECIP_INFO object, representing an ASN.1 RecipientInfo structure defined in RFC 2315 section 10.2. It can be used inside PKCS7_ENVELOPE and PKCS7_SIGN_ENVELOPE objects and holds a content-encryption key together with information about the intended recipient and the key encryption algorithm used. PKCS7_RECIP_INFO_free() frees recip.

PKCS7_ISSUER_AND_SERIAL_new() allocates and initializes an empty PKCS7_ISSUER_AND_SERIAL object, representing an ASN.1 IssuerAndSerialNumber structure defined in RFC 2315 section 6.7. It can be used inside PKCS7_SIGNER_INFO and PKCS7_RECIP_INFO objects and identifies a certificate by holding the distinguished name of the certificate issuer and an issuer-specific certificate serial number. PKCS7_ISSUER_AND_SERIAL_free() frees cert.

SEE ALSO
crypto(3), d2i_PKCS7(3), i2d_PKCS7_bio_stream(3), PEM_read_PKCS7(3), PEM_write_bio_PKCS7_stream(3), PKCS7_add_attribute(3), PKCS7_dataFinal(3), PKCS7_dataInit(3), PKCS7_decrypt(3), PKCS7_encrypt(3), PKCS7_final(3), PKCS7_get_signer_info(3), PKCS7_ISSUER_AND_SERIAL_digest(3), PKCS7_set_content(3), PKCS7_set_type(3), PKCS7_sign(3), PKCS7_sign_add_signer(3), PKCS7_verify(3), SMIME_read_PKCS7(3), SMIME_write_PKCS7(3)

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

HISTORY
These functions first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4.