SMIME_READ_CMS(3)

๐Ÿ“ฆ version 4.4.0, in alpine 3.24, arch rolling

๐Ÿ’– SMIME_READ_CMS(3) โ€” extract CMS ContentInfo from an S/MIME message ๐Ÿ’–

okay so bestie, welcome to the SMIME_READ_CMS(3) page from the Library Functions Manual. it's giving โ€œextract CMS ContentInfo from an S/MIME message,โ€ and honestly? iconic. no cap, that's the whole vibe. ๐ŸŽ€

๐ŸŒธ NAME ๐ŸŒธ

SMIME_read_CMS โ€” extract CMS ContentInfo from an S/MIME message. literally the main character function name. ๐Ÿ’…

โœจ SYNOPSIS โœจ

This one lives in libcrypto โ€” the synopsis literally says library โ€œlibcryptoโ€ โ€” and the header you need is #include <openssl/cms.h>. The signature is exactly:

#include <openssl/cms.h>

CMS_ContentInfo *
SMIME_read_CMS(BIO *in, BIO **bcont);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Okay so SMIME_read_CMS() parses a message in S/MIME format from in. the way that it just does that? main character energy, honestly. ๐Ÿ’ซ

If the message uses cleartext signing, the content is saved in a memory BIO which is written to *bcont and which can then be passed to CMS_verify(3) with the CMS_DETACHED flag set. periodt. Otherwise, *bcont is set to NULL, and the type of the returned structure can be determined using CMS_get0_type(3). iykyk. ๐Ÿ”ฅ

To support future functionality if bcont is not NULL, *bcont should be initialized to NULL, for example:

BIO *cont = NULL;
CMS_ContentInfo *cms = SMIME_read_CMS(in, &cont);

That's the exact little ritual, bestie โ€” don't skip it. ๐Ÿซถ

๐ŸŽ€ RETURN VALUES ๐ŸŽ€

SMIME_read_CMS() returns a valid CMS_ContentInfo structure or NULL if an error occurred. If it's NULL, the error can be obtained from ERR_get_error(3). no cap, that's your diagnostics hook. ๐Ÿ˜ญ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

all the linked lore, bestie. go read them if you want the full extended universe. iykyk. ๐Ÿ’œ

๐Ÿงš HISTORY ๐Ÿงš

SMIME_read_CMS() first appeared in OpenSSL 0.9.8h and has been available since OpenBSD 6.7. old enough to have lore, still relevant. periodt. ๐Ÿ‘‘

๐Ÿ’€ BUGS ๐Ÿ’€

The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will handle most S/MIME messages, more complex compound formats may not work. lowkey important, so don't expect it to eat every weird format. ๐Ÿ™ˆ

The parser assumes that the CMS_ContentInfo structure is always base64 encoded and will not handle the case where it is in binary format or uses quoted printable format. fr fr, that's a hard limit. ๐Ÿšซ

The use of a memory BIO to hold the signed content limits the size of the message which can be processed due to memory restraints: a streaming single pass option should be available. big sigh, but that's what the page says. ๐Ÿ˜ฎโ€๐Ÿ’จ


mwah ๐Ÿ’‹ โ€” this page came from Debian, dated June 11, 2025. SMIME_READ_CMS(3) out. ๐Ÿซถ

๐Ÿ“ฆ where this page comes from