1VERIFY(1) OpenSSL VERIFY(1)
2
3
4
6 openssl-verify, verify - Utility to verify certificates
7
9 openssl verify [-help] [-CAfile file] [-CApath directory] [-no-CAfile]
10 [-no-CApath] [-allow_proxy_certs] [-attime timestamp] [-check_ss_sig]
11 [-CRLfile file] [-crl_download] [-crl_check] [-crl_check_all] [-engine
12 id] [-explicit_policy] [-extended_crl] [-ignore_critical]
13 [-inhibit_any] [-inhibit_map] [-nameopt option] [-no_check_time]
14 [-partial_chain] [-policy arg] [-policy_check] [-policy_print]
15 [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192]
16 [-trusted_first] [-no_alt_chains] [-untrusted file] [-trusted file]
17 [-use_deltas] [-verbose] [-auth_level level] [-verify_depth num]
18 [-verify_email email] [-verify_hostname hostname] [-verify_ip ip]
19 [-verify_name name] [-x509_strict] [-show_chain] [-] [certificates]
20
22 The verify command verifies certificate chains.
23
25 -help
26 Print out a usage message.
27
28 -CAfile file
29 A file of trusted certificates. The file should contain one or
30 more certificates in PEM format.
31
32 -CApath directory
33 A directory of trusted certificates. The certificates should have
34 names of the form: hash.0 or have symbolic links to them of this
35 form ("hash" is the hashed certificate subject name: see the -hash
36 option of the x509 utility). Under Unix the c_rehash script will
37 automatically create symbolic links to a directory of certificates.
38
39 -no-CAfile
40 Do not load the trusted CA certificates from the default file
41 location.
42
43 -no-CApath
44 Do not load the trusted CA certificates from the default directory
45 location.
46
47 -allow_proxy_certs
48 Allow the verification of proxy certificates.
49
50 -attime timestamp
51 Perform validation checks using time specified by timestamp and not
52 current system time. timestamp is the number of seconds since
53 01.01.1970 (UNIX time).
54
55 -check_ss_sig
56 Verify the signature on the self-signed root CA. This is disabled
57 by default because it doesn't add any security.
58
59 -CRLfile file
60 The file should contain one or more CRLs in PEM format. This
61 option can be specified more than once to include CRLs from
62 multiple files.
63
64 -crl_download
65 Attempt to download CRL information for this certificate.
66
67 -crl_check
68 Checks end entity certificate validity by attempting to look up a
69 valid CRL. If a valid CRL cannot be found an error occurs.
70
71 -crl_check_all
72 Checks the validity of all certificates in the chain by attempting
73 to look up valid CRLs.
74
75 -engine id
76 Specifying an engine id will cause verify(1) to attempt to load the
77 specified engine. The engine will then be set as the default for
78 all its supported algorithms. If you want to load certificates or
79 CRLs that require engine support via any of the -trusted,
80 -untrusted or -CRLfile options, the -engine option must be
81 specified before those options.
82
83 -explicit_policy
84 Set policy variable require-explicit-policy (see RFC5280).
85
86 -extended_crl
87 Enable extended CRL features such as indirect CRLs and alternate
88 CRL signing keys.
89
90 -ignore_critical
91 Normally if an unhandled critical extension is present which is not
92 supported by OpenSSL the certificate is rejected (as required by
93 RFC5280). If this option is set critical extensions are ignored.
94
95 -inhibit_any
96 Set policy variable inhibit-any-policy (see RFC5280).
97
98 -inhibit_map
99 Set policy variable inhibit-policy-mapping (see RFC5280).
100
101 -nameopt option
102 Option which determines how the subject or issuer names are
103 displayed. The option argument can be a single option or multiple
104 options separated by commas. Alternatively the -nameopt switch may
105 be used more than once to set multiple options. See the x509(1)
106 manual page for details.
107
108 -no_check_time
109 This option suppresses checking the validity period of certificates
110 and CRLs against the current time. If option -attime timestamp is
111 used to specify a verification time, the check is not suppressed.
112
113 -partial_chain
114 Allow verification to succeed even if a complete chain cannot be
115 built to a self-signed trust-anchor, provided it is possible to
116 construct a chain to a trusted certificate that might not be self-
117 signed.
118
119 -policy arg
120 Enable policy processing and add arg to the user-initial-policy-set
121 (see RFC5280). The policy arg can be an object name an OID in
122 numeric form. This argument can appear more than once.
123
124 -policy_check
125 Enables certificate policy processing.
126
127 -policy_print
128 Print out diagnostics related to policy processing.
129
130 -purpose purpose
131 The intended use for the certificate. If this option is not
132 specified, verify will not consider certificate purpose during
133 chain verification. Currently accepted uses are sslclient,
134 sslserver, nssslserver, smimesign, smimeencrypt. See the VERIFY
135 OPERATION section for more information.
136
137 -suiteB_128_only, -suiteB_128, -suiteB_192
138 Enable the Suite B mode operation at 128 bit Level of Security, 128
139 bit or 192 bit, or only 192 bit Level of Security respectively.
140 See RFC6460 for details. In particular the supported signature
141 algorithms are reduced to support only ECDSA and SHA256 or SHA384
142 and only the elliptic curves P-256 and P-384.
143
144 -trusted_first
145 When constructing the certificate chain, use the trusted
146 certificates specified via -CAfile, -CApath or -trusted before any
147 certificates specified via -untrusted. This can be useful in
148 environments with Bridge or Cross-Certified CAs. As of OpenSSL
149 1.1.0 this option is on by default and cannot be disabled.
150
151 -no_alt_chains
152 By default, unless -trusted_first is specified, when building a
153 certificate chain, if the first certificate chain found is not
154 trusted, then OpenSSL will attempt to replace untrusted issuer
155 certificates with certificates from the trust store to see if an
156 alternative chain can be found that is trusted. As of OpenSSL
157 1.1.0, with -trusted_first always on, this option has no effect.
158
159 -untrusted file
160 A file of additional untrusted certificates (intermediate issuer
161 CAs) used to construct a certificate chain from the subject
162 certificate to a trust-anchor. The file should contain one or more
163 certificates in PEM format. This option can be specified more than
164 once to include untrusted certificates from multiple files.
165
166 -trusted file
167 A file of trusted certificates, which must be self-signed, unless
168 the -partial_chain option is specified. The file contains one or
169 more certificates in PEM format. With this option, no additional
170 (e.g., default) certificate lists are consulted. That is, the only
171 trust-anchors are those listed in file. This option can be
172 specified more than once to include trusted certificates from
173 multiple files. This option implies the -no-CAfile and -no-CApath
174 options. This option cannot be used in combination with either of
175 the -CAfile or -CApath options.
176
177 -use_deltas
178 Enable support for delta CRLs.
179
180 -verbose
181 Print extra information about the operations being performed.
182
183 -auth_level level
184 Set the certificate chain authentication security level to level.
185 The authentication security level determines the acceptable
186 signature and public key strength when verifying certificate
187 chains. For a certificate chain to validate, the public keys of
188 all the certificates must meet the specified security level. The
189 signature algorithm security level is enforced for all the
190 certificates in the chain except for the chain's trust anchor,
191 which is either directly trusted or validated by means other than
192 its signature. See SSL_CTX_set_security_level(3) for the
193 definitions of the available levels. The default security level is
194 -1, or "not set". At security level 0 or lower all algorithms are
195 acceptable. Security level 1 requires at least 80-bit-equivalent
196 security and is broadly interoperable, though it will, for example,
197 reject MD5 signatures or RSA keys shorter than 1024 bits.
198
199 -verify_depth num
200 Limit the certificate chain to num intermediate CA certificates. A
201 maximal depth chain can have up to num+2 certificates, since
202 neither the end-entity certificate nor the trust-anchor certificate
203 count against the -verify_depth limit.
204
205 -verify_email email
206 Verify if the email matches the email address in Subject
207 Alternative Name or the email in the subject Distinguished Name.
208
209 -verify_hostname hostname
210 Verify if the hostname matches DNS name in Subject Alternative Name
211 or Common Name in the subject certificate.
212
213 -verify_ip ip
214 Verify if the ip matches the IP address in Subject Alternative Name
215 of the subject certificate.
216
217 -verify_name name
218 Use default verification policies like trust model and required
219 certificate policies identified by name. The trust model
220 determines which auxiliary trust or reject OIDs are applicable to
221 verifying the given certificate chain. See the -addtrust and
222 -addreject options of the x509(1) command-line utility. Supported
223 policy names include: default, pkcs7, smime_sign, ssl_client,
224 ssl_server. These mimics the combinations of purpose and trust
225 settings used in SSL, CMS and S/MIME. As of OpenSSL 1.1.0, the
226 trust model is inferred from the purpose when not specified, so the
227 -verify_name options are functionally equivalent to the
228 corresponding -purpose settings.
229
230 -x509_strict
231 For strict X.509 compliance, disable non-compliant workarounds for
232 broken certificates.
233
234 -show_chain
235 Display information about the certificate chain that has been built
236 (if successful). Certificates in the chain that came from the
237 untrusted list will be flagged as "untrusted".
238
239 - Indicates the last option. All arguments following this are assumed
240 to be certificate files. This is useful if the first certificate
241 filename begins with a -.
242
243 certificates
244 One or more certificates to verify. If no certificates are given,
245 verify will attempt to read a certificate from standard input.
246 Certificates must be in PEM format.
247
249 The verify program uses the same functions as the internal SSL and
250 S/MIME verification, therefore this description applies to these verify
251 operations too.
252
253 There is one crucial difference between the verify operations performed
254 by the verify program: wherever possible an attempt is made to continue
255 after an error whereas normally the verify operation would halt on the
256 first error. This allows all the problems with a certificate chain to
257 be determined.
258
259 The verify operation consists of a number of separate steps.
260
261 Firstly a certificate chain is built up starting from the supplied
262 certificate and ending in the root CA. It is an error if the whole
263 chain cannot be built up. The chain is built up by looking up the
264 issuers certificate of the current certificate. If a certificate is
265 found which is its own issuer it is assumed to be the root CA.
266
267 The process of 'looking up the issuers certificate' itself involves a
268 number of steps. After all certificates whose subject name matches the
269 issuer name of the current certificate are subject to further tests.
270 The relevant authority key identifier components of the current
271 certificate (if present) must match the subject key identifier (if
272 present) and issuer and serial number of the candidate issuer, in
273 addition the keyUsage extension of the candidate issuer (if present)
274 must permit certificate signing.
275
276 The lookup first looks in the list of untrusted certificates and if no
277 match is found the remaining lookups are from the trusted certificates.
278 The root CA is always looked up in the trusted certificate list: if the
279 certificate to verify is a root certificate then an exact match must be
280 found in the trusted list.
281
282 The second operation is to check every untrusted certificate's
283 extensions for consistency with the supplied purpose. If the -purpose
284 option is not included then no checks are done. The supplied or "leaf"
285 certificate must have extensions compatible with the supplied purpose
286 and all other certificates must also be valid CA certificates. The
287 precise extensions required are described in more detail in the
288 CERTIFICATE EXTENSIONS section of the x509 utility.
289
290 The third operation is to check the trust settings on the root CA. The
291 root CA should be trusted for the supplied purpose. For compatibility
292 with previous versions of OpenSSL, a certificate with no trust settings
293 is considered to be valid for all purposes.
294
295 The final operation is to check the validity of the certificate chain.
296 The validity period is checked against the current system time and the
297 notBefore and notAfter dates in the certificate. The certificate
298 signatures are also checked at this point.
299
300 If all operations complete successfully then certificate is considered
301 valid. If any operation fails then the certificate is not valid.
302
304 When a verify operation fails the output messages can be somewhat
305 cryptic. The general form of the error message is:
306
307 server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
308 error 24 at 1 depth lookup:invalid CA certificate
309
310 The first line contains the name of the certificate being verified
311 followed by the subject name of the certificate. The second line
312 contains the error number and the depth. The depth is number of the
313 certificate being verified when a problem was detected starting with
314 zero for the certificate being verified itself then 1 for the CA that
315 signed the certificate and so on. Finally a text version of the error
316 number is presented.
317
318 A partial list of the error codes and messages is shown below, this
319 also includes the name of the error code as defined in the header file
320 x509_vfy.h Some of the error codes are defined but never returned:
321 these are described as "unused".
322
323 X509_V_OK
324 The operation was successful.
325
326 X509_V_ERR_UNSPECIFIED
327 Unspecified error; should not happen.
328
329 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
330 The issuer certificate of a looked up certificate could not be
331 found. This normally means the list of trusted certificates is not
332 complete.
333
334 X509_V_ERR_UNABLE_TO_GET_CRL
335 The CRL of a certificate could not be found.
336
337 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
338 The certificate signature could not be decrypted. This means that
339 the actual signature value could not be determined rather than it
340 not matching the expected value, this is only meaningful for RSA
341 keys.
342
343 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
344 The CRL signature could not be decrypted: this means that the
345 actual signature value could not be determined rather than it not
346 matching the expected value. Unused.
347
348 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
349 The public key in the certificate SubjectPublicKeyInfo could not be
350 read.
351
352 X509_V_ERR_CERT_SIGNATURE_FAILURE
353 The signature of the certificate is invalid.
354
355 X509_V_ERR_CRL_SIGNATURE_FAILURE
356 The signature of the certificate is invalid.
357
358 X509_V_ERR_CERT_NOT_YET_VALID
359 The certificate is not yet valid: the notBefore date is after the
360 current time.
361
362 X509_V_ERR_CERT_HAS_EXPIRED
363 The certificate has expired: that is the notAfter date is before
364 the current time.
365
366 X509_V_ERR_CRL_NOT_YET_VALID
367 The CRL is not yet valid.
368
369 X509_V_ERR_CRL_HAS_EXPIRED
370 The CRL has expired.
371
372 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
373 The certificate notBefore field contains an invalid time.
374
375 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
376 The certificate notAfter field contains an invalid time.
377
378 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
379 The CRL lastUpdate field contains an invalid time.
380
381 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
382 The CRL nextUpdate field contains an invalid time.
383
384 X509_V_ERR_OUT_OF_MEM
385 An error occurred trying to allocate memory. This should never
386 happen.
387
388 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
389 The passed certificate is self-signed and the same certificate
390 cannot be found in the list of trusted certificates.
391
392 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
393 The certificate chain could be built up using the untrusted
394 certificates but the root could not be found locally.
395
396 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
397 The issuer certificate could not be found: this occurs if the
398 issuer certificate of an untrusted certificate cannot be found.
399
400 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
401 No signatures could be verified because the chain contains only one
402 certificate and it is not self signed.
403
404 X509_V_ERR_CERT_CHAIN_TOO_LONG
405 The certificate chain length is greater than the supplied maximum
406 depth. Unused.
407
408 X509_V_ERR_CERT_REVOKED
409 The certificate has been revoked.
410
411 X509_V_ERR_INVALID_CA
412 A CA certificate is invalid. Either it is not a CA or its
413 extensions are not consistent with the supplied purpose.
414
415 X509_V_ERR_PATH_LENGTH_EXCEEDED
416 The basicConstraints pathlength parameter has been exceeded.
417
418 X509_V_ERR_INVALID_PURPOSE
419 The supplied certificate cannot be used for the specified purpose.
420
421 X509_V_ERR_CERT_UNTRUSTED
422 The root CA is not marked as trusted for the specified purpose.
423
424 X509_V_ERR_CERT_REJECTED
425 The root CA is marked to reject the specified purpose.
426
427 X509_V_ERR_SUBJECT_ISSUER_MISMATCH
428 Not used as of OpenSSL 1.1.0 as a result of the deprecation of the
429 -issuer_checks option.
430
431 X509_V_ERR_AKID_SKID_MISMATCH
432 Not used as of OpenSSL 1.1.0 as a result of the deprecation of the
433 -issuer_checks option.
434
435 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
436 Not used as of OpenSSL 1.1.0 as a result of the deprecation of the
437 -issuer_checks option.
438
439 X509_V_ERR_KEYUSAGE_NO_CERTSIGN
440 Not used as of OpenSSL 1.1.0 as a result of the deprecation of the
441 -issuer_checks option.
442
443 X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER
444 Unable to get CRL issuer certificate.
445
446 X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION
447 Unhandled critical extension.
448
449 X509_V_ERR_KEYUSAGE_NO_CRL_SIGN
450 Key usage does not include CRL signing.
451
452 X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION
453 Unhandled critical CRL extension.
454
455 X509_V_ERR_INVALID_NON_CA
456 Invalid non-CA certificate has CA markings.
457
458 X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED
459 Proxy path length constraint exceeded.
460
461 X509_V_ERR_PROXY_SUBJECT_INVALID
462 Proxy certificate subject is invalid. It MUST be the same as the
463 issuer with a single CN component added.
464
465 X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE
466 Key usage does not include digital signature.
467
468 X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED
469 Proxy certificates not allowed, please use -allow_proxy_certs.
470
471 X509_V_ERR_INVALID_EXTENSION
472 Invalid or inconsistent certificate extension.
473
474 X509_V_ERR_INVALID_POLICY_EXTENSION
475 Invalid or inconsistent certificate policy extension.
476
477 X509_V_ERR_NO_EXPLICIT_POLICY
478 No explicit policy.
479
480 X509_V_ERR_DIFFERENT_CRL_SCOPE
481 Different CRL scope.
482
483 X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE
484 Unsupported extension feature.
485
486 X509_V_ERR_UNNESTED_RESOURCE
487 RFC 3779 resource not subset of parent's resources.
488
489 X509_V_ERR_PERMITTED_VIOLATION
490 Permitted subtree violation.
491
492 X509_V_ERR_EXCLUDED_VIOLATION
493 Excluded subtree violation.
494
495 X509_V_ERR_SUBTREE_MINMAX
496 Name constraints minimum and maximum not supported.
497
498 X509_V_ERR_APPLICATION_VERIFICATION
499 Application verification failure. Unused.
500
501 X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
502 Unsupported name constraint type.
503
504 X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX
505 Unsupported or invalid name constraint syntax.
506
507 X509_V_ERR_UNSUPPORTED_NAME_SYNTAX
508 Unsupported or invalid name syntax.
509
510 X509_V_ERR_CRL_PATH_VALIDATION_ERROR
511 CRL path validation error.
512
513 X509_V_ERR_PATH_LOOP
514 Path loop.
515
516 X509_V_ERR_SUITE_B_INVALID_VERSION
517 Suite B: certificate version invalid.
518
519 X509_V_ERR_SUITE_B_INVALID_ALGORITHM
520 Suite B: invalid public key algorithm.
521
522 X509_V_ERR_SUITE_B_INVALID_CURVE
523 Suite B: invalid ECC curve.
524
525 X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM
526 Suite B: invalid signature algorithm.
527
528 X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED
529 Suite B: curve not allowed for this LOS.
530
531 X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256
532 Suite B: cannot sign P-384 with P-256.
533
534 X509_V_ERR_HOSTNAME_MISMATCH
535 Hostname mismatch.
536
537 X509_V_ERR_EMAIL_MISMATCH
538 Email address mismatch.
539
540 X509_V_ERR_IP_ADDRESS_MISMATCH
541 IP address mismatch.
542
543 X509_V_ERR_DANE_NO_MATCH
544 DANE TLSA authentication is enabled, but no TLSA records matched
545 the certificate chain. This error is only possible in s_client(1).
546
547 X509_V_ERR_EE_KEY_TOO_SMALL
548 EE certificate key too weak.
549
550 X509_ERR_CA_KEY_TOO_SMALL
551 CA certificate key too weak.
552
553 X509_ERR_CA_MD_TOO_WEAK
554 CA signature digest algorithm too weak.
555
556 X509_V_ERR_INVALID_CALL
557 nvalid certificate verification context.
558
559 X509_V_ERR_STORE_LOOKUP
560 Issuer certificate lookup error.
561
562 X509_V_ERR_NO_VALID_SCTS
563 Certificate Transparency required, but no valid SCTs found.
564
565 X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION
566 Proxy subject name violation.
567
568 X509_V_ERR_OCSP_VERIFY_NEEDED
569 Returned by the verify callback to indicate an OCSP verification is
570 needed.
571
572 X509_V_ERR_OCSP_VERIFY_FAILED
573 Returned by the verify callback to indicate OCSP verification
574 failed.
575
576 X509_V_ERR_OCSP_CERT_UNKNOWN
577 Returned by the verify callback to indicate that the certificate is
578 not recognized by the OCSP responder.
579
581 Although the issuer checks are a considerable improvement over the old
582 technique they still suffer from limitations in the underlying
583 X509_LOOKUP API. One consequence of this is that trusted certificates
584 with matching subject name must either appear in a file (as specified
585 by the -CAfile option) or a directory (as specified by -CApath). If
586 they occur in both then only the certificates in the file will be
587 recognised.
588
589 Previous versions of OpenSSL assume certificates with matching subject
590 name are identical and mishandled them.
591
592 Previous versions of this documentation swapped the meaning of the
593 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT and
594 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY error codes.
595
597 x509(1)
598
600 The -show_chain option was first added to OpenSSL 1.1.0.
601
602 The -issuer_checks option is deprecated as of OpenSSL 1.1.0 and is
603 silently ignored.
604
606 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
607
608 Licensed under the OpenSSL license (the "License"). You may not use
609 this file except in compliance with the License. You can obtain a copy
610 in the file LICENSE in the source distribution or at
611 <https://www.openssl.org/source/license.html>.
612
613
614
6151.1.1 2018-09-11 VERIFY(1)