diff options
Diffstat (limited to 'src/lib/libcrypto/man/CMS_verify.3')
| -rw-r--r-- | src/lib/libcrypto/man/CMS_verify.3 | 223 |
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 | ||
| 75 | verifies a CMS SignedData structure. | ||
| 76 | .Fa cms | ||
| 77 | is the | ||
| 78 | .Vt CMS_ContentInfo | ||
| 79 | structure to verify. | ||
| 80 | .Fa certs | ||
| 81 | is a set of certificates in which to search for the signing | ||
| 82 | certificate(s). | ||
| 83 | .Fa store | ||
| 84 | is a trusted certificate store used for chain verification. | ||
| 85 | .Fa indata | ||
| 86 | is the detached content if the content is not present in | ||
| 87 | .Fa cms . | ||
| 88 | The content is written to | ||
| 89 | .Fa out | ||
| 90 | if it is not | ||
| 91 | .Dv NULL . | ||
| 92 | .Pp | ||
| 93 | .Fa flags | ||
| 94 | is an optional set of flags, which can be used to modify the verify | ||
| 95 | operation. | ||
| 96 | .Pp | ||
| 97 | .Fn CMS_get0_signers | ||
| 98 | retrieves the signing certificate(s) from | ||
| 99 | .Fa cms . | ||
| 100 | It must be called after a successful | ||
| 101 | .Fn CMS_verify | ||
| 102 | operation. | ||
| 103 | .Pp | ||
| 104 | Normally the verify process proceeds as follows. | ||
| 105 | .Pp | ||
| 106 | Initially some sanity checks are performed on | ||
| 107 | .Fa cms . | ||
| 108 | The type of | ||
| 109 | .Fa cms | ||
| 110 | must be SignedData. | ||
| 111 | There must be at least one signature on the data and if the content is | ||
| 112 | detached; | ||
| 113 | .Fa indata | ||
| 114 | cannot be | ||
| 115 | .Dv NULL . | ||
| 116 | .Pp | ||
| 117 | An attempt is made to locate all the signing certificate(s), first | ||
| 118 | looking in the | ||
| 119 | .Fa certs | ||
| 120 | parameter (if it is not | ||
| 121 | .Dv NULL ) | ||
| 122 | and then looking in any certificates contained in the | ||
| 123 | .Fa cms | ||
| 124 | structure itself. | ||
| 125 | If any signing certificate cannot be located, the operation fails. | ||
| 126 | .Pp | ||
| 127 | Each signing certificate is chain verified using the | ||
| 128 | .Sy smimesign | ||
| 129 | purpose and the supplied trusted certificate store. | ||
| 130 | Any internal certificates in the message are used as untrusted CAs. | ||
| 131 | If CRL checking is enabled in | ||
| 132 | .Fa store , | ||
| 133 | any internal CRLs are used in addition to attempting to look them up in | ||
| 134 | .Fa store . | ||
| 135 | If any chain verify fails, an error code is returned. | ||
| 136 | .Pp | ||
| 137 | Finally the signed content is read (and written to | ||
| 138 | .Fa out | ||
| 139 | if it is not | ||
| 140 | .Dv NULL ) | ||
| 141 | and the signature is checked. | ||
| 142 | .Pp | ||
| 143 | If all signatures verify correctly, then the function is successful. | ||
| 144 | .Pp | ||
| 145 | Any of the following flags (OR'ed together) can be passed in the | ||
| 146 | .Fa flags | ||
| 147 | parameter to change the default verify behaviour: | ||
| 148 | .Bl -tag -width Ds | ||
| 149 | .It Dv CMS_NOINTERN | ||
| 150 | Do not use the certificates in the message itself when | ||
| 151 | locating the signing certificate(s). | ||
| 152 | This means that all the signing certificates must be in the | ||
| 153 | .Fa certs | ||
| 154 | parameter. | ||
| 155 | .It Dv CMS_NOCRL | ||
| 156 | If CRL checking is enabled in | ||
| 157 | .Fa store , | ||
| 158 | then any CRLs in the message itself are ignored. | ||
| 159 | It Dv CMS_TEXT | ||
| 160 | MIME headers for type text/plain are deleted from the content. | ||
| 161 | If the content is not of type text/plain, an error is returned. | ||
| 162 | .It Dv CMS_NO_SIGNER_CERT_VERIFY | ||
| 163 | Do not verify signing certificates. | ||
| 164 | .It Dv CMS_NO_ATTR_VERIFY | ||
| 165 | Do not check the signed attributes signature. | ||
| 166 | .It Dv CMS_NO_CONTENT_VERIFY | ||
| 167 | Do not check the content digest. | ||
| 168 | .El | ||
| 169 | .Pp | ||
| 170 | One application of | ||
| 171 | .Dv CMS_NOINTERN | ||
| 172 | is to only accept messages signed by a small number of certificates. | ||
| 173 | The acceptable certificates would be passed in the | ||
| 174 | .Fa certs | ||
| 175 | parameter. | ||
| 176 | In this case, if the signer is not one of the certificates supplied in | ||
| 177 | .Fa certs , | ||
| 178 | then the verify will fail because the signer cannot be found. | ||
| 179 | .Pp | ||
| 180 | In some cases the standard techniques for looking up and validating | ||
| 181 | certificates are not appropriate: for example an application may wish to | ||
| 182 | lookup certificates in a database or perform customised verification. | ||
| 183 | This can be achieved by setting and verifying the signers certificates | ||
| 184 | manually using the signed data utility functions. | ||
| 185 | .Pp | ||
| 186 | Care should be taken when modifying the default verify behaviour, for | ||
| 187 | example setting | ||
| 188 | .Dv CMS_NO_CONTENT_VERIFY | ||
| 189 | will totally disable all content verification and any modified content | ||
| 190 | will be considered valid. | ||
| 191 | This combination is however useful if one merely wishes to write the | ||
| 192 | content to | ||
| 193 | .Fa out | ||
| 194 | and its validity is not considered important. | ||
| 195 | .Pp | ||
| 196 | Chain verification should arguably be performed using the signing time | ||
| 197 | rather than the current time. | ||
| 198 | However since the signing time is supplied by the signer it cannot be | ||
| 199 | trusted without additional evidence (such as a trusted timestamp). | ||
| 200 | .Sh RETURN VALUES | ||
| 201 | .Fn CMS_verify | ||
| 202 | returns 1 for a successful verification or zero if an error occurred. | ||
| 203 | .Pp | ||
| 204 | .Fn CMS_get0_signers | ||
| 205 | returns all signers or | ||
| 206 | .Dv NULL | ||
| 207 | if an error occurred. | ||
| 208 | .Pp | ||
| 209 | The 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 | ||
| 215 | was added to OpenSSL 0.9.8. | ||
| 216 | .Sh BUGS | ||
| 217 | The trusted certificate store is not searched for the signing certificate. | ||
| 218 | This is primarily due to the inadequacies of the current | ||
| 219 | .Vt X509_STORE | ||
| 220 | functionality. | ||
| 221 | .Pp | ||
| 222 | The lack of single pass processing means that the signed content must | ||
| 223 | all be held in memory if it is not detached. | ||
