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