PKCS7_NEW(3)
π NAME π
okay so bestie, this whole page is about PKCS#7 data structures β specifically 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, and PKCS7_ISSUER_AND_SERIAL_free. iconic lineup fr fr π
π¦ SYNOPSIS π¦
library β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 πΈ
okay so <hotpink>PKCS#7</hotpink> is an ASN.1-based format for transmitting data that has cryptography applied to it, in particular signed and encrypted data. it's giving secure little envelope energy π
PKCS7_new()/PKCS7_free()βPKCS7_new()allocates and initializes an emptyPKCS7object, representing an ASN.1ContentInfostructure 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 inPKCS7_SIGNEDandPKCS7_DIGESTobjects.PKCS7_free()freesp7. π«ΆPKCS7_SIGNED_new()/PKCS7_SIGNED_free()βPKCS7_SIGNED_new()allocates and initializes an emptyPKCS7_SIGNEDobject, representing an ASN.1SignedDatastructure defined in RFC 2315 section 9. It can be used insidePKCS7objects 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()freessigned. β¨PKCS7_ENVELOPE_new()/PKCS7_ENVELOPE_free()βPKCS7_ENVELOPE_new()allocates and initializes an emptyPKCS7_ENVELOPEobject, representing an ASN.1EnvelopedDatastructure defined in RFC 2315 section 10. It can be used insidePKCS7objects and holds any kind of encrypted content together with content-encryption keys for one or more recipients.PKCS7_ENVELOPE_free()freesenvelope. π¦PKCS7_SIGN_ENVELOPE_new()/PKCS7_SIGN_ENVELOPE_free()βPKCS7_SIGN_ENVELOPE_new()allocates and initializes an emptyPKCS7_SIGN_ENVELOPEobject, representing an ASN.1SignedAndEnvelopedDatastructure defined in RFC 2315 section 11. It can be used insidePKCS7objects 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()freessigned_envelope. πPKCS7_DIGEST_new()/PKCS7_DIGEST_free()βPKCS7_DIGEST_new()allocates and initializes an emptyPKCS7_DIGESTobject, representing an ASN.1DigestedDatastructure defined in RFC 2315 section 12. It can be used insidePKCS7objects and holds any kind of content together with a message digest for checking its integrity and information about the algorithm used.PKCS7_DIGEST_free()freesdigested. πPKCS7_ENCRYPT_new()/PKCS7_ENCRYPT_free()βPKCS7_ENCRYPT_new()allocates and initializes an emptyPKCS7_ENCRYPTobject, representing an ASN.1EncryptedDatastructure defined in RFC 2315 section 13. It can be used insidePKCS7objects and holds any kind of encrypted content. Keys are not included and need to be communicated separately.PKCS7_ENCRYPT_free()freesencrypted. π₯PKCS7_ENC_CONTENT_new()/PKCS7_ENC_CONTENT_free()βPKCS7_ENC_CONTENT_new()allocates and initializes an emptyPKCS7_ENC_CONTENTobject, representing an ASN.1EncryptedContentInfostructure defined in RFC 2315 section 10.1. It can be used insidePKCS7_ENVELOPE,PKCS7_SIGN_ENVELOPE, andPKCS7_ENCRYPTobjects and holds encrypted content together with information about the encryption algorithm used.PKCS7_ENC_CONTENT_free()freescontent. πPKCS7_SIGNER_INFO_new()/PKCS7_SIGNER_INFO_free()βPKCS7_SIGNER_INFO_new()allocates and initializes an emptyPKCS7_SIGNER_INFOobject, representing an ASN.1SignerInfostructure defined in RFC 2315 section 9.2. It can be used insidePKCS7_SIGNEDandPKCS7_SIGN_ENVELOPEobjects and holds a signature together with information about the signer and the algorithms used.PKCS7_SIGNER_INFO_free()freessigner. πPKCS7_RECIP_INFO_new()/PKCS7_RECIP_INFO_free()βPKCS7_RECIP_INFO_new()allocates and initializes an emptyPKCS7_RECIP_INFOobject, representing an ASN.1RecipientInfostructure defined in RFC 2315 section 10.2. It can be used insidePKCS7_ENVELOPEandPKCS7_SIGN_ENVELOPEobjects and holds a content-encryption key together with information about the intended recipient and the key encryption algorithm used.PKCS7_RECIP_INFO_free()freesrecip. πPKCS7_ISSUER_AND_SERIAL_new()/PKCS7_ISSUER_AND_SERIAL_free()βPKCS7_ISSUER_AND_SERIAL_new()allocates and initializes an emptyPKCS7_ISSUER_AND_SERIALobject, representing an ASN.1IssuerAndSerialNumberstructure defined in RFC 2315 section 6.7. It can be used insidePKCS7_SIGNER_INFOandPKCS7_RECIP_INFOobjects 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()freescert. β
π 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 β yes bestie, that's the standard, periodt. π
π HISTORY π
These functions first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4. nostalgic little lore drop ngl π«Ά
footer tea β: the source/version is Debian, the date is June 8, 2025, and the manual name is PKCS7_NEW(3) β that's the whole cute sign-off, mwah πβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms