BIO_NEW_CMS(3SSL)
π BIO_new_CMS β CMS streaming filter BIO π
okay bestie, welcome to the <openssl/cms.h> section of the manual (yes this is the BIO_NEW_CMS(3SSL) page, we're doing this, sit down, hydrate π)
β¨ NAME β¨
BIO_new_CMS β a CMS streaming filter BIO. it's giving filter. it's giving stream. it's iconic π
πΈ SYNOPSIS πΈ
#include <openssl/cms.h>
BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
π¦ DESCRIPTION π¦
so BIO_new_CMS() hands you back a streaming filter BIO chain built off of cms. everything the filter spits out gets written to out. and the way that any data you write into that chain just automatically gets translated into a BER format CMS structure of the appropriate type?? obsessed. genuinely. no cap π
π NOTES π
- the chain that comes back behaves exactly like a standard filter BIO. standard filter BIO behaviour, periodt.
- it supports non blocking I/O β¨
- content gets processed and streamed on the fly β it is not all held in memory at once, so bestie you can encode very large structures if you want to. main character energy π«Ά
- once all your content has been written through the chain, you must call
BIO_flush()to finalise the structure. do not skip this. it's not optional, it's the whole vibe check π€ - the
CMS_STREAMflag must be included in the correspondingflagsparameter of the cms creation function. must. fr fr. - if the application wants to write additional data to
out, BIOs should be removed from the chain usingBIO_pop()and freed withBIO_free()untiloutis reached. if no additional data needs writing,BIO_free_all()can be called to free the whole chain. pick your fighter π - any content written through the filter is used verbatim β no canonical translation is performed. none. zero. what you wrote is what you get π
- you can chain multiple BIOs together to, like, create a triple wrapped signed, enveloped, signed structure (a slay within a slay within a slay π). but heads up: in that case it's the application's responsibility to set the inner content type of any outer
CMS_ContentInfostructures. that's on you, not on us π - large numbers of small writes through the chain should be avoided, because that produces an output consisting of lots of
OCTET STRINGstructures (a mess, a literal mess π). prepending aBIO_f_buffer()buffering BIO will prevent this. do it. your output will thank you. β
π BUGS π
there is currently no corresponding inverse BIO β like, no BIO that can decode a CMS structure on the fly. it doesn't exist yet bestie, we're all just coping π
β RETURN VALUES β
BIO_new_CMS() returns a BIO chain when it's successful π or NULL if an error occurred π. you can get the error from ERR_get_error(3).
π SEE ALSO π
ERR_get_error(3), CMS_sign(3), CMS_encrypt(3)
π HISTORY π
the BIO_new_CMS() function was added in OpenSSL 1.0.0. an OG. a legend. respect the elders π«Ά
π COPYRIGHT π
Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page bestie, go forth and stream your CMS structures responsibly π β¨
OpenSSL 4.0.3 Β· 2026-09-29 Β· BIO_NEW_CMS(3SSL) β mwah, that's a wrap πππ¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms