Debian Codegraph @

upstream/debian-unstable/man1/openssl-ca.1ssl

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