]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/usr.bin/openssl/man/ca.1
Merge OpenSSL 1.0.2q.
[FreeBSD/FreeBSD.git] / secure / usr.bin / openssl / man / ca.1
1 .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .if !\nF .nr F 0
58 .if \nF>0 \{\
59 .    de IX
60 .    tm Index:\\$1\t\\n%\t"\\$2"
61 ..
62 .    if !\nF==2 \{\
63 .        nr % 0
64 .        nr F 2
65 .    \}
66 .\}
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "CA 1"
132 .TH CA 1 "2018-11-20" "1.0.2q" "OpenSSL"
133 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
134 .\" way too many mistakes in technical documents.
135 .if n .ad l
136 .nh
137 .SH "NAME"
138 openssl\-ca,
139 ca \- sample minimal CA application
140 .SH "SYNOPSIS"
141 .IX Header "SYNOPSIS"
142 \&\fBopenssl\fR \fBca\fR
143 [\fB\-verbose\fR]
144 [\fB\-config filename\fR]
145 [\fB\-name section\fR]
146 [\fB\-gencrl\fR]
147 [\fB\-revoke file\fR]
148 [\fB\-status serial\fR]
149 [\fB\-updatedb\fR]
150 [\fB\-crl_reason reason\fR]
151 [\fB\-crl_hold instruction\fR]
152 [\fB\-crl_compromise time\fR]
153 [\fB\-crl_CA_compromise time\fR]
154 [\fB\-crldays days\fR]
155 [\fB\-crlhours hours\fR]
156 [\fB\-crlexts section\fR]
157 [\fB\-startdate date\fR]
158 [\fB\-enddate date\fR]
159 [\fB\-days arg\fR]
160 [\fB\-md arg\fR]
161 [\fB\-policy arg\fR]
162 [\fB\-keyfile arg\fR]
163 [\fB\-keyform PEM|DER\fR]
164 [\fB\-key arg\fR]
165 [\fB\-passin arg\fR]
166 [\fB\-cert file\fR]
167 [\fB\-selfsign\fR]
168 [\fB\-in file\fR]
169 [\fB\-out file\fR]
170 [\fB\-notext\fR]
171 [\fB\-outdir dir\fR]
172 [\fB\-infiles\fR]
173 [\fB\-spkac file\fR]
174 [\fB\-ss_cert file\fR]
175 [\fB\-preserveDN\fR]
176 [\fB\-noemailDN\fR]
177 [\fB\-batch\fR]
178 [\fB\-msie_hack\fR]
179 [\fB\-extensions section\fR]
180 [\fB\-extfile section\fR]
181 [\fB\-engine id\fR]
182 [\fB\-subj arg\fR]
183 [\fB\-utf8\fR]
184 [\fB\-multivalue\-rdn\fR]
185 .SH "DESCRIPTION"
186 .IX Header "DESCRIPTION"
187 The \fBca\fR command is a minimal \s-1CA\s0 application. It can be used
188 to sign certificate requests in a variety of forms and generate
189 CRLs it also maintains a text database of issued certificates
190 and their status.
191 .PP
192 The options descriptions will be divided into each purpose.
193 .SH "CA OPTIONS"
194 .IX Header "CA OPTIONS"
195 .IP "\fB\-config filename\fR" 4
196 .IX Item "-config filename"
197 specifies the configuration file to use.
198 .IP "\fB\-name section\fR" 4
199 .IX Item "-name section"
200 specifies the configuration file section to use (overrides
201 \&\fBdefault_ca\fR in the \fBca\fR section).
202 .IP "\fB\-in filename\fR" 4
203 .IX Item "-in filename"
204 an input filename containing a single certificate request to be
205 signed by the \s-1CA.\s0
206 .IP "\fB\-ss_cert filename\fR" 4
207 .IX Item "-ss_cert filename"
208 a single self signed certificate to be signed by the \s-1CA.\s0
209 .IP "\fB\-spkac filename\fR" 4
210 .IX Item "-spkac filename"
211 a file containing a single Netscape signed public key and challenge
212 and additional field values to be signed by the \s-1CA.\s0 See the \fB\s-1SPKAC FORMAT\s0\fR
213 section for information on the required input and output format.
214 .IP "\fB\-infiles\fR" 4
215 .IX Item "-infiles"
216 if present this should be the last option, all subsequent arguments
217 are assumed to be the names of files containing certificate requests.
218 .IP "\fB\-out filename\fR" 4
219 .IX Item "-out filename"
220 the output file to output certificates to. The default is standard
221 output. The certificate details will also be printed out to this
222 file in \s-1PEM\s0 format (except that \fB\-spkac\fR outputs \s-1DER\s0 format).
223 .IP "\fB\-outdir directory\fR" 4
224 .IX Item "-outdir directory"
225 the directory to output certificates to. The certificate will be
226 written to a filename consisting of the serial number in hex with
227 \&\*(L".pem\*(R" appended.
228 .IP "\fB\-cert\fR" 4
229 .IX Item "-cert"
230 the \s-1CA\s0 certificate file.
231 .IP "\fB\-keyfile filename\fR" 4
232 .IX Item "-keyfile filename"
233 the private key to sign requests with.
234 .IP "\fB\-keyform PEM|DER\fR" 4
235 .IX Item "-keyform PEM|DER"
236 the format of the data in the private key file.
237 The default is \s-1PEM.\s0
238 .IP "\fB\-key password\fR" 4
239 .IX Item "-key password"
240 the password used to encrypt the private key. Since on some
241 systems the command line arguments are visible (e.g. Unix with
242 the 'ps' utility) this option should be used with caution.
243 .IP "\fB\-selfsign\fR" 4
244 .IX Item "-selfsign"
245 indicates the issued certificates are to be signed with the key
246 the certificate requests were signed with (given with \fB\-keyfile\fR).
247 Cerificate requests signed with a different key are ignored.  If
248 \&\fB\-spkac\fR, \fB\-ss_cert\fR or \fB\-gencrl\fR are given, \fB\-selfsign\fR is
249 ignored.
250 .Sp
251 A consequence of using \fB\-selfsign\fR is that the self-signed
252 certificate appears among the entries in the certificate database
253 (see the configuration option \fBdatabase\fR), and uses the same
254 serial number counter as all other certificates sign with the
255 self-signed certificate.
256 .IP "\fB\-passin arg\fR" 4
257 .IX Item "-passin arg"
258 the key password source. For more information about the format of \fBarg\fR
259 see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
260 .IP "\fB\-verbose\fR" 4
261 .IX Item "-verbose"
262 this prints extra details about the operations being performed.
263 .IP "\fB\-notext\fR" 4
264 .IX Item "-notext"
265 don't output the text form of a certificate to the output file.
266 .IP "\fB\-startdate date\fR" 4
267 .IX Item "-startdate date"
268 this allows the start date to be explicitly set. The format of the
269 date is \s-1YYMMDDHHMMSSZ\s0 (the same as an \s-1ASN1\s0 UTCTime structure).
270 .IP "\fB\-enddate date\fR" 4
271 .IX Item "-enddate date"
272 this allows the expiry date to be explicitly set. The format of the
273 date is \s-1YYMMDDHHMMSSZ\s0 (the same as an \s-1ASN1\s0 UTCTime structure).
274 .IP "\fB\-days arg\fR" 4
275 .IX Item "-days arg"
276 the number of days to certify the certificate for.
277 .IP "\fB\-md alg\fR" 4
278 .IX Item "-md alg"
279 the message digest to use. Possible values include md5, sha1 and mdc2.
280 This option also applies to CRLs.
281 .IP "\fB\-policy arg\fR" 4
282 .IX Item "-policy arg"
283 this option defines the \s-1CA\s0 \*(L"policy\*(R" to use. This is a section in
284 the configuration file which decides which fields should be mandatory
285 or match the \s-1CA\s0 certificate. Check out the \fB\s-1POLICY FORMAT\s0\fR section
286 for more information.
287 .IP "\fB\-msie_hack\fR" 4
288 .IX Item "-msie_hack"
289 this is a legacy option to make \fBca\fR work with very old versions of
290 the \s-1IE\s0 certificate enrollment control \*(L"certenr3\*(R". It used UniversalStrings
291 for almost everything. Since the old control has various security bugs
292 its use is strongly discouraged. The newer control \*(L"Xenroll\*(R" does not
293 need this option.
294 .IP "\fB\-preserveDN\fR" 4
295 .IX Item "-preserveDN"
296 Normally the \s-1DN\s0 order of a certificate is the same as the order of the
297 fields in the relevant policy section. When this option is set the order 
298 is the same as the request. This is largely for compatibility with the
299 older \s-1IE\s0 enrollment control which would only accept certificates if their
300 DNs match the order of the request. This is not needed for Xenroll.
301 .IP "\fB\-noemailDN\fR" 4
302 .IX Item "-noemailDN"
303 The \s-1DN\s0 of a certificate can contain the \s-1EMAIL\s0 field if present in the
304 request \s-1DN,\s0 however it is good policy just having the e\-mail set into
305 the altName extension of the certificate. When this option is set the
306 \&\s-1EMAIL\s0 field is removed from the certificate' subject and set only in
307 the, eventually present, extensions. The \fBemail_in_dn\fR keyword can be
308 used in the configuration file to enable this behaviour.
309 .IP "\fB\-batch\fR" 4
310 .IX Item "-batch"
311 this sets the batch mode. In this mode no questions will be asked
312 and all certificates will be certified automatically.
313 .IP "\fB\-extensions section\fR" 4
314 .IX Item "-extensions section"
315 the section of the configuration file containing certificate extensions
316 to be added when a certificate is issued (defaults to \fBx509_extensions\fR
317 unless the \fB\-extfile\fR option is used). If no extension section is
318 present then, a V1 certificate is created. If the extension section
319 is present (even if it is empty), then a V3 certificate is created. See the:w
320 \&\fIx509v3_config\fR\|(5) manual page for details of the
321 extension section format.
322 .IP "\fB\-extfile file\fR" 4
323 .IX Item "-extfile file"
324 an additional configuration file to read certificate extensions from
325 (using the default section unless the \fB\-extensions\fR option is also
326 used).
327 .IP "\fB\-engine id\fR" 4
328 .IX Item "-engine id"
329 specifying an engine (by its unique \fBid\fR string) will cause \fBca\fR
330 to attempt to obtain a functional reference to the specified engine,
331 thus initialising it if needed. The engine will then be set as the default
332 for all available algorithms.
333 .IP "\fB\-subj arg\fR" 4
334 .IX Item "-subj arg"
335 supersedes subject name given in the request.
336 The arg must be formatted as \fI/type0=value0/type1=value1/type2=...\fR,
337 characters may be escaped by \e (backslash), no spaces are skipped.
338 .IP "\fB\-utf8\fR" 4
339 .IX Item "-utf8"
340 this option causes field values to be interpreted as \s-1UTF8\s0 strings, by 
341 default they are interpreted as \s-1ASCII.\s0 This means that the field
342 values, whether prompted from a terminal or obtained from a
343 configuration file, must be valid \s-1UTF8\s0 strings.
344 .IP "\fB\-multivalue\-rdn\fR" 4
345 .IX Item "-multivalue-rdn"
346 this option causes the \-subj argument to be interpretedt with full
347 support for multivalued RDNs. Example:
348 .Sp
349 \&\fI/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe\fR
350 .Sp
351 If \-multi\-rdn is not used then the \s-1UID\s0 value is \fI123456+CN=John Doe\fR.
352 .SH "CRL OPTIONS"
353 .IX Header "CRL OPTIONS"
354 .IP "\fB\-gencrl\fR" 4
355 .IX Item "-gencrl"
356 this option generates a \s-1CRL\s0 based on information in the index file.
357 .IP "\fB\-crldays num\fR" 4
358 .IX Item "-crldays num"
359 the number of days before the next \s-1CRL\s0 is due. That is the days from
360 now to place in the \s-1CRL\s0 nextUpdate field.
361 .IP "\fB\-crlhours num\fR" 4
362 .IX Item "-crlhours num"
363 the number of hours before the next \s-1CRL\s0 is due.
364 .IP "\fB\-revoke filename\fR" 4
365 .IX Item "-revoke filename"
366 a filename containing a certificate to revoke.
367 .IP "\fB\-status serial\fR" 4
368 .IX Item "-status serial"
369 displays the revocation status of the certificate with the specified
370 serial number and exits.
371 .IP "\fB\-updatedb\fR" 4
372 .IX Item "-updatedb"
373 Updates the database index to purge expired certificates.
374 .IP "\fB\-crl_reason reason\fR" 4
375 .IX Item "-crl_reason reason"
376 revocation reason, where \fBreason\fR is one of: \fBunspecified\fR, \fBkeyCompromise\fR,
377 \&\fBCACompromise\fR, \fBaffiliationChanged\fR, \fBsuperseded\fR, \fBcessationOfOperation\fR,
378 \&\fBcertificateHold\fR or \fBremoveFromCRL\fR. The matching of \fBreason\fR is case
379 insensitive. Setting any revocation reason will make the \s-1CRL\s0 v2.
380 .Sp
381 In practive \fBremoveFromCRL\fR is not particularly useful because it is only used
382 in delta CRLs which are not currently implemented.
383 .IP "\fB\-crl_hold instruction\fR" 4
384 .IX Item "-crl_hold instruction"
385 This sets the \s-1CRL\s0 revocation reason code to \fBcertificateHold\fR and the hold
386 instruction to \fBinstruction\fR which must be an \s-1OID.\s0 Although any \s-1OID\s0 can be
387 used only \fBholdInstructionNone\fR (the use of which is discouraged by \s-1RFC2459\s0)
388 \&\fBholdInstructionCallIssuer\fR or \fBholdInstructionReject\fR will normally be used.
389 .IP "\fB\-crl_compromise time\fR" 4
390 .IX Item "-crl_compromise time"
391 This sets the revocation reason to \fBkeyCompromise\fR and the compromise time to
392 \&\fBtime\fR. \fBtime\fR should be in GeneralizedTime format that is \fB\s-1YYYYMMDDHHMMSSZ\s0\fR.
393 .IP "\fB\-crl_CA_compromise time\fR" 4
394 .IX Item "-crl_CA_compromise time"
395 This is the same as \fBcrl_compromise\fR except the revocation reason is set to
396 \&\fBCACompromise\fR.
397 .IP "\fB\-crlexts section\fR" 4
398 .IX Item "-crlexts section"
399 the section of the configuration file containing \s-1CRL\s0 extensions to
400 include. If no \s-1CRL\s0 extension section is present then a V1 \s-1CRL\s0 is
401 created, if the \s-1CRL\s0 extension section is present (even if it is
402 empty) then a V2 \s-1CRL\s0 is created. The \s-1CRL\s0 extensions specified are
403 \&\s-1CRL\s0 extensions and \fBnot\fR \s-1CRL\s0 entry extensions.  It should be noted
404 that some software (for example Netscape) can't handle V2 CRLs. See
405 \&\fIx509v3_config\fR\|(5) manual page for details of the
406 extension section format.
407 .SH "CONFIGURATION FILE OPTIONS"
408 .IX Header "CONFIGURATION FILE OPTIONS"
409 The section of the configuration file containing options for \fBca\fR
410 is found as follows: If the \fB\-name\fR command line option is used,
411 then it names the section to be used. Otherwise the section to
412 be used must be named in the \fBdefault_ca\fR option of the \fBca\fR section
413 of the configuration file (or in the default section of the
414 configuration file). Besides \fBdefault_ca\fR, the following options are
415 read directly from the \fBca\fR section:
416  \s-1RANDFILE\s0
417  preserve
418  msie_hack
419 With the exception of \fB\s-1RANDFILE\s0\fR, this is probably a bug and may
420 change in future releases.
421 .PP
422 Many of the configuration file options are identical to command line
423 options. Where the option is present in the configuration file
424 and the command line the command line value is used. Where an
425 option is described as mandatory then it must be present in
426 the configuration file or the command line equivalent (if
427 any) used.
428 .IP "\fBoid_file\fR" 4
429 .IX Item "oid_file"
430 This specifies a file containing additional \fB\s-1OBJECT IDENTIFIERS\s0\fR.
431 Each line of the file should consist of the numerical form of the
432 object identifier followed by white space then the short name followed
433 by white space and finally the long name.
434 .IP "\fBoid_section\fR" 4
435 .IX Item "oid_section"
436 This specifies a section in the configuration file containing extra
437 object identifiers. Each line should consist of the short name of the
438 object identifier followed by \fB=\fR and the numerical form. The short
439 and long names are the same when this option is used.
440 .IP "\fBnew_certs_dir\fR" 4
441 .IX Item "new_certs_dir"
442 the same as the \fB\-outdir\fR command line option. It specifies
443 the directory where new certificates will be placed. Mandatory.
444 .IP "\fBcertificate\fR" 4
445 .IX Item "certificate"
446 the same as \fB\-cert\fR. It gives the file containing the \s-1CA\s0
447 certificate. Mandatory.
448 .IP "\fBprivate_key\fR" 4
449 .IX Item "private_key"
450 same as the \fB\-keyfile\fR option. The file containing the
451 \&\s-1CA\s0 private key. Mandatory.
452 .IP "\fB\s-1RANDFILE\s0\fR" 4
453 .IX Item "RANDFILE"
454 a file used to read and write random number seed information, or
455 an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
456 .IP "\fBdefault_days\fR" 4
457 .IX Item "default_days"
458 the same as the \fB\-days\fR option. The number of days to certify
459 a certificate for.
460 .IP "\fBdefault_startdate\fR" 4
461 .IX Item "default_startdate"
462 the same as the \fB\-startdate\fR option. The start date to certify
463 a certificate for. If not set the current time is used.
464 .IP "\fBdefault_enddate\fR" 4
465 .IX Item "default_enddate"
466 the same as the \fB\-enddate\fR option. Either this option or
467 \&\fBdefault_days\fR (or the command line equivalents) must be
468 present.
469 .IP "\fBdefault_crl_hours default_crl_days\fR" 4
470 .IX Item "default_crl_hours default_crl_days"
471 the same as the \fB\-crlhours\fR and the \fB\-crldays\fR options. These
472 will only be used if neither command line option is present. At
473 least one of these must be present to generate a \s-1CRL.\s0
474 .IP "\fBdefault_md\fR" 4
475 .IX Item "default_md"
476 the same as the \fB\-md\fR option. The message digest to use. Mandatory.
477 .IP "\fBdatabase\fR" 4
478 .IX Item "database"
479 the text database file to use. Mandatory. This file must be present
480 though initially it will be empty.
481 .IP "\fBunique_subject\fR" 4
482 .IX Item "unique_subject"
483 if the value \fByes\fR is given, the valid certificate entries in the
484 database must have unique subjects.  if the value \fBno\fR is given,
485 several valid certificate entries may have the exact same subject.
486 The default value is \fByes\fR, to be compatible with older (pre 0.9.8)
487 versions of OpenSSL.  However, to make \s-1CA\s0 certificate roll-over easier,
488 it's recommended to use the value \fBno\fR, especially if combined with
489 the \fB\-selfsign\fR command line option.
490 .Sp
491 Note that it is valid in some circumstances for certificates to be created
492 without any subject. In the case where there are multiple certificates without
493 subjects this does not count as a duplicate.
494 .IP "\fBserial\fR" 4
495 .IX Item "serial"
496 a text file containing the next serial number to use in hex. Mandatory.
497 This file must be present and contain a valid serial number.
498 .IP "\fBcrlnumber\fR" 4
499 .IX Item "crlnumber"
500 a text file containing the next \s-1CRL\s0 number to use in hex. The crl number
501 will be inserted in the CRLs only if this file exists. If this file is
502 present, it must contain a valid \s-1CRL\s0 number.
503 .IP "\fBx509_extensions\fR" 4
504 .IX Item "x509_extensions"
505 the same as \fB\-extensions\fR.
506 .IP "\fBcrl_extensions\fR" 4
507 .IX Item "crl_extensions"
508 the same as \fB\-crlexts\fR.
509 .IP "\fBpreserve\fR" 4
510 .IX Item "preserve"
511 the same as \fB\-preserveDN\fR
512 .IP "\fBemail_in_dn\fR" 4
513 .IX Item "email_in_dn"
514 the same as \fB\-noemailDN\fR. If you want the \s-1EMAIL\s0 field to be removed
515 from the \s-1DN\s0 of the certificate simply set this to 'no'. If not present
516 the default is to allow for the \s-1EMAIL\s0 filed in the certificate's \s-1DN.\s0
517 .IP "\fBmsie_hack\fR" 4
518 .IX Item "msie_hack"
519 the same as \fB\-msie_hack\fR
520 .IP "\fBpolicy\fR" 4
521 .IX Item "policy"
522 the same as \fB\-policy\fR. Mandatory. See the \fB\s-1POLICY FORMAT\s0\fR section
523 for more information.
524 .IP "\fBname_opt\fR, \fBcert_opt\fR" 4
525 .IX Item "name_opt, cert_opt"
526 these options allow the format used to display the certificate details
527 when asking the user to confirm signing. All the options supported by
528 the \fBx509\fR utilities \fB\-nameopt\fR and \fB\-certopt\fR switches can be used
529 here, except the \fBno_signame\fR and \fBno_sigdump\fR are permanently set
530 and cannot be disabled (this is because the certificate signature cannot
531 be displayed because the certificate has not been signed at this point).
532 .Sp
533 For convenience the values \fBca_default\fR are accepted by both to produce
534 a reasonable output.
535 .Sp
536 If neither option is present the format used in earlier versions of
537 OpenSSL is used. Use of the old format is \fBstrongly\fR discouraged because
538 it only displays fields mentioned in the \fBpolicy\fR section, mishandles
539 multicharacter string types and does not display extensions.
540 .IP "\fBcopy_extensions\fR" 4
541 .IX Item "copy_extensions"
542 determines how extensions in certificate requests should be handled.
543 If set to \fBnone\fR or this option is not present then extensions are
544 ignored and not copied to the certificate. If set to \fBcopy\fR then any
545 extensions present in the request that are not already present are copied
546 to the certificate. If set to \fBcopyall\fR then all extensions in the
547 request are copied to the certificate: if the extension is already present
548 in the certificate it is deleted first. See the \fB\s-1WARNINGS\s0\fR section before
549 using this option.
550 .Sp
551 The main use of this option is to allow a certificate request to supply
552 values for certain extensions such as subjectAltName.
553 .SH "POLICY FORMAT"
554 .IX Header "POLICY FORMAT"
555 The policy section consists of a set of variables corresponding to
556 certificate \s-1DN\s0 fields. If the value is \*(L"match\*(R" then the field value
557 must match the same field in the \s-1CA\s0 certificate. If the value is
558 \&\*(L"supplied\*(R" then it must be present. If the value is \*(L"optional\*(R" then
559 it may be present. Any fields not mentioned in the policy section
560 are silently deleted, unless the \fB\-preserveDN\fR option is set but
561 this can be regarded more of a quirk than intended behaviour.
562 .SH "SPKAC FORMAT"
563 .IX Header "SPKAC FORMAT"
564 The input to the \fB\-spkac\fR command line option is a Netscape
565 signed public key and challenge. This will usually come from
566 the \fB\s-1KEYGEN\s0\fR tag in an \s-1HTML\s0 form to create a new private key. 
567 It is however possible to create SPKACs using the \fBspkac\fR utility.
568 .PP
569 The file should contain the variable \s-1SPKAC\s0 set to the value of
570 the \s-1SPKAC\s0 and also the required \s-1DN\s0 components as name value pairs.
571 If you need to include the same component twice then it can be
572 preceded by a number and a '.'.
573 .PP
574 When processing \s-1SPKAC\s0 format, the output is \s-1DER\s0 if the \fB\-out\fR
575 flag is used, but \s-1PEM\s0 format if sending to stdout or the \fB\-outdir\fR
576 flag is used.
577 .SH "EXAMPLES"
578 .IX Header "EXAMPLES"
579 Note: these examples assume that the \fBca\fR directory structure is
580 already set up and the relevant files already exist. This usually
581 involves creating a \s-1CA\s0 certificate and private key with \fBreq\fR, a
582 serial number file and an empty index file and placing them in
583 the relevant directories.
584 .PP
585 To use the sample configuration file below the directories demoCA,
586 demoCA/private and demoCA/newcerts would be created. The \s-1CA\s0
587 certificate would be copied to demoCA/cacert.pem and its private
588 key to demoCA/private/cakey.pem. A file demoCA/serial would be
589 created containing for example \*(L"01\*(R" and the empty index file
590 demoCA/index.txt.
591 .PP
592 Sign a certificate request:
593 .PP
594 .Vb 1
595 \& openssl ca \-in req.pem \-out newcert.pem
596 .Ve
597 .PP
598 Sign a certificate request, using \s-1CA\s0 extensions:
599 .PP
600 .Vb 1
601 \& openssl ca \-in req.pem \-extensions v3_ca \-out newcert.pem
602 .Ve
603 .PP
604 Generate a \s-1CRL\s0
605 .PP
606 .Vb 1
607 \& openssl ca \-gencrl \-out crl.pem
608 .Ve
609 .PP
610 Sign several requests:
611 .PP
612 .Vb 1
613 \& openssl ca \-infiles req1.pem req2.pem req3.pem
614 .Ve
615 .PP
616 Certify a Netscape \s-1SPKAC:\s0
617 .PP
618 .Vb 1
619 \& openssl ca \-spkac spkac.txt
620 .Ve
621 .PP
622 A sample \s-1SPKAC\s0 file (the \s-1SPKAC\s0 line has been truncated for clarity):
623 .PP
624 .Vb 5
625 \& SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5
626 \& CN=Steve Test
627 \& emailAddress=steve@openssl.org
628 \& 0.OU=OpenSSL Group
629 \& 1.OU=Another Group
630 .Ve
631 .PP
632 A sample configuration file with the relevant sections for \fBca\fR:
633 .PP
634 .Vb 2
635 \& [ ca ]
636 \& default_ca      = CA_default            # The default ca section
637 \& 
638 \& [ CA_default ]
639 \&
640 \& dir            = ./demoCA              # top dir
641 \& database       = $dir/index.txt        # index file.
642 \& new_certs_dir  = $dir/newcerts         # new certs dir
643 \& 
644 \& certificate    = $dir/cacert.pem       # The CA cert
645 \& serial         = $dir/serial           # serial no file
646 \& private_key    = $dir/private/cakey.pem# CA private key
647 \& RANDFILE       = $dir/private/.rand    # random number file
648 \& 
649 \& default_days   = 365                   # how long to certify for
650 \& default_crl_days= 30                   # how long before next CRL
651 \& default_md     = md5                   # md to use
652 \&
653 \& policy         = policy_any            # default policy
654 \& email_in_dn    = no                    # Don\*(Aqt add the email into cert DN
655 \&
656 \& name_opt       = ca_default            # Subject name display option
657 \& cert_opt       = ca_default            # Certificate display option
658 \& copy_extensions = none                 # Don\*(Aqt copy extensions from request
659 \&
660 \& [ policy_any ]
661 \& countryName            = supplied
662 \& stateOrProvinceName    = optional
663 \& organizationName       = optional
664 \& organizationalUnitName = optional
665 \& commonName             = supplied
666 \& emailAddress           = optional
667 .Ve
668 .SH "FILES"
669 .IX Header "FILES"
670 Note: the location of all files can change either by compile time options,
671 configuration file entries, environment variables or command line options.
672 The values below reflect the default values.
673 .PP
674 .Vb 10
675 \& /usr/local/ssl/lib/openssl.cnf \- master configuration file
676 \& ./demoCA                       \- main CA directory
677 \& ./demoCA/cacert.pem            \- CA certificate
678 \& ./demoCA/private/cakey.pem     \- CA private key
679 \& ./demoCA/serial                \- CA serial number file
680 \& ./demoCA/serial.old            \- CA serial number backup file
681 \& ./demoCA/index.txt             \- CA text database file
682 \& ./demoCA/index.txt.old         \- CA text database backup file
683 \& ./demoCA/certs                 \- certificate output file
684 \& ./demoCA/.rnd                  \- CA random seed information
685 .Ve
686 .SH "ENVIRONMENT VARIABLES"
687 .IX Header "ENVIRONMENT VARIABLES"
688 \&\fB\s-1OPENSSL_CONF\s0\fR reflects the location of master configuration file it can
689 be overridden by the \fB\-config\fR command line option.
690 .SH "RESTRICTIONS"
691 .IX Header "RESTRICTIONS"
692 The text database index file is a critical part of the process and 
693 if corrupted it can be difficult to fix. It is theoretically possible
694 to rebuild the index file from all the issued certificates and a current
695 \&\s-1CRL:\s0 however there is no option to do this.
696 .PP
697 V2 \s-1CRL\s0 features like delta CRLs are not currently supported.
698 .PP
699 Although several requests can be input and handled at once it is only
700 possible to include one \s-1SPKAC\s0 or self signed certificate.
701 .SH "BUGS"
702 .IX Header "BUGS"
703 The use of an in memory text database can cause problems when large
704 numbers of certificates are present because, as the name implies
705 the database has to be kept in memory.
706 .PP
707 The \fBca\fR command really needs rewriting or the required functionality
708 exposed at either a command or interface level so a more friendly utility
709 (perl script or \s-1GUI\s0) can handle things properly. The scripts \fB\s-1CA\s0.sh\fR and
710 \&\fB\s-1CA\s0.pl\fR help a little but not very much.
711 .PP
712 Any fields in a request that are not present in a policy are silently
713 deleted. This does not happen if the \fB\-preserveDN\fR option is used. To
714 enforce the absence of the \s-1EMAIL\s0 field within the \s-1DN,\s0 as suggested by
715 RFCs, regardless the contents of the request' subject the \fB\-noemailDN\fR
716 option can be used. The behaviour should be more friendly and
717 configurable.
718 .PP
719 Cancelling some commands by refusing to certify a certificate can
720 create an empty file.
721 .SH "WARNINGS"
722 .IX Header "WARNINGS"
723 The \fBca\fR command is quirky and at times downright unfriendly.
724 .PP
725 The \fBca\fR utility was originally meant as an example of how to do things
726 in a \s-1CA.\s0 It was not supposed to be used as a full blown \s-1CA\s0 itself:
727 nevertheless some people are using it for this purpose.
728 .PP
729 The \fBca\fR command is effectively a single user command: no locking is
730 done on the various files and attempts to run more than one \fBca\fR command
731 on the same database can have unpredictable results.
732 .PP
733 The \fBcopy_extensions\fR option should be used with caution. If care is
734 not taken then it can be a security risk. For example if a certificate
735 request contains a basicConstraints extension with \s-1CA:TRUE\s0 and the
736 \&\fBcopy_extensions\fR value is set to \fBcopyall\fR and the user does not spot
737 this when the certificate is displayed then this will hand the requestor
738 a valid \s-1CA\s0 certificate.
739 .PP
740 This situation can be avoided by setting \fBcopy_extensions\fR to \fBcopy\fR
741 and including basicConstraints with \s-1CA:FALSE\s0 in the configuration file.
742 Then if the request contains a basicConstraints extension it will be
743 ignored.
744 .PP
745 It is advisable to also include values for other extensions such
746 as \fBkeyUsage\fR to prevent a request supplying its own values.
747 .PP
748 Additional restrictions can be placed on the \s-1CA\s0 certificate itself.
749 For example if the \s-1CA\s0 certificate has:
750 .PP
751 .Vb 1
752 \& basicConstraints = CA:TRUE, pathlen:0
753 .Ve
754 .PP
755 then even if a certificate is issued with \s-1CA:TRUE\s0 it will not be valid.
756 .SH "SEE ALSO"
757 .IX Header "SEE ALSO"
758 \&\fIreq\fR\|(1), \fIspkac\fR\|(1), \fIx509\fR\|(1), \s-1\fICA\s0.pl\fR\|(1),
759 \&\fIconfig\fR\|(5), \fIx509v3_config\fR\|(5)