D2I_CMS_CONTENTINFO(3)

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

πŸ’… D2I_CMS_CONTENTINFO πŸ’…

okay so bestie, this is a page from the Library Functions Manual, section 3 β€” and it's all about the libcrypto girlies who turn Cryptographic Message Syntax data into bytes and back again. ✨


🌸 NAME 🌸

d2i_CMS_ContentInfo, i2d_CMS_ContentInfo, d2i_CMS_bio, i2d_CMS_bio, d2i_CMS_ReceiptRequest, i2d_CMS_ReceiptRequest β€” decode and encode Cryptographic Message Syntax data πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

library β€œlibcrypto”

#include <openssl/cms.h>
CMS_ContentInfo *
d2i_CMS_ContentInfo(CMS_ContentInfo **val_out,
    const unsigned char **der_in, long length);

int
i2d_CMS_ContentInfo(CMS_ContentInfo *val_in, unsigned char **out);

CMS_ContentInfo *
d2i_CMS_bio(BIO *in_bio, CMS_ContentInfo **val_out);

int
i2d_CMS_bio(BIO *out_bio, CMS_ContentInfo *val_in);

CMS_ReceiptRequest *
d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **val_out,
    const unsigned char **der_in, long length);

int
i2d_CMS_ReceiptRequest(CMS_ReceiptRequest *val_in, unsigned char **out);

πŸ’– DESCRIPTION πŸ’–

so these functions are literally the decode-and-encode duo for Cryptographic Message Syntax data structures. that's their whole job. πŸ’…

okay but fr, for the details about the semantics, examples, caveats, and bugs β€” go read ASN1_item_d2i(3). that's where the lore lives. πŸ“–

d2i_CMS_ContentInfo() and i2d_CMS_ContentInfo() decode and encode a CMS_ContentInfo structure defined in RFC 5652 section 3. iconic. πŸ‘‘

d2i_CMS_bio() and i2d_CMS_bio() are similar except that they decode or encode using a BIO pointer. same energy, different doorway. πŸšͺ✨

d2i_CMS_ReceiptRequest() and i2d_CMS_ReceiptRequest() decode and encode a CMS_ReceiptRequest structure defined in RFC 2634 section 2.7. receipts! literally. 🧾


⭐ RETURN VALUES ⭐

  • d2i_CMS_ContentInfo() and d2i_CMS_bio() return a valid CMS_ContentInfo structure β€” or NULL if an error occurs. 😭
  • d2i_CMS_ReceiptRequest() returns a valid CMS_ReceiptRequest structure β€” or NULL if an error occurs. πŸ™ˆ
  • i2d_CMS_ContentInfo() and i2d_CMS_ReceiptRequest() return the number of bytes successfully encoded, or a negative value if an error occurs. πŸ”₯
  • i2d_CMS_bio() returns 1 for success or 0 if an error occurs. periodt. πŸ’€
  • For all functions, the error code can be obtained by ERR_get_error(3). that's your girl when things go sideways. 🫢

πŸ‘€ SEE ALSO πŸ‘€


🌈 STANDARDS 🌈

  • RFC 5652: Cryptographic Message Syntax, section 3: General Syntax
  • RFC 2634: Enhanced Security Services for S/MIME, section 2.7: Receipt Request Syntax

πŸŽ€ HISTORY πŸŽ€

These functions first appeared in OpenSSL 0.9.8h and have been available since OpenBSD 6.7. she's been on the scene for a minute, ngl. πŸ’œ


and that's the whole vibe check πŸ§šπŸ’– β€” sourced from Debian, dated June 8, 2025, page D2I_CMS_CONTENTINFO(3). slay, you're welcome, mwah πŸ“πŸ’…

πŸ“¦ where this page comes from