CMS_ADD0_CERT(3)
β¨ NAME β¨
okay so bestie, welcome to the CMS_ADD0_CERT(3) page β the libcrypto manual for the CMS certificate + CRL utility functions. The whole squad is:
CMS_add0_cert,CMS_add1_cert,CMS_get1_certs,CMS_add0_crl,CMS_add1_crl,CMS_get1_crlsβ CMS certificate and CRL utility functions.
π οΈ SYNOPSIS π οΈ
library βlibcryptoβ #include <openssl/cms.h>
int
CMS_add0_cert(CMS_ContentInfo *cms, X509 *certificate);
int
CMS_add1_cert(CMS_ContentInfo *cms, X509 *certificate);
STACK_OF(X509) *
CMS_get1_certs(CMS_ContentInfo *cms);
int
CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
int
CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
STACK_OF(X509_CRL) *
CMS_get1_crls(CMS_ContentInfo *cms);
π DESCRIPTION π
okay so here's the tea, bestie:
CMS_add0_cert() adds the certificate to the certificates field of cms if it is of the type SignedData or to the originatorInfo.certs field if it is of the type EnvelopedData. CMS_add1_cert() does the same and also increments the reference count of the certificate with X509_up_ref(3) in case of success.
CMS_get1_certs() returns all certificates in cms.
CMS_add0_crl() adds the crl to the crls field of cms if it is of the type SignedData or to the originatorInfo.crls field if it is of the type EnvelopedData. CMS_add1_crl() does the same and also increments the reference count of the crl with X509_CRL_up_ref(3) in case of success.
CMS_get1_crls() returns any CRLs in cms.
π¨ An error occurs ifcmsis of any type other thanSignedDataorEnvelopedData.
β οΈ The same certificate or crl must not be added to the same cms structure more than once.
π RETURN VALUES π
CMS_add0_cert(),CMS_add1_cert(),CMS_add0_crl(), andCMS_add1_crl()β return1for success or0for failure. πCMS_get1_certs()andCMS_get1_crls()β return theSTACKof certificates or CRLs orNULLif there are none or an error occurs.
Possible errors are that the cms type is invalid or memory allocation failure. Not all errors result in an error on the error stack.
The returned stack must be freed using the appropriate macro wrapper of sk_pop_free(3), namely sk_X509_pop_free() or sk_X509_CRL_pop_free(). Don't forget this, bestie β it's giving cleanup era. π§
π SEE ALSO π
CMS_ContentInfo_new(3), CMS_encrypt(3), CMS_final(3), CMS_sign(3), ERR_get_error(3)
π STANDARDS π
RFC 5652: Cryptographic Message Syntax- section 5.1:
SignedData Type - section 6.1:
EnvelopedData Type
- section 5.1:
π°οΈ HISTORY π°οΈ
CMS_add0_cert(), CMS_add1_cert(), CMS_get1_certs(), CMS_add0_crl(), and CMS_get1_crls() first appeared in OpenSSL 0.9.8h and CMS_add1_crl() in OpenSSL 1.0.0. These functions have been available since OpenBSD 6.7.
π«Ά source/version check: this manual page isCMS_ADD0_CERT(3), sourced fromDebian, datedJune 8, 2025. mwah, go slay your CMS code, 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