openssl-verification-options.1ossl 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "OPENSSL-VERIFICATION-OPTIONS 1ossl"
  58. .TH OPENSSL-VERIFICATION-OPTIONS 1ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. openssl\-verification\-options \- generic X.509 certificate verification options
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. \&\fBopenssl\fR
  68. \&\fIcommand\fR
  69. [ \fIoptions\fR ... ]
  70. [ \fIparameters\fR ... ]
  71. .SH DESCRIPTION
  72. .IX Header "DESCRIPTION"
  73. There are many situations where X.509 certificates are verified
  74. within the OpenSSL libraries and in various OpenSSL commands.
  75. .PP
  76. Certificate verification is implemented by \fBX509_verify_cert\fR\|(3).
  77. It is a complicated process consisting of a number of steps
  78. and depending on numerous options.
  79. The most important of them are detailed in the following sections.
  80. .PP
  81. In a nutshell, a valid chain of certificates needs to be built up and verified
  82. starting from the \fItarget certificate\fR that is to be verified
  83. and ending in a certificate that due to some policy is trusted.
  84. Verification is done relative to the given \fIpurpose\fR, which is the intended use
  85. of the target certificate, such as SSL server, or by default for any purpose.
  86. .PP
  87. The details of how each OpenSSL command handles errors
  88. are documented on the specific command page.
  89. .PP
  90. DANE support is documented in \fBopenssl\-s_client\fR\|(1),
  91. \&\fBSSL_CTX_dane_enable\fR\|(3), \fBSSL_set1_host\fR\|(3),
  92. \&\fBX509_VERIFY_PARAM_set_flags\fR\|(3), and \fBX509_check_host\fR\|(3).
  93. .SS "Trust Anchors"
  94. .IX Subsection "Trust Anchors"
  95. In general, according to RFC 4158 and RFC 5280, a \fItrust anchor\fR is
  96. any public key and related subject distinguished name (DN) that
  97. for some reason is considered trusted
  98. and thus is acceptable as the root of a chain of certificates.
  99. .PP
  100. In practice, trust anchors are given in the form of certificates,
  101. where their essential fields are the public key and the subject DN.
  102. In addition to the requirements in RFC 5280,
  103. OpenSSL checks the validity period of such certificates
  104. and makes use of some further fields.
  105. In particular, the subject key identifier extension, if present,
  106. is used for matching trust anchors during chain building.
  107. .PP
  108. In the most simple and common case, trust anchors are by default
  109. all self-signed "root" CA certificates that are placed in the \fItrust store\fR,
  110. which is a collection of certificates that are trusted for certain uses.
  111. This is akin to what is used in the trust stores of Mozilla Firefox,
  112. or Apple's and Microsoft's certificate stores, ...
  113. .PP
  114. From the OpenSSL perspective, a trust anchor is a certificate
  115. that should be augmented with an explicit designation for which
  116. uses of a target certificate the certificate may serve as a trust anchor.
  117. In PEM encoding, this is indicated by the \f(CW\*(C`TRUSTED CERTIFICATE\*(C'\fR string.
  118. Such a designation provides a set of positive trust attributes
  119. explicitly stating trust for the listed purposes
  120. and/or a set of negative trust attributes
  121. explicitly rejecting the use for the listed purposes.
  122. The purposes are encoded using the values defined for the extended key usages
  123. (EKUs) that may be given in X.509 extensions of end-entity certificates.
  124. See also the "Extended Key Usage" section below.
  125. .PP
  126. The currently recognized uses are
  127. \&\fBclientAuth\fR (SSL client use), \fBserverAuth\fR (SSL server use),
  128. \&\fBemailProtection\fR (S/MIME email use), \fBcodeSigning\fR (object signer use),
  129. \&\fBOCSPSigning\fR (OCSP responder use), \fBOCSP\fR (OCSP request use),
  130. \&\fBtimeStamping\fR (TSA server use), and \fBanyExtendedKeyUsage\fR.
  131. As of OpenSSL 1.1.0, the last of these blocks all uses when rejected or
  132. enables all uses when trusted.
  133. .PP
  134. A certificate, which may be CA certificate or an end-entity certificate,
  135. is considered a trust anchor for the given use
  136. if and only if all the following conditions hold:
  137. .IP \(bu 4
  138. It is an an element of the trust store.
  139. .IP \(bu 4
  140. It does not have a negative trust attribute rejecting the given use.
  141. .IP \(bu 4
  142. It has a positive trust attribute accepting the given use
  143. or (by default) one of the following compatibility conditions apply:
  144. It is self-signed or the \fB\-partial_chain\fR option is given
  145. (which corresponds to the \fBX509_V_FLAG_PARTIAL_CHAIN\fR flag being set).
  146. .SS "Certification Path Building"
  147. .IX Subsection "Certification Path Building"
  148. First, a certificate chain is built up starting from the target certificate
  149. and ending in a trust anchor.
  150. .PP
  151. The chain is built up iteratively, looking up in turn
  152. a certificate with suitable key usage that
  153. matches as an issuer of the current "subject" certificate as described below.
  154. If there is such a certificate, the first one found that is currently valid
  155. is taken, otherwise the one that expired most recently of all such certificates.
  156. For efficiency, no backtracking is performed, thus
  157. any further candidate issuer certificates that would match equally are ignored.
  158. .PP
  159. When a self-signed certificate has been added, chain construction stops.
  160. In this case it must fully match a trust anchor, otherwise chain building fails.
  161. .PP
  162. A candidate issuer certificate matches a subject certificate
  163. if all of the following conditions hold:
  164. .IP \(bu 4
  165. Its subject name matches the issuer name of the subject certificate.
  166. .IP \(bu 4
  167. If the subject certificate has an authority key identifier extension,
  168. each of its sub-fields equals the corresponding subject key identifier, serial
  169. number, and issuer field of the candidate issuer certificate,
  170. as far as the respective fields are present in both certificates.
  171. .IP \(bu 4
  172. The certificate signature algorithm used to sign the subject certificate
  173. is supported and
  174. equals the public key algorithm of the candidate issuer certificate.
  175. .PP
  176. The lookup first searches for issuer certificates in the trust store.
  177. If it does not find a match there it consults
  178. the list of untrusted ("intermediate" CA) certificates, if provided.
  179. .SS "Certification Path Validation"
  180. .IX Subsection "Certification Path Validation"
  181. When the certificate chain building process was successful
  182. the chain components and their links are checked thoroughly.
  183. .PP
  184. The first step is to check that each certificate is well-formed.
  185. Part of these checks are enabled only if the \fB\-x509_strict\fR option is given.
  186. .PP
  187. The second step is to check the extensions of every untrusted certificate
  188. for consistency with the supplied purpose.
  189. If the \fB\-purpose\fR option is not given then no such checks are done
  190. except for SSL/TLS connection setup,
  191. where by default \f(CW\*(C`sslserver\*(C'\fR or \f(CW\*(C`sslclient\*(C'\fR, are checked.
  192. The target or "leaf" certificate, as well as any other untrusted certificates,
  193. must have extensions compatible with the specified purpose.
  194. All certificates except the target or "leaf" must also be valid CA certificates.
  195. The precise extensions required are described in more detail in
  196. "CERTIFICATE EXTENSIONS" in \fBopenssl\-x509\fR\|(1).
  197. .PP
  198. The third step is to check the trust settings on the last certificate
  199. (which typically is a self-signed root CA certificate).
  200. It must be trusted for the given use.
  201. For compatibility with previous versions of OpenSSL, a self-signed certificate
  202. with no trust attributes is considered to be valid for all uses.
  203. .PP
  204. The fourth, and final, step is to check the validity of the certificate chain.
  205. For each element in the chain, including the root CA certificate,
  206. the validity period as specified by the \f(CW\*(C`notBefore\*(C'\fR and \f(CW\*(C`notAfter\*(C'\fR fields
  207. is checked against the current system time.
  208. The \fB\-attime\fR flag may be used to use a reference time other than "now."
  209. The certificate signature is checked as well
  210. (except for the signature of the typically self-signed root CA certificate,
  211. which is verified only if the \fB\-check_ss_sig\fR option is given).
  212. When verifying a certificate signature
  213. the keyUsage extension (if present) of the candidate issuer certificate
  214. is checked to permit digitalSignature for signing proxy certificates
  215. or to permit keyCertSign for signing other certificates, respectively.
  216. If all operations complete successfully then certificate is considered
  217. valid. If any operation fails then the certificate is not valid.
  218. .SH OPTIONS
  219. .IX Header "OPTIONS"
  220. .SS "Trusted Certificate Options"
  221. .IX Subsection "Trusted Certificate Options"
  222. The following options specify how to supply the certificates
  223. that can be used as trust anchors for certain uses.
  224. As mentioned, a collection of such certificates is called a \fItrust store\fR.
  225. .PP
  226. Note that OpenSSL does not provide a default set of trust anchors. Many
  227. Linux distributions include a system default and configure OpenSSL to point
  228. to that. Mozilla maintains an influential trust store that can be found at
  229. <https://www.mozilla.org/en\-US/about/governance/policies/security\-group/certs/>.
  230. .PP
  231. The certificates to add to the trust store
  232. can be specified using following options.
  233. .IP "\fB\-CAfile\fR \fIfile\fR" 4
  234. .IX Item "-CAfile file"
  235. Load the specified file which contains a trusted certificate in DER format
  236. or potentially several of them in case the input is in PEM format.
  237. PEM-encoded certificates may also have trust attributes set.
  238. .IP \fB\-no\-CAfile\fR 4
  239. .IX Item "-no-CAfile"
  240. Do not load the default file of trusted certificates.
  241. .IP "\fB\-CApath\fR \fIdir\fR" 4
  242. .IX Item "-CApath dir"
  243. Use the specified directory as a collection of trusted certificates,
  244. i.e., a trust store.
  245. Files should be named with the hash value of the X.509 SubjectName of each
  246. certificate. This is so that the library can extract the IssuerName,
  247. hash it, and directly lookup the file to get the issuer certificate.
  248. See \fBopenssl\-rehash\fR\|(1) for information on creating this type of directory.
  249. .IP \fB\-no\-CApath\fR 4
  250. .IX Item "-no-CApath"
  251. Do not use the default directory of trusted certificates.
  252. .IP "\fB\-CAstore\fR \fIuri\fR" 4
  253. .IX Item "-CAstore uri"
  254. Use \fIuri\fR as a store of CA certificates.
  255. The URI may indicate a single certificate, as well as a collection of them.
  256. With URIs in the \f(CW\*(C`file:\*(C'\fR scheme, this acts as \fB\-CAfile\fR or
  257. \&\fB\-CApath\fR, depending on if the URI indicates a single file or
  258. directory.
  259. See \fBossl_store\-file\fR\|(7) for more information on the \f(CW\*(C`file:\*(C'\fR scheme.
  260. .Sp
  261. These certificates are also used when building the server certificate
  262. chain (for example with \fBopenssl\-s_server\fR\|(1)) or client certificate
  263. chain (for example with \fBopenssl\-s_time\fR\|(1)).
  264. .IP \fB\-no\-CAstore\fR 4
  265. .IX Item "-no-CAstore"
  266. Do not use the default store of trusted CA certificates.
  267. .SS "Verification Options"
  268. .IX Subsection "Verification Options"
  269. The certificate verification can be fine-tuned with the following flags.
  270. .IP \fB\-verbose\fR 4
  271. .IX Item "-verbose"
  272. Print extra information about the operations being performed.
  273. .IP "\fB\-attime\fR \fItimestamp\fR" 4
  274. .IX Item "-attime timestamp"
  275. Perform validation checks using time specified by \fItimestamp\fR and not
  276. current system time. \fItimestamp\fR is the number of seconds since
  277. January 1, 1970 (i.e., the Unix Epoch).
  278. .IP \fB\-no_check_time\fR 4
  279. .IX Item "-no_check_time"
  280. This option suppresses checking the validity period of certificates and CRLs
  281. against the current time. If option \fB\-attime\fR is used to specify
  282. a verification time, the check is not suppressed.
  283. .IP \fB\-x509_strict\fR 4
  284. .IX Item "-x509_strict"
  285. This disables non-compliant workarounds for broken certificates.
  286. Thus errors are thrown on certificates not compliant with RFC 5280.
  287. .Sp
  288. When this option is set,
  289. among others, the following certificate well-formedness conditions are checked:
  290. .RS 4
  291. .IP \(bu 4
  292. The basicConstraints of CA certificates must be marked critical.
  293. .IP \(bu 4
  294. CA certificates must explicitly include the keyUsage extension.
  295. .IP \(bu 4
  296. If a pathlenConstraint is given the key usage keyCertSign must be allowed.
  297. .IP \(bu 4
  298. The pathlenConstraint must not be given for non-CA certificates.
  299. .IP \(bu 4
  300. The issuer name of any certificate must not be empty.
  301. .IP \(bu 4
  302. The subject name of CA certs, certs with keyUsage crlSign, and certs
  303. without subjectAlternativeName must not be empty.
  304. .IP \(bu 4
  305. If a subjectAlternativeName extension is given it must not be empty.
  306. .IP \(bu 4
  307. The signatureAlgorithm field and the cert signature must be consistent.
  308. .IP \(bu 4
  309. Any given authorityKeyIdentifier and any given subjectKeyIdentifier
  310. must not be marked critical.
  311. .IP \(bu 4
  312. The authorityKeyIdentifier must be given for X.509v3 certs unless they
  313. are self-signed.
  314. .IP \(bu 4
  315. The subjectKeyIdentifier must be given for all X.509v3 CA certs.
  316. .RE
  317. .RS 4
  318. .RE
  319. .IP \fB\-ignore_critical\fR 4
  320. .IX Item "-ignore_critical"
  321. Normally if an unhandled critical extension is present that is not
  322. supported by OpenSSL the certificate is rejected (as required by RFC5280).
  323. If this option is set critical extensions are ignored.
  324. .IP \fB\-issuer_checks\fR 4
  325. .IX Item "-issuer_checks"
  326. Ignored.
  327. .IP \fB\-crl_check\fR 4
  328. .IX Item "-crl_check"
  329. Checks end entity certificate validity by attempting to look up a valid CRL.
  330. If a valid CRL cannot be found an error occurs.
  331. .IP \fB\-crl_check_all\fR 4
  332. .IX Item "-crl_check_all"
  333. Checks the validity of \fBall\fR certificates in the chain by attempting
  334. to look up valid CRLs.
  335. .IP \fB\-use_deltas\fR 4
  336. .IX Item "-use_deltas"
  337. Enable support for delta CRLs.
  338. .IP \fB\-extended_crl\fR 4
  339. .IX Item "-extended_crl"
  340. Enable extended CRL features such as indirect CRLs and alternate CRL
  341. signing keys.
  342. .IP "\fB\-suiteB_128_only\fR, \fB\-suiteB_128\fR, \fB\-suiteB_192\fR" 4
  343. .IX Item "-suiteB_128_only, -suiteB_128, -suiteB_192"
  344. Enable the Suite B mode operation at 128 bit Level of Security, 128 bit or
  345. 192 bit, or only 192 bit Level of Security respectively.
  346. See RFC6460 for details. In particular the supported signature algorithms are
  347. reduced to support only ECDSA and SHA256 or SHA384 and only the elliptic curves
  348. P\-256 and P\-384.
  349. .IP "\fB\-auth_level\fR \fIlevel\fR" 4
  350. .IX Item "-auth_level level"
  351. Set the certificate chain authentication security level to \fIlevel\fR.
  352. The authentication security level determines the acceptable signature and
  353. public key strength when verifying certificate chains. For a certificate
  354. chain to validate, the public keys of all the certificates must meet the
  355. specified security \fIlevel\fR. The signature algorithm security level is
  356. enforced for all the certificates in the chain except for the chain's
  357. \&\fItrust anchor\fR, which is either directly trusted or validated by means
  358. other than its signature. See \fBSSL_CTX_set_security_level\fR\|(3) for the
  359. definitions of the available levels. The default security level is \-1,
  360. or "not set". At security level 0 or lower all algorithms are acceptable.
  361. Security level 1 requires at least 80\-bit\-equivalent security and is broadly
  362. interoperable, though it will, for example, reject MD5 signatures or RSA
  363. keys shorter than 1024 bits.
  364. .IP \fB\-partial_chain\fR 4
  365. .IX Item "-partial_chain"
  366. Allow verification to succeed if an incomplete chain can be built.
  367. That is, a chain ending in a certificate that normally would not be trusted
  368. (because it has no matching positive trust attributes and is not self-signed)
  369. but is an element of the trust store.
  370. This certificate may be self-issued or belong to an intermediate CA.
  371. .IP \fB\-check_ss_sig\fR 4
  372. .IX Item "-check_ss_sig"
  373. Verify the signature of
  374. the last certificate in a chain if the certificate is supposedly self-signed.
  375. This is prohibited and will result in an error if it is a non-conforming CA
  376. certificate with key usage restrictions not including the keyCertSign bit.
  377. This verification is disabled by default because it doesn't add any security.
  378. .IP \fB\-allow_proxy_certs\fR 4
  379. .IX Item "-allow_proxy_certs"
  380. Allow the verification of proxy certificates.
  381. .IP \fB\-trusted_first\fR 4
  382. .IX Item "-trusted_first"
  383. As of OpenSSL 1.1.0 this option is on by default and cannot be disabled.
  384. .Sp
  385. When constructing the certificate chain, the trusted certificates specified
  386. via \fB\-CAfile\fR, \fB\-CApath\fR, \fB\-CAstore\fR or \fB\-trusted\fR are always used
  387. before any certificates specified via \fB\-untrusted\fR.
  388. .IP \fB\-no_alt_chains\fR 4
  389. .IX Item "-no_alt_chains"
  390. As of OpenSSL 1.1.0, since \fB\-trusted_first\fR always on, this option has no
  391. effect.
  392. .IP "\fB\-trusted\fR \fIfile\fR" 4
  393. .IX Item "-trusted file"
  394. Parse \fIfile\fR as a set of one or more certificates.
  395. Each of them qualifies as trusted if has a suitable positive trust attribute
  396. or it is self-signed or the \fB\-partial_chain\fR option is specified.
  397. This option implies the \fB\-no\-CAfile\fR, \fB\-no\-CApath\fR, and \fB\-no\-CAstore\fR options
  398. and it cannot be used with the \fB\-CAfile\fR, \fB\-CApath\fR or \fB\-CAstore\fR options, so
  399. only certificates specified using the \fB\-trusted\fR option are trust anchors.
  400. This option may be used multiple times.
  401. .IP "\fB\-untrusted\fR \fIfile\fR" 4
  402. .IX Item "-untrusted file"
  403. Parse \fIfile\fR as a set of one or more certificates.
  404. All certificates (typically of intermediate CAs) are considered untrusted
  405. and may be used to
  406. construct a certificate chain from the target certificate to a trust anchor.
  407. This option may be used multiple times.
  408. .IP "\fB\-policy\fR \fIarg\fR" 4
  409. .IX Item "-policy arg"
  410. Enable policy processing and add \fIarg\fR to the user-initial-policy-set (see
  411. RFC5280). The policy \fIarg\fR can be an object name or an OID in numeric form.
  412. This argument can appear more than once.
  413. .IP \fB\-explicit_policy\fR 4
  414. .IX Item "-explicit_policy"
  415. Set policy variable require-explicit-policy (see RFC5280).
  416. .IP \fB\-policy_check\fR 4
  417. .IX Item "-policy_check"
  418. Enables certificate policy processing.
  419. .IP \fB\-policy_print\fR 4
  420. .IX Item "-policy_print"
  421. Print out diagnostics related to policy processing.
  422. .IP \fB\-inhibit_any\fR 4
  423. .IX Item "-inhibit_any"
  424. Set policy variable inhibit-any-policy (see RFC5280).
  425. .IP \fB\-inhibit_map\fR 4
  426. .IX Item "-inhibit_map"
  427. Set policy variable inhibit-policy-mapping (see RFC5280).
  428. .IP "\fB\-purpose\fR \fIpurpose\fR" 4
  429. .IX Item "-purpose purpose"
  430. The intended use for the certificate.
  431. Currently defined purposes are \f(CW\*(C`sslclient\*(C'\fR, \f(CW\*(C`sslserver\*(C'\fR, \f(CW\*(C`nssslserver\*(C'\fR,
  432. \&\f(CW\*(C`smimesign\*(C'\fR, \f(CW\*(C`smimeencrypt\*(C'\fR, \f(CW\*(C`crlsign\*(C'\fR, \f(CW\*(C`ocsphelper\*(C'\fR, \f(CW\*(C`timestampsign\*(C'\fR,
  433. \&\f(CW\*(C`codesign\*(C'\fR and \f(CW\*(C`any\*(C'\fR.
  434. If peer certificate verification is enabled, by default the TLS implementation
  435. as well as the commands \fBs_client\fR and \fBs_server\fR check for consistency
  436. with TLS server or TLS client use, respectively.
  437. .Sp
  438. While IETF RFC 5280 says that \fBid-kp-serverAuth\fR and \fBid-kp-clientAuth\fR
  439. are only for WWW use, in practice they are used for all kinds of TLS clients
  440. and servers, and this is what OpenSSL assumes as well.
  441. .IP "\fB\-verify_depth\fR \fInum\fR" 4
  442. .IX Item "-verify_depth num"
  443. Limit the certificate chain to \fInum\fR intermediate CA certificates.
  444. A maximal depth chain can have up to \fInum\fR+2 certificates, since neither the
  445. end-entity certificate nor the trust-anchor certificate count against the
  446. \&\fB\-verify_depth\fR limit.
  447. .IP "\fB\-verify_email\fR \fIemail\fR" 4
  448. .IX Item "-verify_email email"
  449. Verify if \fIemail\fR matches the email address in Subject Alternative Name or
  450. the email in the subject Distinguished Name.
  451. .IP "\fB\-verify_hostname\fR \fIhostname\fR" 4
  452. .IX Item "-verify_hostname hostname"
  453. Verify if \fIhostname\fR matches DNS name in Subject Alternative Name or
  454. Common Name in the subject certificate.
  455. .IP "\fB\-verify_ip\fR \fIip\fR" 4
  456. .IX Item "-verify_ip ip"
  457. Verify if \fIip\fR matches the IP address in Subject Alternative Name of
  458. the subject certificate.
  459. .IP "\fB\-verify_name\fR \fIname\fR" 4
  460. .IX Item "-verify_name name"
  461. Use default verification policies like trust model and required certificate
  462. policies identified by \fIname\fR.
  463. The trust model determines which auxiliary trust or reject OIDs are applicable
  464. to verifying the given certificate chain.
  465. They can be given using the \fB\-addtrust\fR and \fB\-addreject\fR options
  466. for \fBopenssl\-x509\fR\|(1).
  467. Supported policy names include: \fBdefault\fR, \fBpkcs7\fR, \fBsmime_sign\fR,
  468. \&\fBssl_client\fR, \fBssl_server\fR.
  469. These mimics the combinations of purpose and trust settings used in SSL, CMS
  470. and S/MIME.
  471. As of OpenSSL 1.1.0, the trust model is inferred from the purpose when not
  472. specified, so the \fB\-verify_name\fR options are functionally equivalent to the
  473. corresponding \fB\-purpose\fR settings.
  474. .SS "Extended Verification Options"
  475. .IX Subsection "Extended Verification Options"
  476. Sometimes there may be more than one certificate chain leading to an
  477. end-entity certificate.
  478. This usually happens when a root or intermediate CA signs a certificate
  479. for another a CA in other organization.
  480. Another reason is when a CA might have intermediates that use two different
  481. signature formats, such as a SHA\-1 and a SHA\-256 digest.
  482. .PP
  483. The following options can be used to provide data that will allow the
  484. OpenSSL command to generate an alternative chain.
  485. .IP "\fB\-xkey\fR \fIinfile\fR, \fB\-xcert\fR \fIinfile\fR, \fB\-xchain\fR" 4
  486. .IX Item "-xkey infile, -xcert infile, -xchain"
  487. Specify an extra certificate, private key and certificate chain. These behave
  488. in the same manner as the \fB\-cert\fR, \fB\-key\fR and \fB\-cert_chain\fR options. When
  489. specified, the callback returning the first valid chain will be in use by the
  490. client.
  491. .IP \fB\-xchain_build\fR 4
  492. .IX Item "-xchain_build"
  493. Specify whether the application should build the certificate chain to be
  494. provided to the server for the extra certificates via the \fB\-xkey\fR,
  495. \&\fB\-xcert\fR, and \fB\-xchain\fR options.
  496. .IP "\fB\-xcertform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR" 4
  497. .IX Item "-xcertform DER|PEM|P12"
  498. The input format for the extra certificate.
  499. This option has no effect and is retained for backward compatibility only.
  500. .IP "\fB\-xkeyform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR" 4
  501. .IX Item "-xkeyform DER|PEM|P12"
  502. The input format for the extra key.
  503. This option has no effect and is retained for backward compatibility only.
  504. .SS "Certificate Extensions"
  505. .IX Subsection "Certificate Extensions"
  506. Options like \fB\-purpose\fR lead to checking the certificate extensions,
  507. which determine what the target certificate and intermediate CA certificates
  508. can be used for.
  509. .PP
  510. \fIBasic Constraints\fR
  511. .IX Subsection "Basic Constraints"
  512. .PP
  513. The basicConstraints extension CA flag is used to determine whether the
  514. certificate can be used as a CA. If the CA flag is true then it is a CA,
  515. if the CA flag is false then it is not a CA. \fBAll\fR CAs should have the
  516. CA flag set to true.
  517. .PP
  518. If the basicConstraints extension is absent,
  519. which includes the case that it is an X.509v1 certificate,
  520. then the certificate is considered to be a "possible CA" and
  521. other extensions are checked according to the intended use of the certificate.
  522. The treatment of certificates without basicConstraints as a CA
  523. is presently supported, but this could change in the future.
  524. .PP
  525. \fIKey Usage\fR
  526. .IX Subsection "Key Usage"
  527. .PP
  528. If the keyUsage extension is present then additional restraints are
  529. made on the uses of the certificate. A CA certificate \fBmust\fR have the
  530. keyCertSign bit set if the keyUsage extension is present.
  531. .PP
  532. \fIExtended Key Usage\fR
  533. .IX Subsection "Extended Key Usage"
  534. .PP
  535. The extKeyUsage (EKU) extension places additional restrictions on the
  536. certificate uses. If this extension is present (whether critical or not)
  537. the key can only be used for the purposes specified.
  538. .PP
  539. A complete description of each check is given below. The comments about
  540. basicConstraints and keyUsage and X.509v1 certificates above apply to \fBall\fR
  541. CA certificates.
  542. .IP "\fBSSL Client\fR" 4
  543. .IX Item "SSL Client"
  544. The extended key usage extension must be absent or include the "web client
  545. authentication" OID. The keyUsage extension must be absent or it must have the
  546. digitalSignature bit set. The Netscape certificate type must be absent
  547. or it must have the SSL client bit set.
  548. .IP "\fBSSL Client CA\fR" 4
  549. .IX Item "SSL Client CA"
  550. The extended key usage extension must be absent or include the "web client
  551. authentication" OID.
  552. The Netscape certificate type must be absent or it must have the SSL CA bit set.
  553. This is used as a work around if the basicConstraints extension is absent.
  554. .IP "\fBSSL Server\fR" 4
  555. .IX Item "SSL Server"
  556. The extended key usage extension must be absent or include the "web server
  557. authentication" and/or one of the SGC OIDs. The keyUsage extension must be
  558. absent or it
  559. must have the digitalSignature, the keyEncipherment set or both bits set.
  560. The Netscape certificate type must be absent or have the SSL server bit set.
  561. .IP "\fBSSL Server CA\fR" 4
  562. .IX Item "SSL Server CA"
  563. The extended key usage extension must be absent or include the "web server
  564. authentication" and/or one of the SGC OIDs. The Netscape certificate type must
  565. be absent or the SSL CA bit must be set.
  566. This is used as a work around if the basicConstraints extension is absent.
  567. .IP "\fBNetscape SSL Server\fR" 4
  568. .IX Item "Netscape SSL Server"
  569. For Netscape SSL clients to connect to an SSL server it must have the
  570. keyEncipherment bit set if the keyUsage extension is present. This isn't
  571. always valid because some cipher suites use the key for digital signing.
  572. Otherwise it is the same as a normal SSL server.
  573. .IP "\fBCommon S/MIME Client Tests\fR" 4
  574. .IX Item "Common S/MIME Client Tests"
  575. The extended key usage extension must be absent or include the "email
  576. protection" OID. The Netscape certificate type must be absent or should have the
  577. S/MIME bit set. If the S/MIME bit is not set in the Netscape certificate type
  578. then the SSL client bit is tolerated as an alternative but a warning is shown.
  579. This is because some Verisign certificates don't set the S/MIME bit.
  580. .IP "\fBS/MIME Signing\fR" 4
  581. .IX Item "S/MIME Signing"
  582. In addition to the common S/MIME client tests the digitalSignature bit or
  583. the nonRepudiation bit must be set if the keyUsage extension is present.
  584. .IP "\fBS/MIME Encryption\fR" 4
  585. .IX Item "S/MIME Encryption"
  586. In addition to the common S/MIME tests the keyEncipherment bit must be set
  587. if the keyUsage extension is present.
  588. .IP "\fBS/MIME CA\fR" 4
  589. .IX Item "S/MIME CA"
  590. The extended key usage extension must be absent or include the "email
  591. protection" OID. The Netscape certificate type must be absent or must have the
  592. S/MIME CA bit set.
  593. This is used as a work around if the basicConstraints extension is absent.
  594. .IP "\fBCRL Signing\fR" 4
  595. .IX Item "CRL Signing"
  596. The keyUsage extension must be absent or it must have the CRL signing bit
  597. set.
  598. .IP "\fBCRL Signing CA\fR" 4
  599. .IX Item "CRL Signing CA"
  600. The normal CA tests apply. Except in this case the basicConstraints extension
  601. must be present.
  602. .SH BUGS
  603. .IX Header "BUGS"
  604. The issuer checks still suffer from limitations in the underlying X509_LOOKUP
  605. API. One consequence of this is that trusted certificates with matching
  606. subject name must appear in a file (as specified by the \fB\-CAfile\fR option),
  607. a directory (as specified by \fB\-CApath\fR),
  608. or a store (as specified by \fB\-CAstore\fR).
  609. If there are multiple such matches, possibly in multiple locations,
  610. only the first one (in the mentioned order of locations) is recognised.
  611. .SH "SEE ALSO"
  612. .IX Header "SEE ALSO"
  613. \&\fBX509_verify_cert\fR\|(3),
  614. \&\fBopenssl\-verify\fR\|(1),
  615. \&\fBopenssl\-ocsp\fR\|(1),
  616. \&\fBopenssl\-ts\fR\|(1),
  617. \&\fBopenssl\-s_client\fR\|(1),
  618. \&\fBopenssl\-s_server\fR\|(1),
  619. \&\fBopenssl\-smime\fR\|(1),
  620. \&\fBopenssl\-cmp\fR\|(1),
  621. \&\fBopenssl\-cms\fR\|(1)
  622. .SH HISTORY
  623. .IX Header "HISTORY"
  624. The checks enabled by \fB\-x509_strict\fR have been extended in OpenSSL 3.0.
  625. .SH COPYRIGHT
  626. .IX Header "COPYRIGHT"
  627. Copyright 2000\-2024 The OpenSSL Project Authors. All Rights Reserved.
  628. .PP
  629. Licensed under the Apache License 2.0 (the "License"). You may not use
  630. this file except in compliance with the License. You can obtain a copy
  631. in the file LICENSE in the source distribution or at
  632. <https://www.openssl.org/source/license.html>.