Initial CMS API documentation.
[openssl.git] / doc / crypto / CMS_add0_cert.pod
1 =pod
2
3 =head1 NAME
4
5  CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls, - CMS certificate and CRL utility functions
6
7 =head1 SYNOPSIS
8
9  #include <openssl/cms.h>
10
11  int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
12  int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
13  STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
14
15  int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
16  STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
17
18
19 =head1 DESCRIPTION
20
21 CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms> which
22 must be of type signed data or enveloped data. 
23
24 CMS_get1_certs() returns all certificates in B<cms>.
25
26 CMS_add0_crl() adds CRL B<crl> to B<cms> which must be of type signed data or
27 enveloped data. CMS_get1_crls() returns any CRLs in B<cms>.
28
29 =head1 NOTES
30
31 As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and it
32 must not be freed up after the call as opposed to CMS_add1_cert() where B<cert>
33 must be freed up.
34
35 The same certificate or CRL must not be added to the same cms structure more
36 than once.
37
38 For signed data CMS types certificates and CRLs are added to the
39 B<certificates> and B<crls> fields of the SignedData structure. For enveloped
40 data they are added to B<OriginatorInfo>.
41
42 =head1 RETURN VALUES
43
44 CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() return 1 for success and
45 0 for failure. 
46
47 CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs
48 or NULL if there are none or an error occurs. The only error which will occur
49 in practice is if the B<cms> type is invalid.
50
51 =head1 SEE ALSO
52
53 L<ERR_get_error(3)|ERR_get_error(3)>
54
55 =head1 HISTORY
56
57 CMS_get0_type(), CMS_set1_eContentType() and CMS_get0_eContentType() were all
58 first added to OpenSSL 0.9.8
59
60 =cut