openssl-x509.pod.in 23 KB

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