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