Raise an error on syscall failure in tls_retry_write_records
[openssl.git] / doc / man3 / CMS_add0_cert.pod
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 I<cms> must be of type signed data or (authenticated) enveloped data.
25 For 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 I<cms>.
30
31 CMS_add0_crl() and CMS_add1_crl() add CRL I<crl> to I<cms>.
32 I<cms> must be of type signed data or (authenticated) enveloped data.
33 For signed data, such a CRL may be used in certificate validation.
34 It may be given both for inclusion when signing a CMS message
35 and when verifying a signed CMS message.
36
37 CMS_get1_crls() returns all CRLs in I<cms>.
38
39 =head1 NOTES
40
41 The CMS_ContentInfo structure I<cms> must be of type signed data or enveloped
42 data or authenticated enveloped data or an error will be returned.
43
44 For signed data, certificates and CRLs are added to the I<certificates> and
45 I<crls> fields of SignedData structure.
46 For enveloped data they are added to B<OriginatorInfo>.
47
48 As the 0 implies, CMS_add0_cert() adds I<cert> internally to I<cms> and it
49 must not be freed up after the call as opposed to CMS_add1_cert() where I<cert>
50 must be freed up.
51
52 The same certificate or CRL must not be added to the same cms structure more
53 than once.
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)>,
68 L<CMS_encrypt(3)>
69
70 =head1 COPYRIGHT
71
72 Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
73
74 Licensed under the Apache License 2.0 (the "License").  You may not use
75 this file except in compliance with the License.  You can obtain a copy
76 in the file LICENSE in the source distribution or at
77 L<https://www.openssl.org/source/license.html>.
78
79 =cut