]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/crypto/CMS_verify.pod
Remove SSLeay history, etc., from docs
[thirdparty/openssl.git] / doc / crypto / CMS_verify.pod
CommitLineData
e33ffaca
DSH
1=pod
2
3=head1 NAME
4
aafbe1cc 5CMS_verify, CMS_get0_signers - verify a CMS SignedData structure
e33ffaca
DSH
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, unsigned int flags);
12
13 STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
14
15=head1 DESCRIPTION
16
360bb61d 17CMS_verify() verifies a CMS SignedData structure. B<cms> is the CMS_ContentInfo
e33ffaca 18structure to verify. B<certs> is a set of certificates in which to search for
38d3a738
DSH
19the signing certificate(s). B<store> is a trusted certificate store used for
20chain verification. B<indata> is the detached content if the content is not
21present in B<cms>. The content is written to B<out> if it is not NULL.
e33ffaca
DSH
22
23B<flags> is an optional set of flags, which can be used to modify the verify
24operation.
25
38d3a738 26CMS_get0_signers() retrieves the signing certificate(s) from B<cms>, it must
c420fab5 27be called after a successful CMS_verify() operation.
e33ffaca
DSH
28
29=head1 VERIFY PROCESS
30
31Normally the verify process proceeds as follows.
32
33Initially some sanity checks are performed on B<cms>. The type of B<cms> must
360bb61d 34be SignedData. There must be at least one signature on the data and if
e33ffaca
DSH
35the content is detached B<indata> cannot be B<NULL>.
36
38d3a738
DSH
37An attempt is made to locate all the signing certificate(s), first looking in
38the B<certs> parameter (if it is not NULL) and then looking in any
39certificates contained in the B<cms> structure itself. If any signing
40certificate cannot be located the operation fails.
e33ffaca 41
38d3a738 42Each signing certificate is chain verified using the B<smimesign> purpose and
e33ffaca
DSH
43the supplied trusted certificate store. Any internal certificates in the message
44are used as untrusted CAs. If CRL checking is enabled in B<store> any internal
38d3a738 45CRLs are used in addition to attempting to look them up in B<store>. If any
e33ffaca
DSH
46chain verify fails an error code is returned.
47
48Finally the signed content is read (and written to B<out> is it is not NULL)
49and the signature's checked.
50
51If all signature's verify correctly then the function is successful.
52
53Any of the following flags (ored together) can be passed in the B<flags>
54parameter to change the default verify behaviour.
55
38d3a738
DSH
56If B<CMS_NOINTERN> is set the certificates in the message itself are not
57searched when locating the signing certificate(s). This means that all the
58signing certificates must be in the B<certs> parameter.
e33ffaca
DSH
59
60If B<CMS_NOCRL> is set and CRL checking is enabled in B<store> then any
61CRLs in the message itself are ignored.
62
63If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted
64from the content. If the content is not of type B<text/plain> then an error is
65returned.
66
38d3a738 67If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not
e33ffaca
DSH
68verified.
69
70If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not
71verified.
72
73If B<CMS_NO_CONTENT_VERIFY> is set then the content digest is not checked.
74
75=head1 NOTES
76
77One application of B<CMS_NOINTERN> is to only accept messages signed by
78a small number of certificates. The acceptable certificates would be passed
79in the B<certs> parameter. In this case if the signer is not one of the
80certificates supplied in B<certs> then the verify will fail because the
81signer cannot be found.
82
83In some cases the standard techniques for looking up and validating
84certificates are not appropriate: for example an application may wish to
85lookup certificates in a database or perform customised verification. This
86can be achieved by setting and verifying the signers certificates manually
87using the signed data utility functions.
88
89Care should be taken when modifying the default verify behaviour, for example
90setting B<CMS_NO_CONTENT_VERIFY> will totally disable all content verification
91and any modified content will be considered valid. This combination is however
92useful if one merely wishes to write the content to B<out> and its validity
93is not considered important.
94
95Chain verification should arguably be performed using the signing time rather
96than the current time. However since the signing time is supplied by the
97signer it cannot be trusted without additional evidence (such as a trusted
98timestamp).
99
100=head1 RETURN VALUES
101
102CMS_verify() returns 1 for a successful verification and zero if an error
c420fab5 103occurred.
e33ffaca 104
38d3a738 105CMS_get0_signers() returns all signers or NULL if an error occurred.
e33ffaca 106
9b86974e 107The error can be obtained from L<ERR_get_error(3)>
e33ffaca
DSH
108
109=head1 BUGS
110
38d3a738 111The trusted certificate store is not searched for the signing certificate,
e33ffaca
DSH
112this is primarily due to the inadequacies of the current B<X509_STORE>
113functionality.
114
38d3a738
DSH
115The lack of single pass processing means that the signed content must all
116be held in memory if it is not detached.
e33ffaca
DSH
117
118=head1 SEE ALSO
119
9b86974e 120L<ERR_get_error(3)>, L<CMS_sign(3)>
e33ffaca 121
e33ffaca 122=cut