#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);
CMS_get1_certs() returns all certificates in cms.
CMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. CMS_get1_crls() returns any CRLs in cms.
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.
As the 0 implies CMS_add0_cert() adds cert internally to cms and it must not be freed up after the call as opposed to CMS_add1_cert() where cert must be freed up.
The same certificate or CRL must not be added to the same cms structure more than once.
CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs or NULL if there are none or an error occurs. The only error which will occur in practice is if the cms type is invalid.
Licensed under the OpenSSL license (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>.