1CMS_ADD0_CERT(3ossl) OpenSSL CMS_ADD0_CERT(3ossl)
2
3
4
6 CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl,
7 CMS_add1_crl, CMS_get1_crls - CMS certificate and CRL utility functions
8
10 #include <openssl/cms.h>
11
12 int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
13 int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
14 STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
15
16 int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
17 int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
18 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
19
21 CMS_add0_cert() and CMS_add1_cert() add certificate cert to cms. This
22 is used by CMS_sign_ex(3) and CMS_sign(3) and may be used before
23 calling CMS_verify(3) to help chain building in certificate validation.
24 cms must be of type signed data or (authenticated) enveloped data. For
25 signed data, such a certificate can be used when signing or verifying
26 to fill in the signer certificate or to provide an extra CA certificate
27 that may be needed for chain building in certificate validation.
28
29 CMS_get1_certs() returns all certificates in cms.
30
31 CMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. cms must be of
32 type signed data or (authenticated) enveloped data. For signed data,
33 such a CRL may be used in certificate validation with CMS_verify(3).
34 It may be given both for inclusion when signing a CMS message and when
35 verifying a signed CMS message.
36
37 CMS_get1_crls() returns all CRLs in cms.
38
40 The CMS_ContentInfo structure cms must be of type signed data or
41 enveloped data or an error will be returned.
42
43 For signed data certificates and CRLs are added to the certificates and
44 crls fields of SignedData structure. For enveloped data they are added
45 to OriginatorInfo.
46
47 As the 0 implies CMS_add0_cert() adds cert internally to cms and it
48 must not be freed up after the call as opposed to CMS_add1_cert() where
49 cert must be freed up.
50
51 The same certificate must not be added to the same cms structure more
52 than once.
53
55 CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl()
56 return 1 for success and 0 for failure.
57
58 CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates
59 or CRLs or NULL if there are none or an error occurs. The only error
60 which will occur in practice is if the cms type is invalid.
61
63 ERR_get_error(3), CMS_sign(3), CMS_sign_ex(3), CMS_verify(3),
64 CMS_encrypt(3)
65
67 Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
68
69 Licensed under the Apache License 2.0 (the "License"). You may not use
70 this file except in compliance with the License. You can obtain a copy
71 in the file LICENSE in the source distribution or at
72 <https://www.openssl.org/source/license.html>.
73
74
75
763.0.9 2023-07-27 CMS_ADD0_CERT(3ossl)