2 ''' $RCSfile$$Revision$$Date$
20 .ie \\n(.$>=3 .ne \\$3
36 ''' Set up \*(-- to give an unbreakable dash;
37 ''' string Tr holds user defined translation string.
38 ''' Bell System Logo is used as a dummy character.
44 .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
45 .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
48 ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
49 ''' \*(L" and \*(R", except that they are used on ".xx" lines,
50 ''' such as .IP and .SH, which do another additional levels of
51 ''' double-quote interpretation
80 .\" If the F register is turned on, we'll generate
81 .\" index entries out stderr for the following things:
86 .\" X<> Xref (embedded
87 .\" Of course, you have to process the output yourself
88 .\" in some meaninful fashion.
91 .tm Index:\\$1\t\\n%\t"\\$2"
96 .TH VERIFY 1 "0.9.7d" "2/Sep/2004" "OpenSSL"
100 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
101 .de CQ \" put $1 in typewriter font
107 \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
110 .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
111 . \" AM - accent mark definitions
113 . \" fudge factors for nroff and troff
122 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
128 . \" simple accents for nroff and troff
141 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
142 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
143 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
144 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
145 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
146 . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
147 . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
148 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
149 . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
151 . \" troff and (daisy-wheel) nroff accents
152 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
153 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
154 .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
155 .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
156 .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
157 .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
158 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
159 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
160 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
161 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
162 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
163 .ds ae a\h'-(\w'a'u*4/10)'e
164 .ds Ae A\h'-(\w'A'u*4/10)'E
165 .ds oe o\h'-(\w'o'u*4/10)'e
166 .ds Oe O\h'-(\w'O'u*4/10)'E
167 . \" corrections for vroff
168 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
169 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
170 . \" for low resolution devices (crt and lpr)
171 .if \n(.H>23 .if \n(.V>19 \
175 . ds v \h'-1'\o'\(aa\(ga'
191 verify \- Utility to verify certificates.
193 \fBopenssl\fR \fBverify\fR
194 [\fB\-CApath directory\fR]
195 [\fB\-CAfile file\fR]
196 [\fB\-purpose purpose\fR]
197 [\fB\-untrusted file\fR]
199 [\fB\-issuer_checks\fR]
204 The \fBverify\fR command verifies certificate chains.
205 .SH "COMMAND OPTIONS"
206 .Ip "\fB\-CApath directory\fR" 4
207 A directory of trusted certificates. The certificates should have names
208 of the form: hash.0 or have symbolic links to them of this
209 form ("hash\*(R" is the hashed certificate subject name: see the \fB\-hash\fR option
210 of the \fBx509\fR utility). Under Unix the \fBc_rehash\fR script will automatically
211 create symbolic links to a directory of certificates.
212 .Ip "\fB\-CAfile file\fR" 4
213 A file of trusted certificates. The file should contain multiple certificates
214 in \s-1PEM\s0 format concatenated together.
215 .Ip "\fB\-untrusted file\fR" 4
216 A file of untrusted certificates. The file should contain multiple certificates
217 .Ip "\fB\-purpose purpose\fR" 4
218 the intended use for the certificate. Without this option no chain verification
219 will be done. Currently accepted uses are \fBsslclient\fR, \fBsslserver\fR,
220 \fBnssslserver\fR, \fBsmimesign\fR, \fBsmimeencrypt\fR. See the \fB\s-1VERIFY\s0 \s-1OPERATION\s0\fR
221 section for more information.
223 prints out a usage message.
224 .Ip "\fB\-verbose\fR" 4
225 print extra information about the operations being performed.
226 .Ip "\fB\-issuer_checks\fR" 4
227 print out diagnostics relating to searches for the issuer certificate
228 of the current certificate. This shows why each candidate issuer
229 certificate was rejected. However the presence of rejection messages
230 does not itself imply that anything is wrong: during the normal
231 verify process several rejections may take place.
233 marks the last option. All arguments following this are assumed to be
234 certificate files. This is useful if the first certificate filename begins
236 .Ip "\fBcertificates\fR" 4
237 one or more certificates to verify. If no certificate filenames are included
238 then an attempt is made to read a certificate from standard input. They should
239 all be in \s-1PEM\s0 format.
240 .SH "VERIFY OPERATION"
241 The \fBverify\fR program uses the same functions as the internal SSL and S/MIME
242 verification, therefore this description applies to these verify operations
245 There is one crucial difference between the verify operations performed
246 by the \fBverify\fR program: wherever possible an attempt is made to continue
247 after an error whereas normally the verify operation would halt on the
248 first error. This allows all the problems with a certificate chain to be
251 The verify operation consists of a number of separate steps.
253 Firstly a certificate chain is built up starting from the supplied certificate
254 and ending in the root CA. It is an error if the whole chain cannot be built
255 up. The chain is built up by looking up the issuers certificate of the current
256 certificate. If a certificate is found which is its own issuer it is assumed
259 The process of \*(L'looking up the issuers certificate\*(R' itself involves a number
260 of steps. In versions of OpenSSL before 0.9.5a the first certificate whose
261 subject name matched the issuer of the current certificate was assumed to be
262 the issuers certificate. In OpenSSL 0.9.6 and later all certificates
263 whose subject name matches the issuer name of the current certificate are
264 subject to further tests. The relevant authority key identifier components
265 of the current certificate (if present) must match the subject key identifier
266 (if present) and issuer and serial number of the candidate issuer, in addition
267 the keyUsage extension of the candidate issuer (if present) must permit
270 The lookup first looks in the list of untrusted certificates and if no match
271 is found the remaining lookups are from the trusted certificates. The root CA
272 is always looked up in the trusted certificate list: if the certificate to
273 verify is a root certificate then an exact match must be found in the trusted
276 The second operation is to check every untrusted certificate's extensions for
277 consistency with the supplied purpose. If the \fB\-purpose\fR option is not included
278 then no checks are done. The supplied or \*(L"leaf\*(R" certificate must have extensions
279 compatible with the supplied purpose and all other certificates must also be valid
280 CA certificates. The precise extensions required are described in more detail in
281 the \fBCERTIFICATE EXTENSIONS\fR section of the \fBx509\fR utility.
283 The third operation is to check the trust settings on the root CA. The root
284 CA should be trusted for the supplied purpose. For compatibility with previous
285 versions of SSLeay and OpenSSL a certificate with no trust settings is considered
286 to be valid for all purposes.
288 The final operation is to check the validity of the certificate chain. The validity
289 period is checked against the current system time and the notBefore and notAfter
290 dates in the certificate. The certificate signatures are also checked at this
293 If all operations complete successfully then certificate is considered valid. If
294 any operation fails then the certificate is not valid.
296 When a verify operation fails the output messages can be somewhat cryptic. The
297 general form of the error message is:
300 \& server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
301 \& error 24 at 1 depth lookup:invalid CA certificate
303 The first line contains the name of the certificate being verified followed by
304 the subject name of the certificate. The second line contains the error number
305 and the depth. The depth is number of the certificate being verified when a
306 problem was detected starting with zero for the certificate being verified itself
307 then 1 for the CA that signed the certificate and so on. Finally a text version
308 of the error number is presented.
310 An exhaustive list of the error codes and messages is shown below, this also
311 includes the name of the error code as defined in the header file x509_vfy.h
312 Some of the error codes are defined but never returned: these are described
314 .Ip "\fB0 X509_V_OK: ok\fR" 4
315 the operation was successful.
316 .Ip "\fB2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate\fR" 4
317 the issuer certificate could not be found: this occurs if the issuer certificate
318 of an untrusted certificate cannot be found.
319 .Ip "\fB3 X509_V_ERR_UNABLE_TO_GET_CRL unable to get certificate \s-1CRL\s0\fR" 4
320 the \s-1CRL\s0 of a certificate could not be found. Unused.
321 .Ip "\fB4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature\fR" 4
322 the certificate signature could not be decrypted. This means that the actual signature value
323 could not be determined rather than it not matching the expected value, this is only
324 meaningful for \s-1RSA\s0 keys.
325 .Ip "\fB5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt \s-1CRL\s0's signature\fR" 4
326 the \s-1CRL\s0 signature could not be decrypted: this means that the actual signature value
327 could not be determined rather than it not matching the expected value. Unused.
328 .Ip "\fB6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key\fR" 4
329 the public key in the certificate SubjectPublicKeyInfo could not be read.
330 .Ip "\fB7 X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure\fR" 4
331 the signature of the certificate is invalid.
332 .Ip "\fB8 X509_V_ERR_CRL_SIGNATURE_FAILURE: \s-1CRL\s0 signature failure\fR" 4
333 the signature of the certificate is invalid. Unused.
334 .Ip "\fB9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid\fR" 4
335 the certificate is not yet valid: the notBefore date is after the current time.
336 .Ip "\fB10 X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired\fR" 4
337 the certificate has expired: that is the notAfter date is before the current time.
338 .Ip "\fB11 X509_V_ERR_CRL_NOT_YET_VALID: \s-1CRL\s0 is not yet valid\fR" 4
339 the \s-1CRL\s0 is not yet valid. Unused.
340 .Ip "\fB12 X509_V_ERR_CRL_HAS_EXPIRED: \s-1CRL\s0 has expired\fR" 4
341 the \s-1CRL\s0 has expired. Unused.
342 .Ip "\fB13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field\fR" 4
343 the certificate notBefore field contains an invalid time.
344 .Ip "\fB14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field\fR" 4
345 the certificate notAfter field contains an invalid time.
346 .Ip "\fB15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in \s-1CRL\s0's lastUpdate field\fR" 4
347 the \s-1CRL\s0 lastUpdate field contains an invalid time. Unused.
348 .Ip "\fB16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in \s-1CRL\s0's nextUpdate field\fR" 4
349 the \s-1CRL\s0 nextUpdate field contains an invalid time. Unused.
350 .Ip "\fB17 X509_V_ERR_OUT_OF_MEM: out of memory\fR" 4
351 an error occurred trying to allocate memory. This should never happen.
352 .Ip "\fB18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate\fR" 4
353 the passed certificate is self signed and the same certificate cannot be found in the list of
354 trusted certificates.
355 .Ip "\fB19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain\fR" 4
356 the certificate chain could be built up using the untrusted certificates but the root could not
358 .Ip "\fB20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate\fR" 4
359 the issuer certificate of a locally looked up certificate could not be found. This normally means
360 the list of trusted certificates is not complete.
361 .Ip "\fB21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate\fR" 4
362 no signatures could be verified because the chain contains only one certificate and it is not
364 .Ip "\fB22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long\fR" 4
365 the certificate chain length is greater than the supplied maximum depth. Unused.
366 .Ip "\fB23 X509_V_ERR_CERT_REVOKED: certificate revoked\fR" 4
367 the certificate has been revoked. Unused.
368 .Ip "\fB24 X509_V_ERR_INVALID_CA: invalid \s-1CA\s0 certificate\fR" 4
369 a \s-1CA\s0 certificate is invalid. Either it is not a \s-1CA\s0 or its extensions are not consistent
370 with the supplied purpose.
371 .Ip "\fB25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded\fR" 4
372 the basicConstraints pathlength parameter has been exceeded.
373 .Ip "\fB26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose\fR" 4
374 the supplied certificate cannot be used for the specified purpose.
375 .Ip "\fB27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted\fR" 4
376 the root \s-1CA\s0 is not marked as trusted for the specified purpose.
377 .Ip "\fB28 X509_V_ERR_CERT_REJECTED: certificate rejected\fR" 4
378 the root \s-1CA\s0 is marked to reject the specified purpose.
379 .Ip "\fB29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch\fR" 4
380 the current candidate issuer certificate was rejected because its subject name
381 did not match the issuer name of the current certificate. Only displayed when
382 the \fB\-issuer_checks\fR option is set.
383 .Ip "\fB30 X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch\fR" 4
384 the current candidate issuer certificate was rejected because its subject key
385 identifier was present and did not match the authority key identifier current
386 certificate. Only displayed when the \fB\-issuer_checks\fR option is set.
387 .Ip "\fB31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch\fR" 4
388 the current candidate issuer certificate was rejected because its issuer name
389 and serial number was present and did not match the authority key identifier
390 of the current certificate. Only displayed when the \fB\-issuer_checks\fR option is set.
391 .Ip "\fB32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing\fR" 4
392 the current candidate issuer certificate was rejected because its keyUsage extension
393 does not permit certificate signing.
394 .Ip "\fB50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure\fR" 4
395 an application specific error. Unused.
397 Although the issuer checks are a considerably improvement over the old technique they still
398 suffer from limitations in the underlying X509_LOOKUP API. One consequence of this is that
399 trusted certificates with matching subject name must either appear in a file (as specified by the
400 \fB\-CAfile\fR option) or a directory (as specified by \fB\-CApath\fR. If they occur in both then only
401 the certificates in the file will be recognised.
403 Previous versions of OpenSSL assume certificates with matching subject name are identical and
410 .IX Name "verify - Utility to verify certificates."
414 .IX Header "SYNOPSIS"
416 .IX Header "DESCRIPTION"
418 .IX Header "COMMAND OPTIONS"
420 .IX Item "\fB\-CApath directory\fR"
422 .IX Item "\fB\-CAfile file\fR"
424 .IX Item "\fB\-untrusted file\fR"
426 .IX Item "\fB\-purpose purpose\fR"
428 .IX Item "\fB\-help\fR"
430 .IX Item "\fB\-verbose\fR"
432 .IX Item "\fB\-issuer_checks\fR"
436 .IX Item "\fBcertificates\fR"
438 .IX Header "VERIFY OPERATION"
440 .IX Header "DIAGNOSTICS"
442 .IX Item "\fB0 X509_V_OK: ok\fR"
444 .IX Item "\fB2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate\fR"
446 .IX Item "\fB3 X509_V_ERR_UNABLE_TO_GET_CRL unable to get certificate \s-1CRL\s0\fR"
448 .IX Item "\fB4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature\fR"
450 .IX Item "\fB5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt \s-1CRL\s0's signature\fR"
452 .IX Item "\fB6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key\fR"
454 .IX Item "\fB7 X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure\fR"
456 .IX Item "\fB8 X509_V_ERR_CRL_SIGNATURE_FAILURE: \s-1CRL\s0 signature failure\fR"
458 .IX Item "\fB9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid\fR"
460 .IX Item "\fB10 X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired\fR"
462 .IX Item "\fB11 X509_V_ERR_CRL_NOT_YET_VALID: \s-1CRL\s0 is not yet valid\fR"
464 .IX Item "\fB12 X509_V_ERR_CRL_HAS_EXPIRED: \s-1CRL\s0 has expired\fR"
466 .IX Item "\fB13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field\fR"
468 .IX Item "\fB14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field\fR"
470 .IX Item "\fB15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in \s-1CRL\s0's lastUpdate field\fR"
472 .IX Item "\fB16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in \s-1CRL\s0's nextUpdate field\fR"
474 .IX Item "\fB17 X509_V_ERR_OUT_OF_MEM: out of memory\fR"
476 .IX Item "\fB18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate\fR"
478 .IX Item "\fB19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain\fR"
480 .IX Item "\fB20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate\fR"
482 .IX Item "\fB21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate\fR"
484 .IX Item "\fB22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long\fR"
486 .IX Item "\fB23 X509_V_ERR_CERT_REVOKED: certificate revoked\fR"
488 .IX Item "\fB24 X509_V_ERR_INVALID_CA: invalid \s-1CA\s0 certificate\fR"
490 .IX Item "\fB25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded\fR"
492 .IX Item "\fB26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose\fR"
494 .IX Item "\fB27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted\fR"
496 .IX Item "\fB28 X509_V_ERR_CERT_REJECTED: certificate rejected\fR"
498 .IX Item "\fB29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch\fR"
500 .IX Item "\fB30 X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch\fR"
502 .IX Item "\fB31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch\fR"
504 .IX Item "\fB32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing\fR"
506 .IX Item "\fB50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure\fR"
510 .IX Header "SEE ALSO"