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