summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/PKCS7_verify.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-03 15:20:36 +0000
committerschwarze <>2016-11-03 15:20:36 +0000
commit60d59582dc15b87539a8dc135d2baf8a181ff37b (patch)
tree1ce08c06c8b7c83fa9592d241cddc0d7b95ce2ce /src/lib/libcrypto/man/PKCS7_verify.3
parent05002f727738ee445b4a9367f51474995302c6a6 (diff)
downloadopenbsd-60d59582dc15b87539a8dc135d2baf8a181ff37b.tar.gz
openbsd-60d59582dc15b87539a8dc135d2baf8a181ff37b.tar.bz2
openbsd-60d59582dc15b87539a8dc135d2baf8a181ff37b.zip
convert PEM and PKCS manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/PKCS7_verify.3')
-rw-r--r--src/lib/libcrypto/man/PKCS7_verify.3193
1 files changed, 193 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/PKCS7_verify.3 b/src/lib/libcrypto/man/PKCS7_verify.3
new file mode 100644
index 0000000000..3cc6cbac66
--- /dev/null
+++ b/src/lib/libcrypto/man/PKCS7_verify.3
@@ -0,0 +1,193 @@
1.Dd $Mdocdate: November 3 2016 $
2.Dt PKCS7_VERIFY 3
3.Os
4.Sh NAME
5.Nm PKCS7_verify ,
6.Nm PKCS7_get0_signers
7.Nd verify a PKCS#7 signedData structure
8.Sh SYNOPSIS
9.In openssl/pkcs7.h
10.Ft int
11.Fo PKCS7_verify
12.Fa "PKCS7 *p7"
13.Fa "STACK_OF(X509) *certs"
14.Fa "X509_STORE *store"
15.Fa "BIO *indata"
16.Fa "BIO *out"
17.Fa "int flags"
18.Fc
19.Ft STACK_OF(X509) *
20.Fo PKCS7_get0_signers
21.Fa "PKCS7 *p7"
22.Fa "STACK_OF(X509) *certs"
23.Fa "int flags"
24.Fc
25.Sh DESCRIPTION
26.Fn PKCS7_verify
27verifies a PKCS#7 signedData structure.
28.Fa p7
29is the
30.Vt PKCS7
31structure to verify.
32.Fa certs
33is a set of certificates in which to search for the signer's
34certificate.
35.Fa store
36is a trusted certificate store (used for chain verification).
37.Fa indata
38is the signed data if the content is not present in
39.Fa p7 ,
40that is if it is detached.
41The content is written to
42.Fa out
43if it is not
44.Dv NULL .
45.Pp
46.Fa flags
47is an optional set of flags, which can be used to modify the verify
48operation.
49.Pp
50.Fn PKCS7_get0_signers
51retrieves the signer's certificates from
52.Fa p7 .
53It does
54.Sy not
55check their validity or whether any signatures are valid.
56The
57.Fa certs
58and
59.Fa flags
60parameters have the same meanings as in
61.Fn PKCS7_verify .
62.Pp
63Normally the verify process proceeds as follows.
64.Pp
65Initially some sanity checks are performed on
66.Fa p7 .
67The type of
68.Fa p7
69must be signedData.
70There must be at least one signature on the data and if the content
71is detached,
72.Fa indata
73cannot be
74.Dv NULL .
75.Pp
76An attempt is made to locate all the signer's certificates, first
77looking in the
78.Fa certs
79parameter (if it is not
80.Dv NULL )
81and then looking in any certificates contained in the
82.Fa p7
83structure itself.
84If any signer's certificates cannot be located the operation fails.
85.Pp
86Each signer's certificate is chain verified using the
87.Sy smimesign
88purpose and the supplied trusted certificate store.
89Any internal certificates in the message are used as untrusted CAs.
90If any chain verify fails an error code is returned.
91.Pp
92Finally, the signed content is read (and written to
93.Fa out
94is it is not
95.Dv NULL )
96and the signature's checked.
97.Pp
98If all signature's verify correctly then the function is successful.
99.Pp
100Any of the following flags (OR'ed together) can be passed in the
101.Fa flags
102parameter to change the default verify behaviour.
103Only the flag
104.Dv PKCS7_NOINTERN
105is meaningful to
106.Fn PKCS7_get0_signers .
107.Pp
108If
109.Dv PKCS7_NOINTERN
110is set, the certificates in the message itself are not searched when
111locating the signer's certificate.
112This means that all the signer's certificates must be in the
113.Fa certs
114parameter.
115.Pp
116If the
117.Dv PKCS7_TEXT
118flag is set, MIME headers for type
119.Sy text/plain
120are deleted from the content.
121If the content is not of type
122.Sy text/plain ,
123then an error is returned.
124.Pp
125If
126.Dv PKCS7_NOVERIFY
127is set, the signer's certificates are not chain verified.
128.Pp
129If
130.Dv PKCS7_NOCHAIN
131is set, then the certificates contained in the message are not used as
132untrusted CAs.
133This means that the whole verify chain (apart from the signer's
134certificate) must be contained in the trusted store.
135.Pp
136If
137.Dv PKCS7_NOSIGS
138is set, then the signatures on the data are not checked.
139.Pp
140One application of
141.Dv PKCS7_NOINTERN
142is to only accept messages signed by a small number of certificates.
143The acceptable certificates would be passed in the
144.Fa certs
145parameter.
146In this case, if the signer is not one of the certificates supplied in
147.Fa certs ,
148then the verify will fail because the signer cannot be found.
149.Pp
150Care should be taken when modifying the default verify behaviour, for
151example setting
152.Dv PKCS7_NOVERIFY | PKCS7_NOSIGS
153will totally disable all verification and any signed message will be
154considered valid.
155This combination is however useful if one merely wishes to write the
156content to
157.Fa out
158and its validity is not considered important.
159.Pp
160Chain verification should arguably be performed using the signing time
161rather than the current time.
162However since the signing time is supplied by the signer, it cannot be
163trusted without additional evidence (such as a trusted timestamp).
164.Sh RETURN VALUES
165.Fn PKCS7_verify
166returns 1 for a successful verification and 0 or a negative value if
167an error occurs.
168.Pp
169.Fn PKCS7_get0_signers
170returns all signers or
171.Dv NULL
172if an error occurred.
173.Pp
174The error can be obtained from
175.Xr ERR_get_error 3 .
176.Sh SEE ALSO
177.Xr ERR_get_error 3 ,
178.Xr PKCS7_sign 3
179.Sh HISTORY
180.Fn PKCS7_verify
181was added to OpenSSL 0.9.5 .
182.Sh BUGS
183The trusted certificate store is not searched for the signer's
184certificate.
185This is primarily due to the inadequacies of the current
186.Vt X509_STORE
187functionality.
188.Pp
189The lack of single pass processing and the need to hold all data
190in memory as mentioned in
191.Xr PKCS7_sign 3
192also applies to
193.Fn PKCS7_verify .