diff options
Diffstat (limited to 'src/lib/libcrypto/man/PKCS7_verify.3')
| -rw-r--r-- | src/lib/libcrypto/man/PKCS7_verify.3 | 193 |
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 | ||
| 27 | verifies a PKCS#7 signedData structure. | ||
| 28 | .Fa p7 | ||
| 29 | is the | ||
| 30 | .Vt PKCS7 | ||
| 31 | structure to verify. | ||
| 32 | .Fa certs | ||
| 33 | is a set of certificates in which to search for the signer's | ||
| 34 | certificate. | ||
| 35 | .Fa store | ||
| 36 | is a trusted certificate store (used for chain verification). | ||
| 37 | .Fa indata | ||
| 38 | is the signed data if the content is not present in | ||
| 39 | .Fa p7 , | ||
| 40 | that is if it is detached. | ||
| 41 | The content is written to | ||
| 42 | .Fa out | ||
| 43 | if it is not | ||
| 44 | .Dv NULL . | ||
| 45 | .Pp | ||
| 46 | .Fa flags | ||
| 47 | is an optional set of flags, which can be used to modify the verify | ||
| 48 | operation. | ||
| 49 | .Pp | ||
| 50 | .Fn PKCS7_get0_signers | ||
| 51 | retrieves the signer's certificates from | ||
| 52 | .Fa p7 . | ||
| 53 | It does | ||
| 54 | .Sy not | ||
| 55 | check their validity or whether any signatures are valid. | ||
| 56 | The | ||
| 57 | .Fa certs | ||
| 58 | and | ||
| 59 | .Fa flags | ||
| 60 | parameters have the same meanings as in | ||
| 61 | .Fn PKCS7_verify . | ||
| 62 | .Pp | ||
| 63 | Normally the verify process proceeds as follows. | ||
| 64 | .Pp | ||
| 65 | Initially some sanity checks are performed on | ||
| 66 | .Fa p7 . | ||
| 67 | The type of | ||
| 68 | .Fa p7 | ||
| 69 | must be signedData. | ||
| 70 | There must be at least one signature on the data and if the content | ||
| 71 | is detached, | ||
| 72 | .Fa indata | ||
| 73 | cannot be | ||
| 74 | .Dv NULL . | ||
| 75 | .Pp | ||
| 76 | An attempt is made to locate all the signer's certificates, first | ||
| 77 | looking in the | ||
| 78 | .Fa certs | ||
| 79 | parameter (if it is not | ||
| 80 | .Dv NULL ) | ||
| 81 | and then looking in any certificates contained in the | ||
| 82 | .Fa p7 | ||
| 83 | structure itself. | ||
| 84 | If any signer's certificates cannot be located the operation fails. | ||
| 85 | .Pp | ||
| 86 | Each signer's certificate is chain verified using the | ||
| 87 | .Sy smimesign | ||
| 88 | purpose and the supplied trusted certificate store. | ||
| 89 | Any internal certificates in the message are used as untrusted CAs. | ||
| 90 | If any chain verify fails an error code is returned. | ||
| 91 | .Pp | ||
| 92 | Finally, the signed content is read (and written to | ||
| 93 | .Fa out | ||
| 94 | is it is not | ||
| 95 | .Dv NULL ) | ||
| 96 | and the signature's checked. | ||
| 97 | .Pp | ||
| 98 | If all signature's verify correctly then the function is successful. | ||
| 99 | .Pp | ||
| 100 | Any of the following flags (OR'ed together) can be passed in the | ||
| 101 | .Fa flags | ||
| 102 | parameter to change the default verify behaviour. | ||
| 103 | Only the flag | ||
| 104 | .Dv PKCS7_NOINTERN | ||
| 105 | is meaningful to | ||
| 106 | .Fn PKCS7_get0_signers . | ||
| 107 | .Pp | ||
| 108 | If | ||
| 109 | .Dv PKCS7_NOINTERN | ||
| 110 | is set, the certificates in the message itself are not searched when | ||
| 111 | locating the signer's certificate. | ||
| 112 | This means that all the signer's certificates must be in the | ||
| 113 | .Fa certs | ||
| 114 | parameter. | ||
| 115 | .Pp | ||
| 116 | If the | ||
| 117 | .Dv PKCS7_TEXT | ||
| 118 | flag is set, MIME headers for type | ||
| 119 | .Sy text/plain | ||
| 120 | are deleted from the content. | ||
| 121 | If the content is not of type | ||
| 122 | .Sy text/plain , | ||
| 123 | then an error is returned. | ||
| 124 | .Pp | ||
| 125 | If | ||
| 126 | .Dv PKCS7_NOVERIFY | ||
| 127 | is set, the signer's certificates are not chain verified. | ||
| 128 | .Pp | ||
| 129 | If | ||
| 130 | .Dv PKCS7_NOCHAIN | ||
| 131 | is set, then the certificates contained in the message are not used as | ||
| 132 | untrusted CAs. | ||
| 133 | This means that the whole verify chain (apart from the signer's | ||
| 134 | certificate) must be contained in the trusted store. | ||
| 135 | .Pp | ||
| 136 | If | ||
| 137 | .Dv PKCS7_NOSIGS | ||
| 138 | is set, then the signatures on the data are not checked. | ||
| 139 | .Pp | ||
| 140 | One application of | ||
| 141 | .Dv PKCS7_NOINTERN | ||
| 142 | is to only accept messages signed by a small number of certificates. | ||
| 143 | The acceptable certificates would be passed in the | ||
| 144 | .Fa certs | ||
| 145 | parameter. | ||
| 146 | In this case, if the signer is not one of the certificates supplied in | ||
| 147 | .Fa certs , | ||
| 148 | then the verify will fail because the signer cannot be found. | ||
| 149 | .Pp | ||
| 150 | Care should be taken when modifying the default verify behaviour, for | ||
| 151 | example setting | ||
| 152 | .Dv PKCS7_NOVERIFY | PKCS7_NOSIGS | ||
| 153 | will totally disable all verification and any signed message will be | ||
| 154 | considered valid. | ||
| 155 | This combination is however useful if one merely wishes to write the | ||
| 156 | content to | ||
| 157 | .Fa out | ||
| 158 | and its validity is not considered important. | ||
| 159 | .Pp | ||
| 160 | Chain verification should arguably be performed using the signing time | ||
| 161 | rather than the current time. | ||
| 162 | However since the signing time is supplied by the signer, it cannot be | ||
| 163 | trusted without additional evidence (such as a trusted timestamp). | ||
| 164 | .Sh RETURN VALUES | ||
| 165 | .Fn PKCS7_verify | ||
| 166 | returns 1 for a successful verification and 0 or a negative value if | ||
| 167 | an error occurs. | ||
| 168 | .Pp | ||
| 169 | .Fn PKCS7_get0_signers | ||
| 170 | returns all signers or | ||
| 171 | .Dv NULL | ||
| 172 | if an error occurred. | ||
| 173 | .Pp | ||
| 174 | The 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 | ||
| 181 | was added to OpenSSL 0.9.5 . | ||
| 182 | .Sh BUGS | ||
| 183 | The trusted certificate store is not searched for the signer's | ||
| 184 | certificate. | ||
| 185 | This is primarily due to the inadequacies of the current | ||
| 186 | .Vt X509_STORE | ||
| 187 | functionality. | ||
| 188 | .Pp | ||
| 189 | The lack of single pass processing and the need to hold all data | ||
| 190 | in memory as mentioned in | ||
| 191 | .Xr PKCS7_sign 3 | ||
| 192 | also applies to | ||
| 193 | .Fn PKCS7_verify . | ||
