PKCS7_SET_CONTENT(3)
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 thecontentfield ofouterβ they only set thecontentInfofield inside it. the rest of thecontentremains 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
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2020 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