CMS_ADD0_CERT(3ossl)
β¨ NAME β¨
CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_add1_crl, CMS_get1_crls β CMS certificate and CRL utility functions. This is the CMS_ADD0_CERT(3ossl) page, bestie, and we're about to get certs and CRLs all sorted in CMS. π
πΈ SYNOPSIS πΈ
#include <openssl/cms.h>
int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
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. CMS_add0_cert() and CMS_add1_cert() add certificate cert to cms unless it is already present. They're used by CMS_sign_ex(3) and CMS_sign(3), and they may be used before calling CMS_verify(3) to help chain building in certificate validation. π§
Now the ownership vibe check, because this part is important, no cap:
- As the
0implies,CMS_add0_cert()addscertinternally tocms, and on success it must not be freed up by the caller. π«Ά - In contrast, the caller of
CMS_add1_cert()must freecert. π
cms must be of type signed data or (authenticated) enveloped data. For signed data, such a certificate can be used when signing or verifying to fill in the signer certificate or to provide an extra CA certificate that may be needed for chain building in certificate validation. β¨
CMS_get1_certs() returns all certificates in cms. π
CMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. cms must be of type signed data or (authenticated) enveloped data. For signed data, such a CRL may be used in certificate validation with CMS_verify(3). It may be given both for inclusion when signing a CMS message and when verifying a signed CMS message. π
CMS_get1_crls() returns all CRLs in cms. π¦
π₯ NOTES π₯
The CMS_ContentInfo structure cms must be of type signed data or enveloped data or authenticated enveloped data or an error will be returned. π¨
For signed data, certificates and CRLs are added to the certificates and crls fields of SignedData structure. For enveloped data they are added to OriginatorInfo. π
π RETURN VALUES π
CMS_add0_cert(), CMS_add1_cert(), CMS_add0_crl() and CMS_add1_crl() return 1 for success and 0 for failure. β
CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs or NULL if there are none or an error occurs. Besides out-of-memory, the only error which will occur in practice is if the cms type is invalid. π
π SEE ALSO π
π°οΈ HISTORY π°οΈ
CMS_add0_cert() and CMS_add1_cert() have been changed in OpenSSL 3.2 not to throw an error if a certificate to be added is already present. π
π COPYRIGHT π
Copyright 2008-2024 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 bestie, that's the whole manual page β sending you good vibes from OpenSSL 3.5.0, dated 2026-09-25. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms