1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | CMS_add0_cert, CMS_add1_cert, CMS_get1_certs,
|
---|
6 | CMS_add0_crl, CMS_add1_crl, CMS_get1_crls
|
---|
7 | - CMS certificate and CRL utility functions
|
---|
8 |
|
---|
9 | =head1 SYNOPSIS
|
---|
10 |
|
---|
11 | #include <openssl/cms.h>
|
---|
12 |
|
---|
13 | int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
|
---|
14 | int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
|
---|
15 | STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
|
---|
16 |
|
---|
17 | int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
---|
18 | int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
---|
19 | STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
|
---|
20 |
|
---|
21 | =head1 DESCRIPTION
|
---|
22 |
|
---|
23 | CMS_add0_cert() and CMS_add1_cert() add certificate I<cert> to I<cms>
|
---|
24 | unless it is already present.
|
---|
25 | This is used by L<CMS_sign_ex(3)> and L<CMS_sign(3)> and may be used before
|
---|
26 | calling L<CMS_verify(3)> to help chain building in certificate validation.
|
---|
27 | As the 0 implies, CMS_add0_cert() adds I<cert> internally to I<cms>
|
---|
28 | and on success it must not be freed up by the caller.
|
---|
29 | In contrast, the caller of CMS_add1_cert() must free I<cert>.
|
---|
30 | I<cms> must be of type signed data or (authenticated) enveloped data.
|
---|
31 | For signed data, such a certificate can be used when signing or verifying
|
---|
32 | to fill in the signer certificate or to provide an extra CA certificate
|
---|
33 | that may be needed for chain building in certificate validation.
|
---|
34 |
|
---|
35 | CMS_get1_certs() returns all certificates in I<cms>.
|
---|
36 |
|
---|
37 | CMS_add0_crl() and CMS_add1_crl() add CRL I<crl> to I<cms>.
|
---|
38 | I<cms> must be of type signed data or (authenticated) enveloped data.
|
---|
39 | For signed data, such a CRL may be used in certificate validation
|
---|
40 | with L<CMS_verify(3)>.
|
---|
41 | It may be given both for inclusion when signing a CMS message
|
---|
42 | and when verifying a signed CMS message.
|
---|
43 |
|
---|
44 | CMS_get1_crls() returns all CRLs in I<cms>.
|
---|
45 |
|
---|
46 | =head1 NOTES
|
---|
47 |
|
---|
48 | The CMS_ContentInfo structure I<cms> must be of type signed data or enveloped
|
---|
49 | data or authenticated enveloped data or an error will be returned.
|
---|
50 |
|
---|
51 | For signed data, certificates and CRLs are added to the I<certificates> and
|
---|
52 | I<crls> fields of SignedData structure.
|
---|
53 | For enveloped data they are added to B<OriginatorInfo>.
|
---|
54 |
|
---|
55 | =head1 RETURN VALUES
|
---|
56 |
|
---|
57 | CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return
|
---|
58 | 1 for success and 0 for failure.
|
---|
59 |
|
---|
60 | CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs
|
---|
61 | or NULL if there are none or an error occurs. The only error which will occur
|
---|
62 | in practice is if the I<cms> type is invalid.
|
---|
63 |
|
---|
64 | =head1 SEE ALSO
|
---|
65 |
|
---|
66 | L<ERR_get_error(3)>,
|
---|
67 | L<CMS_sign(3)>, L<CMS_sign_ex(3)>, L<CMS_verify(3)>,
|
---|
68 | L<CMS_encrypt(3)>
|
---|
69 |
|
---|
70 | =head1 HISTORY
|
---|
71 |
|
---|
72 | CMS_add0_cert() and CMS_add1_cert() have been changed in OpenSSL 3.2
|
---|
73 | not to throw an error if a certificate to be added is already present.
|
---|
74 |
|
---|
75 | =head1 COPYRIGHT
|
---|
76 |
|
---|
77 | Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
|
---|
78 |
|
---|
79 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
80 | this file except in compliance with the License. You can obtain a copy
|
---|
81 | in the file LICENSE in the source distribution or at
|
---|
82 | L<https://www.openssl.org/source/license.html>.
|
---|
83 |
|
---|
84 | =cut
|
---|