CMS_DATA_CREATE(3SSL)

✨ CMS_DATA_CREATE ✨

okay bestie, we're looking at CMS_DATA_CREATE(3SSL) from the OpenSSL fam and it's literally the glow-up era of the classic CMS_data_create functions. it's giving "make me a CMS Data object" energy and honestly? we're obsessed πŸŽ€


🌸 NAME 🌸

CMS_data_create_ex, CMS_data_create β€” Create CMS Data object

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/cms.h>

CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,
                                    OSSL_LIB_CTX *libctx, const char *propq);
CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);

πŸ’– DESCRIPTION πŸ’–

so CMS_data_create_ex() conjures up a CMS_ContentInfo structure whose type is NID_pkcs7_data. the actual data gets handed over through the in BIO, like passing your bestie the aux cord 🎧.

the library context libctx and the property query propq get used when it's time to retrieve algorithms from providers β€” that's the whole "where do my algorithms come from" situation, iykyk.

as for flags, it supports the CMS_STREAM flag. and here's the tea: internally CMS_final() gets called unless CMS_STREAM is specified. so if you said stream, no final for you, periodt. πŸ’…

once you're done with it, that CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3). release her, she served her purpose 🫢

and CMS_data_create()? she's basically CMS_data_create_ex()'s chill twin β€” same vibe, except she uses the default values of NULL for both the library context libctx and the property query propq. lowkey simpler, highkey convenient ✨

πŸ’€ RETURN VALUES πŸ’€

if the allocation fails, both CMS_data_create_ex() and CMS_data_create() return NULL and set an error code that you can grab with ERR_get_error(3). not the moment we wanted but ok 😭

otherwise? they return a pointer to the newly allocated structure. slay, new object acquired πŸ‘‘

πŸ‘€ SEE ALSO πŸ‘€

🌈 HISTORY 🌈

the CMS_data_create_ex() method was added in OpenSSL 3.0. a whole era.

Copyright 2020-2021 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>

no cap, that's the whole page. go forth and create your CMS Data objects, bestie πŸ’œ

and that's a wrap from 4.0.3, dated 2026-09-29 β€” the CMS_DATA_CREATE(3SSL) page, signed off with love πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from