openssl-ca.1ossl 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "OPENSSL-CA 1ossl"
  58. .TH OPENSSL-CA 1ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. openssl\-ca \- sample minimal CA application
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. \&\fBopenssl\fR \fBca\fR
  68. [\fB\-help\fR]
  69. [\fB\-verbose\fR]
  70. [\fB\-quiet\fR]
  71. [\fB\-config\fR \fIfilename\fR]
  72. [\fB\-name\fR \fIsection\fR]
  73. [\fB\-section\fR \fIsection\fR]
  74. [\fB\-gencrl\fR]
  75. [\fB\-revoke\fR \fIfile\fR]
  76. [\fB\-valid\fR \fIfile\fR]
  77. [\fB\-status\fR \fIserial\fR]
  78. [\fB\-updatedb\fR]
  79. [\fB\-crl_reason\fR \fIreason\fR]
  80. [\fB\-crl_hold\fR \fIinstruction\fR]
  81. [\fB\-crl_compromise\fR \fItime\fR]
  82. [\fB\-crl_CA_compromise\fR \fItime\fR]
  83. [\fB\-crl_lastupdate\fR \fIdate\fR]
  84. [\fB\-crl_nextupdate\fR \fIdate\fR]
  85. [\fB\-crldays\fR \fIdays\fR]
  86. [\fB\-crlhours\fR \fIhours\fR]
  87. [\fB\-crlsec\fR \fIseconds\fR]
  88. [\fB\-crlexts\fR \fIsection\fR]
  89. [\fB\-startdate\fR \fIdate\fR]
  90. [\fB\-not_before\fR \fIdate\fR]
  91. [\fB\-enddate\fR \fIdate\fR]
  92. [\fB\-not_after\fR \fIdate\fR]
  93. [\fB\-days\fR \fIarg\fR]
  94. [\fB\-md\fR \fIarg\fR]
  95. [\fB\-policy\fR \fIarg\fR]
  96. [\fB\-keyfile\fR \fIfilename\fR|\fIuri\fR]
  97. [\fB\-keyform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR]
  98. [\fB\-key\fR \fIarg\fR]
  99. [\fB\-passin\fR \fIarg\fR]
  100. [\fB\-cert\fR \fIfile\fR]
  101. [\fB\-certform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR]
  102. [\fB\-selfsign\fR]
  103. [\fB\-in\fR \fIfile\fR]
  104. [\fB\-inform\fR \fBDER\fR|<PEM>]
  105. [\fB\-out\fR \fIfile\fR]
  106. [\fB\-notext\fR]
  107. [\fB\-dateopt\fR]
  108. [\fB\-outdir\fR \fIdir\fR]
  109. [\fB\-infiles\fR]
  110. [\fB\-spkac\fR \fIfile\fR]
  111. [\fB\-ss_cert\fR \fIfile\fR]
  112. [\fB\-preserveDN\fR]
  113. [\fB\-noemailDN\fR]
  114. [\fB\-batch\fR]
  115. [\fB\-msie_hack\fR]
  116. [\fB\-extensions\fR \fIsection\fR]
  117. [\fB\-extfile\fR \fIsection\fR]
  118. [\fB\-subj\fR \fIarg\fR]
  119. [\fB\-utf8\fR]
  120. [\fB\-sigopt\fR \fInm\fR:\fIv\fR]
  121. [\fB\-vfyopt\fR \fInm\fR:\fIv\fR]
  122. [\fB\-create_serial\fR]
  123. [\fB\-rand_serial\fR]
  124. [\fB\-multivalue\-rdn\fR]
  125. [\fB\-rand\fR \fIfiles\fR]
  126. [\fB\-writerand\fR \fIfile\fR]
  127. [\fB\-engine\fR \fIid\fR]
  128. [\fB\-provider\fR \fIname\fR]
  129. [\fB\-provider\-path\fR \fIpath\fR]
  130. [\fB\-propquery\fR \fIpropq\fR]
  131. [\fIcertreq\fR...]
  132. .SH DESCRIPTION
  133. .IX Header "DESCRIPTION"
  134. This command emulates a CA application.
  135. See the \fBWARNINGS\fR especially when considering to use it productively.
  136. .PP
  137. It generates certificates bearing X.509 version 3.
  138. Unless specified otherwise,
  139. key identifier extensions are included as described in \fBx509v3_config\fR\|(5).
  140. .PP
  141. It can be used to sign certificate requests (CSRs) in a variety of forms
  142. and generate certificate revocation lists (CRLs).
  143. It also maintains a text database of issued certificates and their status.
  144. When signing certificates, a single request can be specified
  145. with the \fB\-in\fR option, or multiple requests can be processed by
  146. specifying a set of \fBcertreq\fR files after all options.
  147. .PP
  148. Note that there are also very lean ways of generating certificates:
  149. the \fBreq\fR and \fBx509\fR commands can be used for directly creating certificates.
  150. See \fBopenssl\-req\fR\|(1) and \fBopenssl\-x509\fR\|(1) for details.
  151. .PP
  152. The descriptions of the \fBca\fR command options are divided into each purpose.
  153. .SH OPTIONS
  154. .IX Header "OPTIONS"
  155. .IP \fB\-help\fR 4
  156. .IX Item "-help"
  157. Print out a usage message.
  158. .IP \fB\-verbose\fR 4
  159. .IX Item "-verbose"
  160. This prints extra details about the operations being performed.
  161. .IP \fB\-quiet\fR 4
  162. .IX Item "-quiet"
  163. This prints fewer details about the operations being performed, which may
  164. be handy during batch scripts or pipelines.
  165. .IP "\fB\-config\fR \fIfilename\fR" 4
  166. .IX Item "-config filename"
  167. Specifies the configuration file to use.
  168. Optional; for a description of the default value,
  169. see "COMMAND SUMMARY" in \fBopenssl\fR\|(1).
  170. .IP "\fB\-name\fR \fIsection\fR, \fB\-section\fR \fIsection\fR" 4
  171. .IX Item "-name section, -section section"
  172. Specifies the configuration file section to use (overrides
  173. \&\fBdefault_ca\fR in the \fBca\fR section).
  174. .IP "\fB\-in\fR \fIfilename\fR" 4
  175. .IX Item "-in filename"
  176. An input filename containing a single certificate request (CSR) to be
  177. signed by the CA.
  178. .IP "\fB\-inform\fR \fBDER\fR|\fBPEM\fR" 4
  179. .IX Item "-inform DER|PEM"
  180. The format to use when loading certificate request (CSR) input files;
  181. by default PEM is tried first.
  182. See \fBopenssl\-format\-options\fR\|(1) for details.
  183. .IP "\fB\-ss_cert\fR \fIfilename\fR" 4
  184. .IX Item "-ss_cert filename"
  185. A single self-signed certificate to be signed by the CA.
  186. .IP "\fB\-spkac\fR \fIfilename\fR" 4
  187. .IX Item "-spkac filename"
  188. A file containing a single Netscape signed public key and challenge
  189. and additional field values to be signed by the CA. See the \fBSPKAC FORMAT\fR
  190. section for information on the required input and output format.
  191. .IP \fB\-infiles\fR 4
  192. .IX Item "-infiles"
  193. If present this should be the last option, all subsequent arguments
  194. are taken as the names of files containing certificate requests.
  195. .IP "\fB\-out\fR \fIfilename\fR" 4
  196. .IX Item "-out filename"
  197. The output file to output certificates to. The default is standard
  198. output. The certificate details will also be printed out to this
  199. file in PEM format (except that \fB\-spkac\fR outputs DER format).
  200. .IP "\fB\-outdir\fR \fIdirectory\fR" 4
  201. .IX Item "-outdir directory"
  202. The directory to output certificates to. The certificate will be
  203. written to a filename consisting of the serial number in hex with
  204. \&\fI.pem\fR appended.
  205. .IP "\fB\-cert\fR \fIfilename\fR" 4
  206. .IX Item "-cert filename"
  207. The CA certificate, which must match with \fB\-keyfile\fR.
  208. .IP "\fB\-certform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR" 4
  209. .IX Item "-certform DER|PEM|P12"
  210. The format of the data in certificate input files; unspecified by default.
  211. See \fBopenssl\-format\-options\fR\|(1) for details.
  212. .IP "\fB\-keyfile\fR \fIfilename\fR|\fIuri\fR" 4
  213. .IX Item "-keyfile filename|uri"
  214. The CA private key to sign certificate requests with.
  215. This must match with \fB\-cert\fR.
  216. .IP "\fB\-keyform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR" 4
  217. .IX Item "-keyform DER|PEM|P12|ENGINE"
  218. The format of the private key input file; unspecified by default.
  219. See \fBopenssl\-format\-options\fR\|(1) for details.
  220. .IP "\fB\-sigopt\fR \fInm\fR:\fIv\fR" 4
  221. .IX Item "-sigopt nm:v"
  222. Pass options to the signature algorithm during sign operations.
  223. Names and values of these options are algorithm-specific and
  224. documented in "Signature parameters" in \fBprovider\-signature\fR\|(7).
  225. .IP "\fB\-vfyopt\fR \fInm\fR:\fIv\fR" 4
  226. .IX Item "-vfyopt nm:v"
  227. Pass options to the signature algorithm during verify operations.
  228. Names and values of these options are algorithm-specific.
  229. .Sp
  230. This often needs to be given while signing too, because the self-signature of
  231. a certificate signing request (CSR) is verified against the included public key,
  232. and that verification may need its own set of options.
  233. .IP "\fB\-key\fR \fIpassword\fR" 4
  234. .IX Item "-key password"
  235. The password used to encrypt the private key. Since on some
  236. systems the command line arguments are visible (e.g., when using
  237. \&\fBps\fR\|(1) on Unix),
  238. this option should be used with caution.
  239. Better use \fB\-passin\fR.
  240. .IP "\fB\-passin\fR \fIarg\fR" 4
  241. .IX Item "-passin arg"
  242. The key password source for key files and certificate PKCS#12 files.
  243. For more information about the format of \fBarg\fR
  244. see \fBopenssl\-passphrase\-options\fR\|(1).
  245. .IP \fB\-selfsign\fR 4
  246. .IX Item "-selfsign"
  247. Indicates the issued certificates are to be signed with the key
  248. the certificate requests were signed with (given with \fB\-keyfile\fR).
  249. Certificate requests signed with a different key are ignored.
  250. If \fB\-spkac\fR, \fB\-ss_cert\fR or \fB\-gencrl\fR are given, \fB\-selfsign\fR is ignored.
  251. .Sp
  252. A consequence of using \fB\-selfsign\fR is that the self-signed
  253. certificate appears among the entries in the certificate database
  254. (see the configuration option \fBdatabase\fR), and uses the same
  255. serial number counter as all other certificates sign with the
  256. self-signed certificate.
  257. .IP \fB\-notext\fR 4
  258. .IX Item "-notext"
  259. Don't output the text form of a certificate to the output file.
  260. .IP \fB\-dateopt\fR 4
  261. .IX Item "-dateopt"
  262. Specify the date output format. Values are: rfc_822 and iso_8601.
  263. Defaults to rfc_822.
  264. .IP "\fB\-startdate\fR \fIdate\fR, \fB\-not_before\fR \fIdate\fR" 4
  265. .IX Item "-startdate date, -not_before date"
  266. This allows the start date to be explicitly set. The format of the
  267. date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or
  268. YYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In
  269. both formats, seconds SS and timezone Z must be present.
  270. Alternatively, you can also use "today".
  271. .IP "\fB\-enddate\fR \fIdate\fR, \fB\-not_after\fR \fIdate\fR" 4
  272. .IX Item "-enddate date, -not_after date"
  273. This allows the expiry date to be explicitly set. The format of the
  274. date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or
  275. YYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In
  276. both formats, seconds SS and timezone Z must be present.
  277. Alternatively, you can also use "today".
  278. .Sp
  279. This overrides the \fB\-days\fR option.
  280. .IP "\fB\-days\fR \fIarg\fR" 4
  281. .IX Item "-days arg"
  282. The number of days from today to certify the certificate for.
  283. .Sp
  284. Regardless of the option \fB\-not_before\fR, the days are always counted from
  285. today.
  286. When used together with the option \fB\-not_after\fR/\fB\-startdate\fR, the explicit
  287. expiry date takes precedence.
  288. .IP "\fB\-md\fR \fIalg\fR" 4
  289. .IX Item "-md alg"
  290. The message digest to use.
  291. Any digest supported by the \fBopenssl\-dgst\fR\|(1) command can be used. For signing
  292. algorithms that do not support a digest (i.e. Ed25519 and Ed448) any message
  293. digest that is set is ignored. This option also applies to CRLs.
  294. .IP "\fB\-policy\fR \fIarg\fR" 4
  295. .IX Item "-policy arg"
  296. This option defines the CA "policy" to use. This is a section in
  297. the configuration file which decides which fields should be mandatory
  298. or match the CA certificate. Check out the \fBPOLICY FORMAT\fR section
  299. for more information.
  300. .IP \fB\-msie_hack\fR 4
  301. .IX Item "-msie_hack"
  302. This is a deprecated option to make this command work with very old versions
  303. of the IE certificate enrollment control "certenr3". It used UniversalStrings
  304. for almost everything. Since the old control has various security bugs
  305. its use is strongly discouraged.
  306. .IP \fB\-preserveDN\fR 4
  307. .IX Item "-preserveDN"
  308. Normally the DN order of a certificate is the same as the order of the
  309. fields in the relevant policy section. When this option is set the order
  310. is the same as the request. This is largely for compatibility with the
  311. older IE enrollment control which would only accept certificates if their
  312. DNs match the order of the request. This is not needed for Xenroll.
  313. .IP \fB\-noemailDN\fR 4
  314. .IX Item "-noemailDN"
  315. The DN of a certificate can contain the EMAIL field if present in the
  316. request DN, however, it is good policy just having the e\-mail set into
  317. the altName extension of the certificate. When this option is set the
  318. EMAIL field is removed from the certificate' subject and set only in
  319. the, eventually present, extensions. The \fBemail_in_dn\fR keyword can be
  320. used in the configuration file to enable this behaviour.
  321. .IP \fB\-batch\fR 4
  322. .IX Item "-batch"
  323. This sets the batch mode. In this mode no questions will be asked
  324. and all certificates will be certified automatically.
  325. .IP "\fB\-extensions\fR \fIsection\fR" 4
  326. .IX Item "-extensions section"
  327. The section of the configuration file containing certificate extensions
  328. to be added when a certificate is issued (defaults to \fBx509_extensions\fR
  329. unless the \fB\-extfile\fR option is used).
  330. .Sp
  331. See the \fBx509v3_config\fR\|(5) manual page for details of the
  332. extension section format.
  333. .IP "\fB\-extfile\fR \fIfile\fR" 4
  334. .IX Item "-extfile file"
  335. An additional configuration file to read certificate extensions from
  336. (using the default section unless the \fB\-extensions\fR option is also
  337. used).
  338. .IP "\fB\-subj\fR \fIarg\fR" 4
  339. .IX Item "-subj arg"
  340. Supersedes subject name given in the request.
  341. .Sp
  342. The arg must be formatted as \f(CW\*(C`/type0=value0/type1=value1/type2=...\*(C'\fR.
  343. Special characters may be escaped by \f(CW\*(C`\e\*(C'\fR (backslash), whitespace is retained.
  344. Empty values are permitted, but the corresponding type will not be included
  345. in the resulting certificate.
  346. Giving a single \f(CW\*(C`/\*(C'\fR will lead to an empty sequence of RDNs (a NULL-DN).
  347. Multi-valued RDNs can be formed by placing a \f(CW\*(C`+\*(C'\fR character instead of a \f(CW\*(C`/\*(C'\fR
  348. between the AttributeValueAssertions (AVAs) that specify the members of the set.
  349. Example:
  350. .Sp
  351. \&\f(CW\*(C`/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe\*(C'\fR
  352. .IP \fB\-utf8\fR 4
  353. .IX Item "-utf8"
  354. This option causes field values to be interpreted as UTF8 strings, by
  355. default they are interpreted as ASCII. This means that the field
  356. values, whether prompted from a terminal or obtained from a
  357. configuration file, must be valid UTF8 strings.
  358. .IP \fB\-create_serial\fR 4
  359. .IX Item "-create_serial"
  360. If reading serial from the text file as specified in the configuration
  361. fails, specifying this option creates a new random serial to be used as next
  362. serial number.
  363. To get random serial numbers, use the \fB\-rand_serial\fR flag instead; this
  364. should only be used for simple error-recovery.
  365. .IP \fB\-rand_serial\fR 4
  366. .IX Item "-rand_serial"
  367. Generate a large random number to use as the serial number.
  368. This overrides any option or configuration to use a serial number file.
  369. .IP \fB\-multivalue\-rdn\fR 4
  370. .IX Item "-multivalue-rdn"
  371. This option has been deprecated and has no effect.
  372. .IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4
  373. .IX Item "-rand files, -writerand file"
  374. See "Random State Options" in \fBopenssl\fR\|(1) for details.
  375. .IP "\fB\-engine\fR \fIid\fR" 4
  376. .IX Item "-engine id"
  377. See "Engine Options" in \fBopenssl\fR\|(1).
  378. This option is deprecated.
  379. .IP "\fB\-provider\fR \fIname\fR" 4
  380. .IX Item "-provider name"
  381. .PD 0
  382. .IP "\fB\-provider\-path\fR \fIpath\fR" 4
  383. .IX Item "-provider-path path"
  384. .IP "\fB\-propquery\fR \fIpropq\fR" 4
  385. .IX Item "-propquery propq"
  386. .PD
  387. See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
  388. .SH "CRL OPTIONS"
  389. .IX Header "CRL OPTIONS"
  390. .IP \fB\-gencrl\fR 4
  391. .IX Item "-gencrl"
  392. This option generates a CRL based on information in the index file.
  393. .IP "\fB\-crl_lastupdate\fR \fItime\fR" 4
  394. .IX Item "-crl_lastupdate time"
  395. Allows the value of the CRL's lastUpdate field to be explicitly set; if
  396. this option is not present, the current time is used. Accepts times in
  397. YYMMDDHHMMSSZ format (the same as an ASN1 UTCTime structure) or
  398. YYYYMMDDHHMMSSZ format (the same as an ASN1 GeneralizedTime structure).
  399. .IP "\fB\-crl_nextupdate\fR \fItime\fR" 4
  400. .IX Item "-crl_nextupdate time"
  401. Allows the value of the CRL's nextUpdate field to be explicitly set; if
  402. this option is present, any values given for \fB\-crldays\fR, \fB\-crlhours\fR
  403. and \fB\-crlsec\fR are ignored. Accepts times in the same formats as
  404. \&\fB\-crl_lastupdate\fR.
  405. .IP "\fB\-crldays\fR \fInum\fR" 4
  406. .IX Item "-crldays num"
  407. The number of days before the next CRL is due. That is the days from
  408. now to place in the CRL nextUpdate field.
  409. .IP "\fB\-crlhours\fR \fInum\fR" 4
  410. .IX Item "-crlhours num"
  411. The number of hours before the next CRL is due.
  412. .IP "\fB\-crlsec\fR \fInum\fR" 4
  413. .IX Item "-crlsec num"
  414. The number of seconds before the next CRL is due.
  415. .IP "\fB\-revoke\fR \fIfilename\fR" 4
  416. .IX Item "-revoke filename"
  417. A filename containing a certificate to revoke.
  418. .IP "\fB\-valid\fR \fIfilename\fR" 4
  419. .IX Item "-valid filename"
  420. A filename containing a certificate to add a Valid certificate entry.
  421. .IP "\fB\-status\fR \fIserial\fR" 4
  422. .IX Item "-status serial"
  423. Displays the revocation status of the certificate with the specified
  424. serial number and exits.
  425. .IP \fB\-updatedb\fR 4
  426. .IX Item "-updatedb"
  427. Updates the database index to purge expired certificates.
  428. .IP "\fB\-crl_reason\fR \fIreason\fR" 4
  429. .IX Item "-crl_reason reason"
  430. Revocation reason, where \fIreason\fR is one of: \fBunspecified\fR, \fBkeyCompromise\fR,
  431. \&\fBCACompromise\fR, \fBaffiliationChanged\fR, \fBsuperseded\fR, \fBcessationOfOperation\fR,
  432. \&\fBcertificateHold\fR or \fBremoveFromCRL\fR. The matching of \fIreason\fR is case
  433. insensitive. Setting any revocation reason will make the CRL v2.
  434. .Sp
  435. In practice \fBremoveFromCRL\fR is not particularly useful because it is only used
  436. in delta CRLs which are not currently implemented.
  437. .IP "\fB\-crl_hold\fR \fIinstruction\fR" 4
  438. .IX Item "-crl_hold instruction"
  439. This sets the CRL revocation reason code to \fBcertificateHold\fR and the hold
  440. instruction to \fIinstruction\fR which must be an OID. Although any OID can be
  441. used only \fBholdInstructionNone\fR (the use of which is discouraged by RFC2459)
  442. \&\fBholdInstructionCallIssuer\fR or \fBholdInstructionReject\fR will normally be used.
  443. .IP "\fB\-crl_compromise\fR \fItime\fR" 4
  444. .IX Item "-crl_compromise time"
  445. This sets the revocation reason to \fBkeyCompromise\fR and the compromise time to
  446. \&\fItime\fR. \fItime\fR should be in GeneralizedTime format that is \fIYYYYMMDDHHMMSSZ\fR.
  447. .IP "\fB\-crl_CA_compromise\fR \fItime\fR" 4
  448. .IX Item "-crl_CA_compromise time"
  449. This is the same as \fBcrl_compromise\fR except the revocation reason is set to
  450. \&\fBCACompromise\fR.
  451. .IP "\fB\-crlexts\fR \fIsection\fR" 4
  452. .IX Item "-crlexts section"
  453. The section of the configuration file containing CRL extensions to
  454. include. If no CRL extension section is present then a V1 CRL is
  455. created, if the CRL extension section is present (even if it is
  456. empty) then a V2 CRL is created. The CRL extensions specified are
  457. CRL extensions and \fBnot\fR CRL entry extensions. It should be noted
  458. that some software (for example Netscape) can't handle V2 CRLs. See
  459. \&\fBx509v3_config\fR\|(5) manual page for details of the
  460. extension section format.
  461. .SH "CONFIGURATION FILE OPTIONS"
  462. .IX Header "CONFIGURATION FILE OPTIONS"
  463. The section of the configuration file containing options for this command
  464. is found as follows: If the \fB\-name\fR command line option is used,
  465. then it names the section to be used. Otherwise the section to
  466. be used must be named in the \fBdefault_ca\fR option of the \fBca\fR section
  467. of the configuration file (or in the default section of the
  468. configuration file). Besides \fBdefault_ca\fR, the following options are
  469. read directly from the \fBca\fR section:
  470. RANDFILE
  471. preserve
  472. msie_hack
  473. With the exception of \fBRANDFILE\fR, this is probably a bug and may
  474. change in future releases.
  475. .PP
  476. Many of the configuration file options are identical to command line
  477. options. Where the option is present in the configuration file
  478. and the command line the command line value is used. Where an
  479. option is described as mandatory then it must be present in
  480. the configuration file or the command line equivalent (if
  481. any) used.
  482. .IP \fBoid_file\fR 4
  483. .IX Item "oid_file"
  484. This specifies a file containing additional \fBOBJECT IDENTIFIERS\fR.
  485. Each line of the file should consist of the numerical form of the
  486. object identifier followed by whitespace then the short name followed
  487. by whitespace and finally the long name.
  488. .IP \fBoid_section\fR 4
  489. .IX Item "oid_section"
  490. This specifies a section in the configuration file containing extra
  491. object identifiers. Each line should consist of the short name of the
  492. object identifier followed by \fB=\fR and the numerical form. The short
  493. and long names are the same when this option is used.
  494. .IP \fBnew_certs_dir\fR 4
  495. .IX Item "new_certs_dir"
  496. The same as the \fB\-outdir\fR command line option. It specifies
  497. the directory where new certificates will be placed. Mandatory.
  498. .IP \fBcertificate\fR 4
  499. .IX Item "certificate"
  500. The same as \fB\-cert\fR. It gives the file containing the CA
  501. certificate. Mandatory.
  502. .IP \fBprivate_key\fR 4
  503. .IX Item "private_key"
  504. Same as the \fB\-keyfile\fR option. The file containing the
  505. CA private key. Mandatory.
  506. .IP \fBRANDFILE\fR 4
  507. .IX Item "RANDFILE"
  508. At startup the specified file is loaded into the random number generator,
  509. and at exit 256 bytes will be written to it. (Note: Using a RANDFILE is
  510. not necessary anymore, see the "HISTORY" section.
  511. .IP \fBdefault_days\fR 4
  512. .IX Item "default_days"
  513. The same as the \fB\-days\fR option. The number of days from today to certify
  514. a certificate for.
  515. .IP \fBdefault_startdate\fR 4
  516. .IX Item "default_startdate"
  517. The same as the \fB\-startdate\fR option. The start date to certify
  518. a certificate for. If not set the current time is used.
  519. .IP \fBdefault_enddate\fR 4
  520. .IX Item "default_enddate"
  521. The same as the \fB\-enddate\fR option. Either this option or
  522. \&\fBdefault_days\fR (or the command line equivalents) must be
  523. present.
  524. .IP "\fBdefault_crl_hours default_crl_days\fR" 4
  525. .IX Item "default_crl_hours default_crl_days"
  526. The same as the \fB\-crlhours\fR and the \fB\-crldays\fR options. These
  527. will only be used if neither command line option is present. At
  528. least one of these must be present to generate a CRL.
  529. .IP \fBdefault_md\fR 4
  530. .IX Item "default_md"
  531. The same as the \fB\-md\fR option. Mandatory except where the signing algorithm does
  532. not require a digest (i.e. Ed25519 and Ed448).
  533. .IP \fBdatabase\fR 4
  534. .IX Item "database"
  535. The text database file to use. Mandatory. This file must be present
  536. though initially it will be empty.
  537. .IP \fBunique_subject\fR 4
  538. .IX Item "unique_subject"
  539. If the value \fByes\fR is given, the valid certificate entries in the
  540. database must have unique subjects. if the value \fBno\fR is given,
  541. several valid certificate entries may have the exact same subject.
  542. The default value is \fByes\fR, to be compatible with older (pre 0.9.8)
  543. versions of OpenSSL. However, to make CA certificate roll-over easier,
  544. it's recommended to use the value \fBno\fR, especially if combined with
  545. the \fB\-selfsign\fR command line option.
  546. .Sp
  547. Note that it is valid in some circumstances for certificates to be created
  548. without any subject. In the case where there are multiple certificates without
  549. subjects this does not count as a duplicate.
  550. .IP \fBserial\fR 4
  551. .IX Item "serial"
  552. A text file containing the next serial number to use in hex. Mandatory.
  553. This file must be present and contain a valid serial number.
  554. .IP \fBcrlnumber\fR 4
  555. .IX Item "crlnumber"
  556. A text file containing the next CRL number to use in hex. The crl number
  557. will be inserted in the CRLs only if this file exists. If this file is
  558. present, it must contain a valid CRL number.
  559. .IP \fBx509_extensions\fR 4
  560. .IX Item "x509_extensions"
  561. A fallback to the \fB\-extensions\fR option.
  562. .IP \fBcrl_extensions\fR 4
  563. .IX Item "crl_extensions"
  564. A fallback to the \fB\-crlexts\fR option.
  565. .IP \fBpreserve\fR 4
  566. .IX Item "preserve"
  567. The same as \fB\-preserveDN\fR
  568. .IP \fBemail_in_dn\fR 4
  569. .IX Item "email_in_dn"
  570. The same as \fB\-noemailDN\fR. If you want the EMAIL field to be removed
  571. from the DN of the certificate simply set this to 'no'. If not present
  572. the default is to allow for the EMAIL filed in the certificate's DN.
  573. .IP \fBmsie_hack\fR 4
  574. .IX Item "msie_hack"
  575. The same as \fB\-msie_hack\fR
  576. .IP \fBpolicy\fR 4
  577. .IX Item "policy"
  578. The same as \fB\-policy\fR. Mandatory. See the \fBPOLICY FORMAT\fR section
  579. for more information.
  580. .IP "\fBname_opt\fR, \fBcert_opt\fR" 4
  581. .IX Item "name_opt, cert_opt"
  582. These options allow the format used to display the certificate details
  583. when asking the user to confirm signing. All the options supported by
  584. the \fBx509\fR utilities \fB\-nameopt\fR and \fB\-certopt\fR switches can be used
  585. here, except the \fBno_signame\fR and \fBno_sigdump\fR are permanently set
  586. and cannot be disabled (this is because the certificate signature cannot
  587. be displayed because the certificate has not been signed at this point).
  588. .Sp
  589. For convenience the values \fBca_default\fR are accepted by both to produce
  590. a reasonable output.
  591. .Sp
  592. If neither option is present the format used in earlier versions of
  593. OpenSSL is used. Use of the old format is \fBstrongly\fR discouraged because
  594. it only displays fields mentioned in the \fBpolicy\fR section, mishandles
  595. multicharacter string types and does not display extensions.
  596. .IP \fBcopy_extensions\fR 4
  597. .IX Item "copy_extensions"
  598. Determines how extensions in certificate requests should be handled.
  599. If set to \fBnone\fR or this option is not present then extensions are
  600. ignored and not copied to the certificate. If set to \fBcopy\fR then any
  601. extensions present in the request that are not already present are copied
  602. to the certificate. If set to \fBcopyall\fR then all extensions in the
  603. request are copied to the certificate: if the extension is already present
  604. in the certificate it is deleted first. See the \fBWARNINGS\fR section before
  605. using this option.
  606. .Sp
  607. The main use of this option is to allow a certificate request to supply
  608. values for certain extensions such as subjectAltName.
  609. .SH "POLICY FORMAT"
  610. .IX Header "POLICY FORMAT"
  611. The policy section consists of a set of variables corresponding to
  612. certificate DN fields. If the value is "match" then the field value
  613. must match the same field in the CA certificate. If the value is
  614. "supplied" then it must be present. If the value is "optional" then
  615. it may be present. Any fields not mentioned in the policy section
  616. are silently deleted, unless the \fB\-preserveDN\fR option is set but
  617. this can be regarded more of a quirk than intended behaviour.
  618. .SH "SPKAC FORMAT"
  619. .IX Header "SPKAC FORMAT"
  620. The input to the \fB\-spkac\fR command line option is a Netscape
  621. signed public key and challenge. This will usually come from
  622. the \fBKEYGEN\fR tag in an HTML form to create a new private key.
  623. It is however possible to create SPKACs using \fBopenssl\-spkac\fR\|(1).
  624. .PP
  625. The file should contain the variable SPKAC set to the value of
  626. the SPKAC and also the required DN components as name value pairs.
  627. If you need to include the same component twice then it can be
  628. preceded by a number and a '.'.
  629. .PP
  630. When processing SPKAC format, the output is DER if the \fB\-out\fR
  631. flag is used, but PEM format if sending to stdout or the \fB\-outdir\fR
  632. flag is used.
  633. .SH EXAMPLES
  634. .IX Header "EXAMPLES"
  635. Note: these examples assume that the directory structure this command
  636. assumes is already set up and the relevant files already exist. This
  637. usually involves creating a CA certificate and private key with
  638. \&\fBopenssl\-req\fR\|(1), a serial number file and an empty index file and
  639. placing them in the relevant directories.
  640. .PP
  641. To use the sample configuration file below the directories \fIdemoCA\fR,
  642. \&\fIdemoCA/private\fR and \fIdemoCA/newcerts\fR would be created. The CA
  643. certificate would be copied to \fIdemoCA/cacert.pem\fR and its private
  644. key to \fIdemoCA/private/cakey.pem\fR. A file \fIdemoCA/serial\fR would be
  645. created containing for example "01" and the empty index file
  646. \&\fIdemoCA/index.txt\fR.
  647. .PP
  648. Sign a certificate request:
  649. .PP
  650. .Vb 1
  651. \& openssl ca \-in req.pem \-out newcert.pem
  652. .Ve
  653. .PP
  654. Sign an SM2 certificate request:
  655. .PP
  656. .Vb 3
  657. \& openssl ca \-in sm2.csr \-out sm2.crt \-md sm3 \e
  658. \& \-sigopt "distid:1234567812345678" \e
  659. \& \-vfyopt "distid:1234567812345678"
  660. .Ve
  661. .PP
  662. Sign a certificate request, using CA extensions:
  663. .PP
  664. .Vb 1
  665. \& openssl ca \-in req.pem \-extensions v3_ca \-out newcert.pem
  666. .Ve
  667. .PP
  668. Generate a CRL
  669. .PP
  670. .Vb 1
  671. \& openssl ca \-gencrl \-out crl.pem
  672. .Ve
  673. .PP
  674. Sign several requests:
  675. .PP
  676. .Vb 1
  677. \& openssl ca \-infiles req1.pem req2.pem req3.pem
  678. .Ve
  679. .PP
  680. Certify a Netscape SPKAC:
  681. .PP
  682. .Vb 1
  683. \& openssl ca \-spkac spkac.txt
  684. .Ve
  685. .PP
  686. A sample SPKAC file (the SPKAC line has been truncated for clarity):
  687. .PP
  688. .Vb 5
  689. \& SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5
  690. \& CN=Steve Test
  691. \& emailAddress=steve@openssl.org
  692. \& 0.OU=OpenSSL Group
  693. \& 1.OU=Another Group
  694. .Ve
  695. .PP
  696. A sample configuration file with the relevant sections for this command:
  697. .PP
  698. .Vb 2
  699. \& [ ca ]
  700. \& default_ca = CA_default # The default ca section
  701. \&
  702. \& [ CA_default ]
  703. \&
  704. \& dir = ./demoCA # top dir
  705. \& database = $dir/index.txt # index file.
  706. \& new_certs_dir = $dir/newcerts # new certs dir
  707. \&
  708. \& certificate = $dir/cacert.pem # The CA cert
  709. \& serial = $dir/serial # serial no file
  710. \& #rand_serial = yes # for random serial#\*(Aqs
  711. \& private_key = $dir/private/cakey.pem# CA private key
  712. \&
  713. \& default_days = 365 # how long to certify for
  714. \& default_crl_days= 30 # how long before next CRL
  715. \& default_md = md5 # md to use
  716. \&
  717. \& policy = policy_any # default policy
  718. \& email_in_dn = no # Don\*(Aqt add the email into cert DN
  719. \&
  720. \& name_opt = ca_default # Subject name display option
  721. \& cert_opt = ca_default # Certificate display option
  722. \& copy_extensions = none # Don\*(Aqt copy extensions from request
  723. \&
  724. \& [ policy_any ]
  725. \& countryName = supplied
  726. \& stateOrProvinceName = optional
  727. \& organizationName = optional
  728. \& organizationalUnitName = optional
  729. \& commonName = supplied
  730. \& emailAddress = optional
  731. .Ve
  732. .SH FILES
  733. .IX Header "FILES"
  734. Note: the location of all files can change either by compile time options,
  735. configuration file entries, environment variables or command line options.
  736. The values below reflect the default values.
  737. .PP
  738. .Vb 9
  739. \& /usr/local/ssl/lib/openssl.cnf \- master configuration file
  740. \& ./demoCA \- main CA directory
  741. \& ./demoCA/cacert.pem \- CA certificate
  742. \& ./demoCA/private/cakey.pem \- CA private key
  743. \& ./demoCA/serial \- CA serial number file
  744. \& ./demoCA/serial.old \- CA serial number backup file
  745. \& ./demoCA/index.txt \- CA text database file
  746. \& ./demoCA/index.txt.old \- CA text database backup file
  747. \& ./demoCA/certs \- certificate output file
  748. .Ve
  749. .SH RESTRICTIONS
  750. .IX Header "RESTRICTIONS"
  751. The text database index file is a critical part of the process and
  752. if corrupted it can be difficult to fix. It is theoretically possible
  753. to rebuild the index file from all the issued certificates and a current
  754. CRL: however there is no option to do this.
  755. .PP
  756. V2 CRL features like delta CRLs are not currently supported.
  757. .PP
  758. Although several requests can be input and handled at once it is only
  759. possible to include one SPKAC or self-signed certificate.
  760. .SH BUGS
  761. .IX Header "BUGS"
  762. This command is quirky and at times downright unfriendly.
  763. .PP
  764. The use of an in-memory text database can cause problems when large
  765. numbers of certificates are present because, as the name implies
  766. the database has to be kept in memory.
  767. .PP
  768. This command really needs rewriting or the required functionality
  769. exposed at either a command or interface level so that a more user-friendly
  770. replacement could handle things properly. The script
  771. \&\fBCA.pl\fR helps a little but not very much.
  772. .PP
  773. Any fields in a request that are not present in a policy are silently
  774. deleted. This does not happen if the \fB\-preserveDN\fR option is used. To
  775. enforce the absence of the EMAIL field within the DN, as suggested by
  776. RFCs, regardless the contents of the request' subject the \fB\-noemailDN\fR
  777. option can be used. The behaviour should be more friendly and
  778. configurable.
  779. .PP
  780. Canceling some commands by refusing to certify a certificate can
  781. create an empty file.
  782. .SH WARNINGS
  783. .IX Header "WARNINGS"
  784. This command was originally meant as an example of how to do things in a CA.
  785. Its code does not have production quality.
  786. It was not supposed to be used as a full blown CA itself,
  787. nevertheless some people are using it for this purpose at least internally.
  788. When doing so, specific care should be taken to
  789. properly secure the private key(s) used for signing certificates.
  790. It is advisable to keep them in a secure HW storage such as a smart card or HSM
  791. and access them via a suitable engine or crypto provider.
  792. .PP
  793. This command is effectively a single user command: no locking
  794. is done on the various files and attempts to run more than one \fBopenssl ca\fR
  795. command on the same database can have unpredictable results.
  796. .PP
  797. The \fBcopy_extensions\fR option should be used with caution. If care is
  798. not taken then it can be a security risk. For example if a certificate
  799. request contains a basicConstraints extension with CA:TRUE and the
  800. \&\fBcopy_extensions\fR value is set to \fBcopyall\fR and the user does not spot
  801. this when the certificate is displayed then this will hand the requester
  802. a valid CA certificate.
  803. This situation can be avoided by setting \fBcopy_extensions\fR to \fBcopy\fR
  804. and including basicConstraints with CA:FALSE in the configuration file.
  805. Then if the request contains a basicConstraints extension it will be
  806. ignored.
  807. .PP
  808. It is advisable to also include values for other extensions such
  809. as \fBkeyUsage\fR to prevent a request supplying its own values.
  810. .PP
  811. Additional restrictions can be placed on the CA certificate itself.
  812. For example if the CA certificate has:
  813. .PP
  814. .Vb 1
  815. \& basicConstraints = CA:TRUE, pathlen:0
  816. .Ve
  817. .PP
  818. then even if a certificate is issued with CA:TRUE it will not be valid.
  819. .SH HISTORY
  820. .IX Header "HISTORY"
  821. Since OpenSSL 1.1.1, the program follows RFC5280. Specifically,
  822. certificate validity period (specified by any of \fB\-startdate\fR,
  823. \&\fB\-enddate\fR and \fB\-days\fR) and CRL last/next update time (specified by
  824. any of \fB\-crl_lastupdate\fR, \fB\-crl_nextupdate\fR, \fB\-crldays\fR, \fB\-crlhours\fR
  825. and \fB\-crlsec\fR) will be encoded as UTCTime if the dates are
  826. earlier than year 2049 (included), and as GeneralizedTime if the dates
  827. are in year 2050 or later.
  828. .PP
  829. OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved
  830. seeding mechanism. The new seeding mechanism makes it unnecessary to
  831. define a RANDFILE for saving and restoring randomness. This option is
  832. retained mainly for compatibility reasons.
  833. .PP
  834. The \fB\-section\fR option was added in OpenSSL 3.0.0.
  835. .PP
  836. The \fB\-multivalue\-rdn\fR option has become obsolete in OpenSSL 3.0.0 and
  837. has no effect.
  838. .PP
  839. The \fB\-engine\fR option was deprecated in OpenSSL 3.0.
  840. .PP
  841. Since OpenSSL 3.2, generated certificates bear X.509 version 3,
  842. and key identifier extensions are included by default.
  843. .SH "SEE ALSO"
  844. .IX Header "SEE ALSO"
  845. \&\fBopenssl\fR\|(1),
  846. \&\fBopenssl\-req\fR\|(1),
  847. \&\fBopenssl\-spkac\fR\|(1),
  848. \&\fBopenssl\-x509\fR\|(1),
  849. \&\fBCA.pl\fR\|(1),
  850. \&\fBconfig\fR\|(5),
  851. \&\fBx509v3_config\fR\|(5)
  852. .SH COPYRIGHT
  853. .IX Header "COPYRIGHT"
  854. Copyright 2000\-2024 The OpenSSL Project Authors. All Rights Reserved.
  855. .PP
  856. Licensed under the Apache License 2.0 (the "License"). You may not use
  857. this file except in compliance with the License. You can obtain a copy
  858. in the file LICENSE in the source distribution or at
  859. <https://www.openssl.org/source/license.html>.