PKCS7_SET_CONTENT(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

okay so bestie, welcome to the PKCS7_SET_CONTENT(3) page β€” yes, it's from the Library Functions Manual, and it's all about setting the nested contentInfo in a PKCS#7 structure. let's get into it πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

PKCS7_set_content, PKCS7_content_new β€” set the nested contentInfo in a PKCS#7 structure. periodt.

🌸 SYNOPSIS 🌸

library β€œlibcrypto” #include <openssl/pkcs7.h>

int
PKCS7_set_content(PKCS7 *outer, PKCS7 *inner);

int
PKCS7_content_new(PKCS7 *outer, int inner_type);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: if the contentType of the outer PKCS7 structure is SignedData or DigestedData, then PKCS7_set_content() sets the contentInfo field of the content field of outer to inner, without copying inner. no cap, it just puts it there. 🫢

if there was a previous contentInfo, it gets freed rather than overwritten. the rest of the internal state of outer and of its content stays unchanged. noted and respected πŸ’…

PKCS7_content_new() is similar, except that it first allocates and initializes a new, empty inner object of the given inner_type using PKCS7_new(3) and PKCS7_set_type(3). the inner_type can be any of the NIDs listed in the PKCS7_set_type(3) manual. iconic delegation, honestly πŸ‘‘

πŸ’– RETURN VALUES πŸ’–

these functions return 1 on success or 0 on failure. they fail if the contentType of outer is unsupported. PKCS7_content_new() can also fail when memory is exhausted. in case of failure, outer remains unchanged. so if it flops, it flops safely, bestie πŸ’€πŸ«Ά

🌈 SEE ALSO 🌈

⭐ STANDARDS ⭐

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

  • Section 7. General syntax
  • Section 9. Signed-data content type
  • Section 12. Digested-data content type

🧚 HISTORY 🧚

these functions first appeared in SSLeay 0.8.1 and have been available since OpenBSD 2.4. vintage but still serving πŸ’…

⚠️ CAVEATS ⚠️

despite the function names, these functions do not set the content field of outer β€” they only set the contentInfo field inside it. the rest of the content remains unchanged. read that twice, bestie, because the names are lowkey misleading πŸ™ˆ

mwah πŸ’‹ that's the whole page. this one came from the Debian build and is dated June 8, 2025 β€” and yes, it's still the PKCS7_SET_CONTENT(3) page. slay and stay cryptographic βœ¨πŸ‘‘

πŸ“¦ where this page comes from