openssl-verification-options.1ossl 32 KB

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