xref: /freebsd/secure/lib/libcrypto/man/man3/CMS_add0_cert.3 (revision b5daf675efc746611c7cfcd1fa474b8905064c4b)
-*- mode: troff; coding: utf-8 -*-
Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)

Standard preamble:
========================================================================
..
..
.. \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
. ds C` "" . ds C' "" 'br\} . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF ========================================================================

Title "CMS_ADD0_CERT 3ossl"
CMS_ADD0_CERT 3ossl 2025-07-01 3.5.1 OpenSSL
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
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
SYNOPSIS
Header "SYNOPSIS" .Vb 1 #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); .Ve
DESCRIPTION
Header "DESCRIPTION" \fBCMS_add0_cert() and CMS_add1_cert() add certificate cert to cms unless it is already present. This is used by CMS_sign_ex\|(3) and CMS_sign\|(3) and may be used before calling CMS_verify\|(3) to help chain building in certificate validation. As the 0 implies, CMS_add0_cert() adds cert internally to cms and on success it must not be freed up by the caller. In contrast, the caller of CMS_add1_cert() must free cert. \fIcms 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.

\fBCMS_get1_certs() returns all certificates in cms.

\fBCMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. \fIcms 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.

\fBCMS_get1_crls() returns all CRLs in cms.

NOTES
Header "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 \fIcrls fields of SignedData structure. For enveloped data they are added to OriginatorInfo.

"RETURN VALUES"
Header "RETURN VALUES" \fBCMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return 1 for success and 0 for failure.

\fBCMS_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"
Header "SEE ALSO" \fBERR_get_error\|(3), \fBCMS_sign\|(3), CMS_sign_ex\|(3), CMS_verify\|(3), \fBCMS_encrypt\|(3)
HISTORY
Header "HISTORY" \fBCMS_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
Header "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>.