CMS_COMPRESS(3)
π CMS_compress π
okay so bestie, this page is CMS_COMPRESS(3) from the Library Functions Manual β section 3, libcrypto β and the whole vibe is create a CMS CompressedData structure. no cap, it's giving crypto paperwork but make it compressed β¨
β¨ NAME β¨
CMS_compress β create a CMS CompressedData structure π
πΈ SYNOPSIS πΈ
library βlibcryptoβ #include <openssl/cms.h>
CMS_ContentInfo *
CMS_compress(BIO *in, int comp_nid, unsigned int flags);
π¦ DESCRIPTION π¦
CMS_compress() creates and returns a CMS CompressedData structure. Literally its whole job. π
comp_nid is the compression algorithm to use, or NID_undef to use the default algorithm. Currently, the default algorithm NID_zlib_compression is the only supported algorithm. If zlib support is not compiled in, CMS_compress() always returns an error. π
in provides the content to be compressed. That's the stuff going in, bestie.
Any of the following flags (OR'ed together) can be passed in the flags parameter:
CMS_TEXTβ Prepend MIME headers for typetext/plainto the data. Cute little headers, okay? πCMS_BINARYβ Do not translate the supplied content into MIME canonical format, even though that is required by the S/MIME specifications. This option should be used if the supplied data is in binary format. Otherwise, the translation will corrupt it. IfCMS_BINARYis set,CMS_TEXTis ignored. β οΈCMS_STREAMβ Return a partialCMS_ContentInfostructure suitable for streaming I/O: no data is read fromin. Several functions includingSMIME_write_CMS(3),i2d_CMS_bio_stream(3), orPEM_write_bio_CMS_stream(3)can be used to finalize the structure. Alternatively, finalization can be performed by obtaining the streaming ASN1 BIO directly usingBIO_new_CMS(3). Outputting the contents of theCMS_ContentInfostructure via a function that does not properly finalize it will give unpredictable results. πCMS_DETACHEDβ Do not include the compressed data in theCMS_ContentInfostructure. This is rarely used in practice and is not supported bySMIME_write_CMS(3). π
Additional compression parameters such as the zlib compression level cannot currently be set. So no, you can't just crank the zlib level, bestie β not today. π
π₯ RETURN VALUES π₯
CMS_compress() returns either a CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3). So if you get NULL, go ask ERR_get_error(3) what went wrong, fr fr. π
π«Ά SEE ALSO π«Ά
π STANDARDS π
RFC 3274: Compressed Data Content Type for Cryptographic Message Syntax (CMS) β that's the standard, periodt. β
π HISTORY π
CMS_compress() first appeared in OpenSSL 0.9.8h and has been available since OpenBSD 6.7.
The CMS_STREAM flag first appeared in OpenSSL 1.0.0. History really said "been here a minute," and honestly? iconic. π
And the cute little footer tea, since we're not copy-pasting the line: this is from Debian, dated June 8, 2025, and the page is CMS_COMPRESS(3) β mwah, bye bestie πβ¨
π¦ 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) 2019 Ingo Schwarze <schwarze@openbsd.org>
- 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