CMS_UNCOMPRESS(3)

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

πŸ’… CMS_UNCOMPRESS(3) πŸ’…

okay so real talk bestie, we're in the Library Functions Manual today and the star of the show is CMS_uncompress β€” yes it's giving crypto, yes it's giving compressed, and yes you're gonna get it. 🫢

✨ NAME ✨

CMS_uncompress β€” uncompress a CMS CompressedData structure πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

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

int
CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
    unsigned int flags);

🌸 DESCRIPTION 🌸

so CMS_uncompress() does exactly what it says on the tin, no cap: it extracts and uncompresses the content of a CMS CompressedData structure β€” that's your cms β€” and writes it all out to out. iconic behaviour honestly. ✨

now, the rare case πŸ™ˆ β€” if the compressed content is detached, you pass it in through dcont. for normal use though? just set dcont to NULL and move on with your life. simple as.

the only currently supported compression algorithm is zlib. literally the only one. so if the structure indicates the use of any other algorithm, an error is returned, periodt. and heads up β€” if zlib support is not compiled in, CMS_uncompress() always returns an error. like, every time. πŸ’€

one more thing πŸŽ€ if the CMS_TEXT bit is set in flags, MIME headers for type text/plain are deleted from the content. slay. but if the content is not of type text/plain? error. sorry bestie, vibe check failed. 😭

πŸ‘‘ RETURN VALUES πŸ‘‘

  • 1 β€” success, we ate πŸ’…
  • 0 β€” failure, not the vibe

the error can be obtained from ERR_get_error(3). go get it, detective. πŸ”₯

🌈 SEE ALSO 🌈

⭐ STANDARDS ⭐

RFC 3274: Compressed Data Content Type for Cryptographic Message Syntax (CMS)

🧚 HISTORY 🧚

CMS_uncompress() first appeared in OpenSSL 0.9.8h and has been available since OpenBSD 6.7. she's been around, she's got lore. πŸ‘‘

πŸ’€ BUGS πŸ’€

okay so the lack of single pass processing and the need to hold all data in memory as mentioned in CMS_verify(3) also applies to CMS_uncompress(). yep, same energy, same caveat. fr fr keep that in mind. πŸ™ˆ


Debian 🌸 June 8, 2025 β€” and that's the whole page bestie, mwah πŸ’œπŸŽ€

πŸ“¦ where this page comes from