SMIME_READ_CMS(3)
๐ 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 ๐
BIO_f_base64(3)BIO_new(3)CMS_ContentInfo_new(3)CMS_decrypt(3)CMS_get0_type(3)CMS_verify(3)d2i_CMS_ContentInfo(3)SMIME_read_PKCS7(3)SMIME_text(3)SMIME_write_CMS(3)
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
- alpine 3.24: libressl-doc 4.3.1-r0 ยท custom
- arch rolling: libressl 4.4.0-1 ยท ISC AND custom:OpenSSL
- Copyright (c) 2008 The OpenSSL Project. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms