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