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