openssl-x509.pod.in 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. =pod
  2. {- OpenSSL::safe::output_do_not_edit_headers(); -}
  3. =head1 NAME
  4. openssl-x509 - Certificate display and signing command
  5. =head1 SYNOPSIS
  6. B<openssl> B<x509>
  7. [B<-help>]
  8. [B<-inform> B<DER>|B<PEM>]
  9. [B<-outform> B<DER>|B<PEM>]
  10. [B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
  11. [B<-CAform> B<DER>|B<PEM>|B<P12>]
  12. [B<-CAkeyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
  13. [B<-in> I<filename>]
  14. [B<-out> I<filename>]
  15. [B<-serial>]
  16. [B<-hash>]
  17. [B<-subject_hash>]
  18. [B<-subject_hash_old>]
  19. [B<-issuer_hash>]
  20. [B<-issuer_hash_old>]
  21. [B<-ocspid>]
  22. [B<-subject>]
  23. [B<-issuer>]
  24. [B<-email>]
  25. [B<-ocsp_uri>]
  26. [B<-startdate>]
  27. [B<-enddate>]
  28. [B<-purpose>]
  29. [B<-dates>]
  30. [B<-checkend> I<num>]
  31. [B<-modulus>]
  32. [B<-pubkey>]
  33. [B<-fingerprint>]
  34. [B<-alias>]
  35. [B<-noout>]
  36. [B<-trustout>]
  37. [B<-clrtrust>]
  38. [B<-clrreject>]
  39. [B<-addtrust> I<arg>]
  40. [B<-addreject> I<arg>]
  41. [B<-setalias> I<arg>]
  42. [B<-days> I<arg>]
  43. [B<-set_serial> I<n>]
  44. [B<-signkey> I<filename>|I<uri>]
  45. [B<-badsig>]
  46. [B<-passin> I<arg>]
  47. [B<-x509toreq>]
  48. [B<-req>]
  49. [B<-CA> I<filename>]
  50. [B<-CAkey> I<filename>|I<uri>]
  51. [B<-CAcreateserial>]
  52. [B<-CAserial> I<filename>]
  53. [B<-new>]
  54. [B<-next_serial>]
  55. [B<-nocert>]
  56. [B<-force_pubkey> I<filename>]
  57. [B<-subj> I<arg>]
  58. [B<-text>]
  59. [B<-ext> I<extensions>]
  60. [B<-certopt> I<option>]
  61. [B<-checkhost> I<host>]
  62. [B<-checkemail> I<host>]
  63. [B<-checkip> I<ipaddr>]
  64. [B<-I<digest>>]
  65. [B<-clrext>]
  66. [B<-extfile> I<filename>]
  67. [B<-extensions> I<section>]
  68. [B<-sigopt> I<nm>:I<v>]
  69. [B<-vfyopt> I<nm>:I<v>]
  70. [B<-preserve_dates>]
  71. {- $OpenSSL::safe::opt_name_synopsis -}
  72. {- $OpenSSL::safe::opt_r_synopsis -}
  73. {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
  74. =for openssl ifdef engine subject_hash_old issuer_hash_old
  75. =head1 DESCRIPTION
  76. This command is a multi-purposes certificate command. It can
  77. be used to display certificate information, convert certificates to
  78. various forms, sign certificate requests like a "mini CA" or edit
  79. certificate trust settings.
  80. Since there are a large number of options they will split up into
  81. various sections.
  82. =head1 OPTIONS
  83. =head2 Input, Output, and General Purpose Options
  84. =over 4
  85. =item B<-help>
  86. Print out a usage message.
  87. =item B<-inform> B<DER>|B<PEM>
  88. The CSR input format; the default is B<PEM>.
  89. See L<openssl-format-options(1)> for details.
  90. The input is normally an X.509 certificate file of any format,
  91. but this can change if other options such as B<-req> are used.
  92. B<-outform> B<DER>|B<PEM>
  93. The output format; the default is B<PEM>.
  94. See L<openssl-format-options(1)> for details.
  95. =item B<-in> I<filename>
  96. This specifies the input filename to read a certificate from or standard input
  97. if this option is not specified.
  98. =item B<-out> I<filename>
  99. This specifies the output filename to write to or standard output by
  100. default.
  101. =item B<-I<digest>>
  102. The digest to use.
  103. This affects any signing or display option that uses a message
  104. digest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options.
  105. Any digest supported by the L<openssl-dgst(1)> command can be used.
  106. If not specified then SHA1 is used with B<-fingerprint> or
  107. the default digest for the signing algorithm is used, typically SHA256.
  108. =item B<-preserve_dates>
  109. When signing a certificate, preserve the "notBefore" and "notAfter" dates
  110. instead of adjusting them to current time and duration.
  111. Cannot be used with the B<-days> option.
  112. {- $OpenSSL::safe::opt_r_synopsis -}
  113. {- $OpenSSL::safe::opt_engine_item -}
  114. {- $OpenSSL::safe::opt_provider_item -}
  115. =back
  116. =head2 Display Options
  117. Note: the B<-alias> and B<-purpose> options are also display options
  118. but are described in the L</Trust Settings> section.
  119. =over 4
  120. =item B<-text>
  121. Prints out the certificate in text form. Full details are output including the
  122. public key, signature algorithms, issuer and subject names, serial number
  123. any extensions present and any trust settings.
  124. =item B<-ext> I<extensions>
  125. Prints out the certificate extensions in text form. Extensions are specified
  126. with a comma separated string, e.g., "subjectAltName,subjectKeyIdentifier".
  127. See the L<x509v3_config(5)> manual page for the extension names.
  128. =item B<-certopt> I<option>
  129. Customise the output format used with B<-text>. The I<option> argument
  130. can be a single option or multiple options separated by commas. The
  131. B<-certopt> switch may be also be used more than once to set multiple
  132. options. See the L</Text Options> section for more information.
  133. =item B<-checkhost> I<host>
  134. Check that the certificate matches the specified host.
  135. =item B<-checkemail> I<email>
  136. Check that the certificate matches the specified email address.
  137. =item B<-checkip> I<ipaddr>
  138. Check that the certificate matches the specified IP address.
  139. =item B<-noout>
  140. This option prevents output of the encoded version of the certificate.
  141. =item B<-pubkey>
  142. Outputs the certificate's SubjectPublicKeyInfo block in PEM format.
  143. =item B<-modulus>
  144. This option prints out the value of the modulus of the public key
  145. contained in the certificate.
  146. =item B<-serial>
  147. Outputs the certificate serial number.
  148. =item B<-subject_hash>
  149. Outputs the "hash" of the certificate subject name. This is used in OpenSSL to
  150. form an index to allow certificates in a directory to be looked up by subject
  151. name.
  152. =item B<-issuer_hash>
  153. Outputs the "hash" of the certificate issuer name.
  154. =item B<-ocspid>
  155. Outputs the OCSP hash values for the subject name and public key.
  156. =item B<-hash>
  157. Synonym for "-subject_hash" for backward compatibility reasons.
  158. =item B<-subject_hash_old>
  159. Outputs the "hash" of the certificate subject name using the older algorithm
  160. as used by OpenSSL before version 1.0.0.
  161. =item B<-issuer_hash_old>
  162. Outputs the "hash" of the certificate issuer name using the older algorithm
  163. as used by OpenSSL before version 1.0.0.
  164. =item B<-subject>
  165. Outputs the subject name.
  166. =item B<-issuer>
  167. Outputs the issuer name.
  168. {- $OpenSSL::safe::opt_name_item -}
  169. =item B<-email>
  170. Outputs the email address(es) if any.
  171. =item B<-ocsp_uri>
  172. Outputs the OCSP responder address(es) if any.
  173. =item B<-startdate>
  174. Prints out the start date of the certificate, that is the notBefore date.
  175. =item B<-enddate>
  176. Prints out the expiry date of the certificate, that is the notAfter date.
  177. =item B<-dates>
  178. Prints out the start and expiry dates of a certificate.
  179. =item B<-checkend> I<arg>
  180. Checks if the certificate expires within the next I<arg> seconds and exits
  181. nonzero if yes it will expire or zero if not.
  182. =item B<-fingerprint>
  183. Calculates and outputs the digest of the DER encoded version of the entire
  184. certificate (see digest options).
  185. This is commonly called a "fingerprint". Because of the nature of message
  186. digests, the fingerprint of a certificate is unique to that certificate and
  187. two certificates with the same fingerprint can be considered to be the same.
  188. =back
  189. =head2 Trust Settings
  190. A B<trusted certificate> is an ordinary certificate which has several
  191. additional pieces of information attached to it such as the permitted
  192. and prohibited uses of the certificate and an "alias".
  193. Normally when a certificate is being verified at least one certificate
  194. must be "trusted". By default a trusted certificate must be stored
  195. locally and must be a root CA: any certificate chain ending in this CA
  196. is then usable for any purpose.
  197. Trust settings currently are only used with a root CA. They allow a finer
  198. control over the purposes the root CA can be used for. For example a CA
  199. may be trusted for SSL client but not SSL server use.
  200. See the description in L<openssl-verify(1)> for more information
  201. on the meaning of trust settings.
  202. Future versions of OpenSSL will recognize trust settings on any
  203. certificate: not just root CAs.
  204. =over 4
  205. =item B<-trustout>
  206. Output a B<trusted> certificate rather than an ordinary. An ordinary
  207. or trusted certificate can be input but by default an ordinary
  208. certificate is output and any trust settings are discarded. With the
  209. B<-trustout> option a trusted certificate is output. A trusted
  210. certificate is automatically output if any trust settings are modified.
  211. =item B<-setalias> I<arg>
  212. Sets the alias of the certificate. This will allow the certificate
  213. to be referred to using a nickname for example "Steve's Certificate".
  214. =item B<-alias>
  215. Outputs the certificate alias, if any.
  216. =item B<-clrtrust>
  217. Clears all the permitted or trusted uses of the certificate.
  218. =item B<-clrreject>
  219. Clears all the prohibited or rejected uses of the certificate.
  220. =item B<-addtrust> I<arg>
  221. Adds a trusted certificate use.
  222. Any object name can be used here but currently only B<clientAuth> (SSL client
  223. use), B<serverAuth> (SSL server use), B<emailProtection> (S/MIME email) and
  224. B<anyExtendedKeyUsage> are used.
  225. As of OpenSSL 1.1.0, the last of these blocks all purposes when rejected or
  226. enables all purposes when trusted.
  227. Other OpenSSL applications may define additional uses.
  228. =item B<-addreject> I<arg>
  229. Adds a prohibited use. It accepts the same values as the B<-addtrust>
  230. option.
  231. =item B<-purpose>
  232. This option performs tests on the certificate extensions and outputs
  233. the results. For a more complete description see the
  234. L</CERTIFICATE EXTENSIONS> section.
  235. =back
  236. =head2 Signing Options
  237. This command can be used to sign certificates and requests: it
  238. can thus behave like a "mini CA".
  239. =over 4
  240. =item B<-signkey> I<filename>|I<uri>
  241. This option causes the input file to be self signed using the supplied
  242. private key.
  243. It sets the issuer name to the subject name (i.e., makes it self-issued)
  244. and changes the public key to the supplied value (unless overridden by
  245. B<-force_pubkey>). It sets the validity start date to the current time
  246. and the end date to a value determined by the B<-days> option.
  247. It retains any certificate extensions unless the B<-clrext> option is supplied;
  248. this includes, for example, any existing key identifier extensions.
  249. =item B<-badsig>
  250. Corrupt the signature before writing it; this can be useful
  251. for testing.
  252. =item B<-sigopt> I<nm>:I<v>
  253. Pass options to the signature algorithm during sign operations.
  254. Names and values of these options are algorithm-specific.
  255. =item B<-vfyopt> I<nm>:I<v>
  256. Pass options to the signature algorithm during verify operations.
  257. Names and values of these options are algorithm-specific.
  258. =item B<-passin> I<arg>
  259. The key and certificate file password source.
  260. For more information about the format of I<arg>
  261. see L<openssl-passphrase-options(1)>.
  262. =item B<-clrext>
  263. Delete any extensions from a certificate. This option is used when a
  264. certificate is being created from another certificate (for example with
  265. the B<-signkey> or the B<-CA> options). Normally all extensions are
  266. retained.
  267. =item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
  268. The key format; the default is B<PEM>.
  269. The only value with effect is B<ENGINE>; all others have become obsolete.
  270. See L<openssl-format-options(1)> for details.
  271. =item B<-CAform> B<DER>|B<PEM>|B<P12>,
  272. The format for the CA certificate.
  273. This option has no effect and is retained for backward compatibility.
  274. =item B<-CAkeyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
  275. The format for the CA key; the default is B<PEM>.
  276. The only value with effect is B<ENGINE>; all others have become obsolete.
  277. See L<openssl-format-options(1)> for details.
  278. =item B<-days> I<arg>
  279. Specifies the number of days to make a certificate valid for. The default
  280. is 30 days. Cannot be used with the B<-preserve_dates> option.
  281. =item B<-x509toreq>
  282. Converts a certificate into a certificate request. The B<-signkey> option
  283. is used to pass the required private key.
  284. =item B<-req>
  285. By default a certificate is expected on input. With this option a
  286. certificate request is expected instead.
  287. =item B<-set_serial> I<n>
  288. Specifies the serial number to use. This option can be used with either
  289. the B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA>
  290. option the serial number file (as specified by the B<-CAserial> or
  291. B<-CAcreateserial> options) is not used.
  292. The serial number can be decimal or hex (if preceded by C<0x>).
  293. =item B<-CA> I<filename>
  294. Specifies the CA certificate to be used for signing. When this option is
  295. present, this command behaves like a "mini CA". The input file is signed by
  296. this CA using this option: that is its issuer name is set to the subject name
  297. of the CA and it is digitally signed using the CAs private key.
  298. This option is normally combined with the B<-req> option. Without the
  299. B<-req> option the input is a certificate which must be self signed.
  300. =item B<-CAkey> I<filename>|I<uri>
  301. Sets the CA private key to sign a certificate with. If this option is
  302. not specified then it is assumed that the CA private key is present in
  303. the CA certificate file.
  304. =item B<-CAserial> I<filename>
  305. Sets the CA serial number file to use.
  306. When the B<-CA> option is used to sign a certificate it uses a serial
  307. number specified in a file. This file consists of one line containing
  308. an even number of hex digits with the serial number to use. After each
  309. use the serial number is incremented and written out to the file again.
  310. The default filename consists of the CA certificate file base name with
  311. F<.srl> appended. For example if the CA certificate file is called
  312. F<mycacert.pem> it expects to find a serial number file called
  313. F<mycacert.srl>.
  314. =item B<-CAcreateserial>
  315. With this option the CA serial number file is created if it does not exist:
  316. it will contain the serial number "02" and the certificate being signed will
  317. have the 1 as its serial number. If the B<-CA> option is specified
  318. and the serial number file does not exist a random number is generated;
  319. this is the recommended practice.
  320. =item B<-extfile> I<filename>
  321. File containing certificate extensions to use. If not specified then
  322. no extensions are added to the certificate.
  323. =item B<-extensions> I<section>
  324. The section to add certificate extensions from. If this option is not
  325. specified then the extensions should either be contained in the unnamed
  326. (default) section or the default section should contain a variable called
  327. "extensions" which contains the section to use. See the
  328. L<x509v3_config(5)> manual page for details of the
  329. extension section format.
  330. =item B<-new>
  331. Generate a certificate from scratch, not using an input certificate
  332. or certificate request. So the B<-in> option must not be used in this case.
  333. Instead, the B<-subj> and <-force_pubkey> options need to be given.
  334. =item B<-next_serial>
  335. Set the serial to be one more than the number in the certificate.
  336. =item B<-nocert>
  337. Do not generate or output a certificate.
  338. =item B<-force_pubkey> I<filename>
  339. When a certificate is created set its public key to the key in I<filename>
  340. instead of the key contained in the input or given with the B<-signkey> option.
  341. This option is useful for creating self-issued certificates that are not
  342. self-signed, for instance when the key cannot be used for signing, such as DH.
  343. It can also be used in conjunction with b<-new> and B<-subj> to directly
  344. generate a certificate containing any desired public key.
  345. =item B<-subj> I<arg>
  346. When a certificate is created set its subject name to the given value.
  347. The arg must be formatted as C</type0=value0/type1=value1/type2=...>.
  348. Special characters may be escaped by C<\> (backslash), whitespace is retained.
  349. Empty values are permitted, but the corresponding type will not be included
  350. in the certificate.
  351. Giving a single C</> will lead to an empty sequence of RDNs (a NULL-DN).
  352. Multi-valued RDNs can be formed by placing a C<+> character instead of a C</>
  353. between the AttributeValueAssertions (AVAs) that specify the members of the set.
  354. Example:
  355. C</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe>
  356. Unless the B<-CA> option is given the issuer is set to the same value.
  357. This option can be used in conjunction with the B<-force_pubkey> option
  358. to create a certificate even without providing an input certificate
  359. or certificate request.
  360. =back
  361. =head2 Text Options
  362. As well as customising the name output format, it is also possible to
  363. customise the actual fields printed using the B<certopt> options when
  364. the B<text> option is present. The default behaviour is to print all fields.
  365. =over 4
  366. =item B<compatible>
  367. Use the old format. This is equivalent to specifying no output options at all.
  368. =item B<no_header>
  369. Don't print header information: that is the lines saying "Certificate"
  370. and "Data".
  371. =item B<no_version>
  372. Don't print out the version number.
  373. =item B<no_serial>
  374. Don't print out the serial number.
  375. =item B<no_signame>
  376. Don't print out the signature algorithm used.
  377. =item B<no_validity>
  378. Don't print the validity, that is the B<notBefore> and B<notAfter> fields.
  379. =item B<no_subject>
  380. Don't print out the subject name.
  381. =item B<no_issuer>
  382. Don't print out the issuer name.
  383. =item B<no_pubkey>
  384. Don't print out the public key.
  385. =item B<no_sigdump>
  386. Don't give a hexadecimal dump of the certificate signature.
  387. =item B<no_aux>
  388. Don't print out certificate trust information.
  389. =item B<no_extensions>
  390. Don't print out any X509V3 extensions.
  391. =item B<ext_default>
  392. Retain default extension behaviour: attempt to print out unsupported
  393. certificate extensions.
  394. =item B<ext_error>
  395. Print an error message for unsupported certificate extensions.
  396. =item B<ext_parse>
  397. ASN1 parse unsupported extensions.
  398. =item B<ext_dump>
  399. Hex dump unsupported extensions.
  400. =item B<ca_default>
  401. The value used by L<openssl-ca(1)>, equivalent to B<no_issuer>, B<no_pubkey>,
  402. B<no_header>, and B<no_version>.
  403. =back
  404. =head1 EXAMPLES
  405. Note: in these examples the '\' means the example should be all on one
  406. line.
  407. Display the contents of a certificate:
  408. openssl x509 -in cert.pem -noout -text
  409. Display the "Subject Alternative Name" extension of a certificate:
  410. openssl x509 -in cert.pem -noout -ext subjectAltName
  411. Display more extensions of a certificate:
  412. openssl x509 -in cert.pem -noout -ext subjectAltName,nsCertType
  413. Display the certificate serial number:
  414. openssl x509 -in cert.pem -noout -serial
  415. Display the certificate subject name:
  416. openssl x509 -in cert.pem -noout -subject
  417. Display the certificate subject name in RFC2253 form:
  418. openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
  419. Display the certificate subject name in oneline form on a terminal
  420. supporting UTF8:
  421. openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb
  422. Display the certificate SHA1 fingerprint:
  423. openssl x509 -sha1 -in cert.pem -noout -fingerprint
  424. Convert a certificate from PEM to DER format:
  425. openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
  426. Convert a certificate to a certificate request:
  427. openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
  428. Convert a certificate request into a self signed certificate using
  429. extensions for a CA:
  430. openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \
  431. -signkey key.pem -out cacert.pem
  432. Sign a certificate request using the CA certificate above and add user
  433. certificate extensions:
  434. openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \
  435. -CA cacert.pem -CAkey key.pem -CAcreateserial
  436. Set a certificate to be trusted for SSL client use and change set its alias to
  437. "Steve's Class 1 CA"
  438. openssl x509 -in cert.pem -addtrust clientAuth \
  439. -setalias "Steve's Class 1 CA" -out trust.pem
  440. =head1 NOTES
  441. The conversion to UTF8 format used with the name options assumes that
  442. T61Strings use the ISO8859-1 character set. This is wrong but Netscape
  443. and MSIE do this as do many certificates. So although this is incorrect
  444. it is more likely to display the majority of certificates correctly.
  445. The B<-email> option searches the subject name and the subject alternative
  446. name extension. Only unique email addresses will be printed out: it will
  447. not print the same address more than once.
  448. =head1 CERTIFICATE EXTENSIONS
  449. The B<-purpose> option checks the certificate extensions and determines
  450. what the certificate can be used for. The actual checks done are rather
  451. complex and include various hacks and workarounds to handle broken
  452. certificates and software.
  453. The same code is used when verifying untrusted certificates in chains
  454. so this section is useful if a chain is rejected by the verify code.
  455. The basicConstraints extension CA flag is used to determine whether the
  456. certificate can be used as a CA. If the CA flag is true then it is a CA,
  457. if the CA flag is false then it is not a CA. B<All> CAs should have the
  458. CA flag set to true.
  459. If the basicConstraints extension is absent then the certificate is
  460. considered to be a "possible CA" other extensions are checked according
  461. to the intended use of the certificate. A warning is given in this case
  462. because the certificate should really not be regarded as a CA: however
  463. it is allowed to be a CA to work around some broken software.
  464. If the certificate is a V1 certificate (and thus has no extensions) and
  465. it is self signed it is also assumed to be a CA but a warning is again
  466. given: this is to work around the problem of Verisign roots which are V1
  467. self signed certificates.
  468. If the keyUsage extension is present then additional restraints are
  469. made on the uses of the certificate. A CA certificate B<must> have the
  470. keyCertSign bit set if the keyUsage extension is present.
  471. The extended key usage extension places additional restrictions on the
  472. certificate uses. If this extension is present (whether critical or not)
  473. the key can only be used for the purposes specified.
  474. A complete description of each test is given below. The comments about
  475. basicConstraints and keyUsage and V1 certificates above apply to B<all>
  476. CA certificates.
  477. =over 4
  478. =item B<SSL Client>
  479. The extended key usage extension must be absent or include the "web client
  480. authentication" OID. keyUsage must be absent or it must have the
  481. digitalSignature bit set. Netscape certificate type must be absent or it must
  482. have the SSL client bit set.
  483. =item B<SSL Client CA>
  484. The extended key usage extension must be absent or include the "web client
  485. authentication" OID. Netscape certificate type must be absent or it must have
  486. the SSL CA bit set: this is used as a work around if the basicConstraints
  487. extension is absent.
  488. =item B<SSL Server>
  489. The extended key usage extension must be absent or include the "web server
  490. authentication" and/or one of the SGC OIDs. keyUsage must be absent or it
  491. must have the digitalSignature, the keyEncipherment set or both bits set.
  492. Netscape certificate type must be absent or have the SSL server bit set.
  493. =item B<SSL Server CA>
  494. The extended key usage extension must be absent or include the "web server
  495. authentication" and/or one of the SGC OIDs. Netscape certificate type must
  496. be absent or the SSL CA bit must be set: this is used as a work around if the
  497. basicConstraints extension is absent.
  498. =item B<Netscape SSL Server>
  499. For Netscape SSL clients to connect to an SSL server it must have the
  500. keyEncipherment bit set if the keyUsage extension is present. This isn't
  501. always valid because some cipher suites use the key for digital signing.
  502. Otherwise it is the same as a normal SSL server.
  503. =item B<Common S/MIME Client Tests>
  504. The extended key usage extension must be absent or include the "email
  505. protection" OID. Netscape certificate type must be absent or should have the
  506. S/MIME bit set. If the S/MIME bit is not set in Netscape certificate type
  507. then the SSL client bit is tolerated as an alternative but a warning is shown:
  508. this is because some Verisign certificates don't set the S/MIME bit.
  509. =item B<S/MIME Signing>
  510. In addition to the common S/MIME client tests the digitalSignature bit or
  511. the nonRepudiation bit must be set if the keyUsage extension is present.
  512. =item B<S/MIME Encryption>
  513. In addition to the common S/MIME tests the keyEncipherment bit must be set
  514. if the keyUsage extension is present.
  515. =item B<S/MIME CA>
  516. The extended key usage extension must be absent or include the "email
  517. protection" OID. Netscape certificate type must be absent or must have the
  518. S/MIME CA bit set: this is used as a work around if the basicConstraints
  519. extension is absent.
  520. =item B<CRL Signing>
  521. The keyUsage extension must be absent or it must have the CRL signing bit
  522. set.
  523. =item B<CRL Signing CA>
  524. The normal CA tests apply. Except in this case the basicConstraints extension
  525. must be present.
  526. =back
  527. =head1 BUGS
  528. Extensions in certificates are not transferred to certificate requests and
  529. vice versa.
  530. It is possible to produce invalid certificates or requests by specifying the
  531. wrong private key or using inconsistent options in some cases: these should
  532. be checked.
  533. There should be options to explicitly set such things as start and end
  534. dates rather than an offset from the current time.
  535. =head1 SEE ALSO
  536. L<openssl(1)>,
  537. L<openssl-req(1)>,
  538. L<openssl-ca(1)>,
  539. L<openssl-genrsa(1)>,
  540. L<openssl-gendsa(1)>,
  541. L<openssl-verify(1)>,
  542. L<x509v3_config(5)>
  543. =head1 HISTORY
  544. The hash algorithm used in the B<-subject_hash> and B<-issuer_hash> options
  545. before OpenSSL 1.0.0 was based on the deprecated MD5 algorithm and the encoding
  546. of the distinguished name. In OpenSSL 1.0.0 and later it is based on a canonical
  547. version of the DN using SHA1. This means that any directories using the old
  548. form must have their links rebuilt using L<openssl-rehash(1)> or similar.
  549. All B<-keyform> and B<-CAkeyform> values except B<ENGINE>
  550. have become obsolete in OpenSSL 3.0.0 and have no effect.
  551. The B<-CAform> option has become obsolete in OpenSSL 3.0.0 and has no effect.
  552. The B<-engine> option was deprecated in OpenSSL 3.0.
  553. The B<-C> option was removed in OpenSSL 3.0.
  554. =head1 COPYRIGHT
  555. Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
  556. Licensed under the Apache License 2.0 (the "License"). You may not use
  557. this file except in compliance with the License. You can obtain a copy
  558. in the file LICENSE in the source distribution or at
  559. L<https://www.openssl.org/source/license.html>.
  560. =cut