openssl-x509.pod.in 25 KB

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