summaryrefslogtreecommitdiffstats
path: root/doc/crypto/CMS_add0_cert.pod
blob: 942c172ef093fefb4eb352f7cd1536979fbc0262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
=pod

=head1 NAME

 CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls, - CMS certificate and CRL utility functions

=head1 SYNOPSIS

 #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);
 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);


=head1 DESCRIPTION

CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms> which
must be of type signed data or enveloped data. 

CMS_get1_certs() returns all certificates in B<cms>.

CMS_add0_crl() adds CRL B<crl> to B<cms> which must be of type signed data or
enveloped data. CMS_get1_crls() returns any CRLs in B<cms>.

=head1 NOTES

As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and it
must not be freed up after the call as opposed to CMS_add1_cert() where B<cert>
must be freed up.

The same certificate or CRL must not be added to the same cms structure more
than once.

For signed data CMS types certificates and CRLs are added to the
B<certificates> and B<crls> fields of the SignedData structure. For enveloped
data they are added to B<OriginatorInfo>.

=head1 RETURN VALUES

CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() return 1 for success and
0 for failure. 

CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs
or NULL if there are none or an error occurs. The only error which will occur
in practice is if the B<cms> type is invalid.

=head1 SEE ALSO

L<ERR_get_error(3)|ERR_get_error(3)>

=head1 HISTORY

CMS_add0_cert(), CMS_add1_cert(), CMS_get1_certs(), CMS_add0_crl()
and CMS_get1_crls() were all first added to OpenSSL 0.9.8

=cut