summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/CMS_verify.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/CMS_verify.3')
-rw-r--r--src/lib/libcrypto/man/CMS_verify.3223
1 files changed, 223 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/CMS_verify.3 b/src/lib/libcrypto/man/CMS_verify.3
new file mode 100644
index 0000000000..cec1dc06d8
--- /dev/null
+++ b/src/lib/libcrypto/man/CMS_verify.3
@@ -0,0 +1,223 @@
1.\" $OpenBSD: CMS_verify.3,v 1.3 2019/08/10 23:41:22 schwarze Exp $
2.\" full merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2008 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: August 10 2019 $
52.Dt CMS_VERIFY 3
53.Os
54.Sh NAME
55.Nm CMS_verify ,
56.Nm CMS_get0_signers
57.Nd verify a CMS SignedData structure
58.Sh SYNOPSIS
59.In openssl/cms.h
60.Ft int
61.Fo CMS_verify
62.Fa "CMS_ContentInfo *cms"
63.Fa "STACK_OF(X509) *certs"
64.Fa "X509_STORE *store"
65.Fa "BIO *indata"
66.Fa "BIO *out"
67.Fa "unsigned int flags"
68.Fc
69.Ft STACK_OF(X509) *
70.Fo CMS_get0_signers
71.Fa "CMS_ContentInfo *cms"
72.Fc
73.Sh DESCRIPTION
74.Fn CMS_verify
75verifies a CMS SignedData structure.
76.Fa cms
77is the
78.Vt CMS_ContentInfo
79structure to verify.
80.Fa certs
81is a set of certificates in which to search for the signing
82certificate(s).
83.Fa store
84is a trusted certificate store used for chain verification.
85.Fa indata
86is the detached content if the content is not present in
87.Fa cms .
88The content is written to
89.Fa out
90if it is not
91.Dv NULL .
92.Pp
93.Fa flags
94is an optional set of flags, which can be used to modify the verify
95operation.
96.Pp
97.Fn CMS_get0_signers
98retrieves the signing certificate(s) from
99.Fa cms .
100It must be called after a successful
101.Fn CMS_verify
102operation.
103.Pp
104Normally the verify process proceeds as follows.
105.Pp
106Initially some sanity checks are performed on
107.Fa cms .
108The type of
109.Fa cms
110must be SignedData.
111There must be at least one signature on the data and if the content is
112detached;
113.Fa indata
114cannot be
115.Dv NULL .
116.Pp
117An attempt is made to locate all the signing certificate(s), first
118looking in the
119.Fa certs
120parameter (if it is not
121.Dv NULL )
122and then looking in any certificates contained in the
123.Fa cms
124structure itself.
125If any signing certificate cannot be located, the operation fails.
126.Pp
127Each signing certificate is chain verified using the
128.Sy smimesign
129purpose and the supplied trusted certificate store.
130Any internal certificates in the message are used as untrusted CAs.
131If CRL checking is enabled in
132.Fa store ,
133any internal CRLs are used in addition to attempting to look them up in
134.Fa store .
135If any chain verify fails, an error code is returned.
136.Pp
137Finally the signed content is read (and written to
138.Fa out
139if it is not
140.Dv NULL )
141and the signature is checked.
142.Pp
143If all signatures verify correctly, then the function is successful.
144.Pp
145Any of the following flags (OR'ed together) can be passed in the
146.Fa flags
147parameter to change the default verify behaviour:
148.Bl -tag -width Ds
149.It Dv CMS_NOINTERN
150Do not use the certificates in the message itself when
151locating the signing certificate(s).
152This means that all the signing certificates must be in the
153.Fa certs
154parameter.
155.It Dv CMS_NOCRL
156If CRL checking is enabled in
157.Fa store ,
158then any CRLs in the message itself are ignored.
159It Dv CMS_TEXT
160MIME headers for type text/plain are deleted from the content.
161If the content is not of type text/plain, an error is returned.
162.It Dv CMS_NO_SIGNER_CERT_VERIFY
163Do not verify signing certificates.
164.It Dv CMS_NO_ATTR_VERIFY
165Do not check the signed attributes signature.
166.It Dv CMS_NO_CONTENT_VERIFY
167Do not check the content digest.
168.El
169.Pp
170One application of
171.Dv CMS_NOINTERN
172is to only accept messages signed by a small number of certificates.
173The acceptable certificates would be passed in the
174.Fa certs
175parameter.
176In this case, if the signer is not one of the certificates supplied in
177.Fa certs ,
178then the verify will fail because the signer cannot be found.
179.Pp
180In some cases the standard techniques for looking up and validating
181certificates are not appropriate: for example an application may wish to
182lookup certificates in a database or perform customised verification.
183This can be achieved by setting and verifying the signers certificates
184manually using the signed data utility functions.
185.Pp
186Care should be taken when modifying the default verify behaviour, for
187example setting
188.Dv CMS_NO_CONTENT_VERIFY
189will totally disable all content verification and any modified content
190will be considered valid.
191This combination is however useful if one merely wishes to write the
192content to
193.Fa out
194and its validity is not considered important.
195.Pp
196Chain verification should arguably be performed using the signing time
197rather than the current time.
198However since the signing time is supplied by the signer it cannot be
199trusted without additional evidence (such as a trusted timestamp).
200.Sh RETURN VALUES
201.Fn CMS_verify
202returns 1 for a successful verification or zero if an error occurred.
203.Pp
204.Fn CMS_get0_signers
205returns all signers or
206.Dv NULL
207if an error occurred.
208.Pp
209The error can be obtained from
210.Xr ERR_get_error 3 .
211.Sh SEE ALSO
212.Xr CMS_sign 3
213.Sh HISTORY
214.Fn CMS_verify
215was added to OpenSSL 0.9.8.
216.Sh BUGS
217The trusted certificate store is not searched for the signing certificate.
218This is primarily due to the inadequacies of the current
219.Vt X509_STORE
220functionality.
221.Pp
222The lack of single pass processing means that the signed content must
223all be held in memory if it is not detached.