xref: /minix3/crypto/external/bsd/openssl/dist/doc/apps/ca.pod (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc
2ebfedea0SLionel Sambuc=pod
3ebfedea0SLionel Sambuc
4ebfedea0SLionel Sambuc=head1 NAME
5ebfedea0SLionel Sambuc
6ebfedea0SLionel Sambucca - sample minimal CA application
7ebfedea0SLionel Sambuc
8ebfedea0SLionel Sambuc=head1 SYNOPSIS
9ebfedea0SLionel Sambuc
10ebfedea0SLionel SambucB<openssl> B<ca>
11ebfedea0SLionel Sambuc[B<-verbose>]
12ebfedea0SLionel Sambuc[B<-config filename>]
13ebfedea0SLionel Sambuc[B<-name section>]
14ebfedea0SLionel Sambuc[B<-gencrl>]
15ebfedea0SLionel Sambuc[B<-revoke file>]
16*0a6a1f1dSLionel Sambuc[B<-status serial>]
17*0a6a1f1dSLionel Sambuc[B<-updatedb>]
18ebfedea0SLionel Sambuc[B<-crl_reason reason>]
19ebfedea0SLionel Sambuc[B<-crl_hold instruction>]
20ebfedea0SLionel Sambuc[B<-crl_compromise time>]
21ebfedea0SLionel Sambuc[B<-crl_CA_compromise time>]
22ebfedea0SLionel Sambuc[B<-crldays days>]
23ebfedea0SLionel Sambuc[B<-crlhours hours>]
24ebfedea0SLionel Sambuc[B<-crlexts section>]
25ebfedea0SLionel Sambuc[B<-startdate date>]
26ebfedea0SLionel Sambuc[B<-enddate date>]
27ebfedea0SLionel Sambuc[B<-days arg>]
28ebfedea0SLionel Sambuc[B<-md arg>]
29ebfedea0SLionel Sambuc[B<-policy arg>]
30ebfedea0SLionel Sambuc[B<-keyfile arg>]
31*0a6a1f1dSLionel Sambuc[B<-keyform PEM|DER>]
32ebfedea0SLionel Sambuc[B<-key arg>]
33ebfedea0SLionel Sambuc[B<-passin arg>]
34ebfedea0SLionel Sambuc[B<-cert file>]
35ebfedea0SLionel Sambuc[B<-selfsign>]
36ebfedea0SLionel Sambuc[B<-in file>]
37ebfedea0SLionel Sambuc[B<-out file>]
38ebfedea0SLionel Sambuc[B<-notext>]
39ebfedea0SLionel Sambuc[B<-outdir dir>]
40ebfedea0SLionel Sambuc[B<-infiles>]
41ebfedea0SLionel Sambuc[B<-spkac file>]
42ebfedea0SLionel Sambuc[B<-ss_cert file>]
43ebfedea0SLionel Sambuc[B<-preserveDN>]
44ebfedea0SLionel Sambuc[B<-noemailDN>]
45ebfedea0SLionel Sambuc[B<-batch>]
46ebfedea0SLionel Sambuc[B<-msie_hack>]
47ebfedea0SLionel Sambuc[B<-extensions section>]
48ebfedea0SLionel Sambuc[B<-extfile section>]
49ebfedea0SLionel Sambuc[B<-engine id>]
50ebfedea0SLionel Sambuc[B<-subj arg>]
51ebfedea0SLionel Sambuc[B<-utf8>]
52ebfedea0SLionel Sambuc[B<-multivalue-rdn>]
53ebfedea0SLionel Sambuc
54ebfedea0SLionel Sambuc=head1 DESCRIPTION
55ebfedea0SLionel Sambuc
56ebfedea0SLionel SambucThe B<ca> command is a minimal CA application. It can be used
57ebfedea0SLionel Sambucto sign certificate requests in a variety of forms and generate
58ebfedea0SLionel SambucCRLs it also maintains a text database of issued certificates
59ebfedea0SLionel Sambucand their status.
60ebfedea0SLionel Sambuc
61ebfedea0SLionel SambucThe options descriptions will be divided into each purpose.
62ebfedea0SLionel Sambuc
63ebfedea0SLionel Sambuc=head1 CA OPTIONS
64ebfedea0SLionel Sambuc
65ebfedea0SLionel Sambuc=over 4
66ebfedea0SLionel Sambuc
67ebfedea0SLionel Sambuc=item B<-config filename>
68ebfedea0SLionel Sambuc
69ebfedea0SLionel Sambucspecifies the configuration file to use.
70ebfedea0SLionel Sambuc
71ebfedea0SLionel Sambuc=item B<-name section>
72ebfedea0SLionel Sambuc
73ebfedea0SLionel Sambucspecifies the configuration file section to use (overrides
74ebfedea0SLionel SambucB<default_ca> in the B<ca> section).
75ebfedea0SLionel Sambuc
76ebfedea0SLionel Sambuc=item B<-in filename>
77ebfedea0SLionel Sambuc
78ebfedea0SLionel Sambucan input filename containing a single certificate request to be
79ebfedea0SLionel Sambucsigned by the CA.
80ebfedea0SLionel Sambuc
81ebfedea0SLionel Sambuc=item B<-ss_cert filename>
82ebfedea0SLionel Sambuc
83ebfedea0SLionel Sambuca single self signed certificate to be signed by the CA.
84ebfedea0SLionel Sambuc
85ebfedea0SLionel Sambuc=item B<-spkac filename>
86ebfedea0SLionel Sambuc
87ebfedea0SLionel Sambuca file containing a single Netscape signed public key and challenge
88ebfedea0SLionel Sambucand additional field values to be signed by the CA. See the B<SPKAC FORMAT>
89*0a6a1f1dSLionel Sambucsection for information on the required input and output format.
90ebfedea0SLionel Sambuc
91ebfedea0SLionel Sambuc=item B<-infiles>
92ebfedea0SLionel Sambuc
93ebfedea0SLionel Sambucif present this should be the last option, all subsequent arguments
94ebfedea0SLionel Sambucare assumed to the the names of files containing certificate requests.
95ebfedea0SLionel Sambuc
96ebfedea0SLionel Sambuc=item B<-out filename>
97ebfedea0SLionel Sambuc
98ebfedea0SLionel Sambucthe output file to output certificates to. The default is standard
99ebfedea0SLionel Sambucoutput. The certificate details will also be printed out to this
100*0a6a1f1dSLionel Sambucfile in PEM format (except that B<-spkac> outputs DER format).
101ebfedea0SLionel Sambuc
102ebfedea0SLionel Sambuc=item B<-outdir directory>
103ebfedea0SLionel Sambuc
104ebfedea0SLionel Sambucthe directory to output certificates to. The certificate will be
105ebfedea0SLionel Sambucwritten to a filename consisting of the serial number in hex with
106ebfedea0SLionel Sambuc".pem" appended.
107ebfedea0SLionel Sambuc
108ebfedea0SLionel Sambuc=item B<-cert>
109ebfedea0SLionel Sambuc
110ebfedea0SLionel Sambucthe CA certificate file.
111ebfedea0SLionel Sambuc
112ebfedea0SLionel Sambuc=item B<-keyfile filename>
113ebfedea0SLionel Sambuc
114ebfedea0SLionel Sambucthe private key to sign requests with.
115ebfedea0SLionel Sambuc
116*0a6a1f1dSLionel Sambuc=item B<-keyform PEM|DER>
117*0a6a1f1dSLionel Sambuc
118*0a6a1f1dSLionel Sambucthe format of the data in the private key file.
119*0a6a1f1dSLionel SambucThe default is PEM.
120*0a6a1f1dSLionel Sambuc
121ebfedea0SLionel Sambuc=item B<-key password>
122ebfedea0SLionel Sambuc
123ebfedea0SLionel Sambucthe password used to encrypt the private key. Since on some
124ebfedea0SLionel Sambucsystems the command line arguments are visible (e.g. Unix with
125ebfedea0SLionel Sambucthe 'ps' utility) this option should be used with caution.
126ebfedea0SLionel Sambuc
127ebfedea0SLionel Sambuc=item B<-selfsign>
128ebfedea0SLionel Sambuc
129ebfedea0SLionel Sambucindicates the issued certificates are to be signed with the key
130ebfedea0SLionel Sambucthe certificate requests were signed with (given with B<-keyfile>).
131ebfedea0SLionel SambucCerificate requests signed with a different key are ignored.  If
132ebfedea0SLionel SambucB<-spkac>, B<-ss_cert> or B<-gencrl> are given, B<-selfsign> is
133ebfedea0SLionel Sambucignored.
134ebfedea0SLionel Sambuc
135ebfedea0SLionel SambucA consequence of using B<-selfsign> is that the self-signed
136ebfedea0SLionel Sambuccertificate appears among the entries in the certificate database
137ebfedea0SLionel Sambuc(see the configuration option B<database>), and uses the same
138ebfedea0SLionel Sambucserial number counter as all other certificates sign with the
139ebfedea0SLionel Sambucself-signed certificate.
140ebfedea0SLionel Sambuc
141ebfedea0SLionel Sambuc=item B<-passin arg>
142ebfedea0SLionel Sambuc
143ebfedea0SLionel Sambucthe key password source. For more information about the format of B<arg>
144ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
145ebfedea0SLionel Sambuc
146ebfedea0SLionel Sambuc=item B<-verbose>
147ebfedea0SLionel Sambuc
148ebfedea0SLionel Sambucthis prints extra details about the operations being performed.
149ebfedea0SLionel Sambuc
150ebfedea0SLionel Sambuc=item B<-notext>
151ebfedea0SLionel Sambuc
152ebfedea0SLionel Sambucdon't output the text form of a certificate to the output file.
153ebfedea0SLionel Sambuc
154ebfedea0SLionel Sambuc=item B<-startdate date>
155ebfedea0SLionel Sambuc
156ebfedea0SLionel Sambucthis allows the start date to be explicitly set. The format of the
157ebfedea0SLionel Sambucdate is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure).
158ebfedea0SLionel Sambuc
159ebfedea0SLionel Sambuc=item B<-enddate date>
160ebfedea0SLionel Sambuc
161ebfedea0SLionel Sambucthis allows the expiry date to be explicitly set. The format of the
162ebfedea0SLionel Sambucdate is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure).
163ebfedea0SLionel Sambuc
164ebfedea0SLionel Sambuc=item B<-days arg>
165ebfedea0SLionel Sambuc
166ebfedea0SLionel Sambucthe number of days to certify the certificate for.
167ebfedea0SLionel Sambuc
168ebfedea0SLionel Sambuc=item B<-md alg>
169ebfedea0SLionel Sambuc
170ebfedea0SLionel Sambucthe message digest to use. Possible values include md5, sha1 and mdc2.
171ebfedea0SLionel SambucThis option also applies to CRLs.
172ebfedea0SLionel Sambuc
173ebfedea0SLionel Sambuc=item B<-policy arg>
174ebfedea0SLionel Sambuc
175ebfedea0SLionel Sambucthis option defines the CA "policy" to use. This is a section in
176ebfedea0SLionel Sambucthe configuration file which decides which fields should be mandatory
177ebfedea0SLionel Sambucor match the CA certificate. Check out the B<POLICY FORMAT> section
178ebfedea0SLionel Sambucfor more information.
179ebfedea0SLionel Sambuc
180ebfedea0SLionel Sambuc=item B<-msie_hack>
181ebfedea0SLionel Sambuc
182ebfedea0SLionel Sambucthis is a legacy option to make B<ca> work with very old versions of
183ebfedea0SLionel Sambucthe IE certificate enrollment control "certenr3". It used UniversalStrings
184ebfedea0SLionel Sambucfor almost everything. Since the old control has various security bugs
185ebfedea0SLionel Sambucits use is strongly discouraged. The newer control "Xenroll" does not
186ebfedea0SLionel Sambucneed this option.
187ebfedea0SLionel Sambuc
188ebfedea0SLionel Sambuc=item B<-preserveDN>
189ebfedea0SLionel Sambuc
190ebfedea0SLionel SambucNormally the DN order of a certificate is the same as the order of the
191ebfedea0SLionel Sambucfields in the relevant policy section. When this option is set the order
192ebfedea0SLionel Sambucis the same as the request. This is largely for compatibility with the
193ebfedea0SLionel Sambucolder IE enrollment control which would only accept certificates if their
194ebfedea0SLionel SambucDNs match the order of the request. This is not needed for Xenroll.
195ebfedea0SLionel Sambuc
196ebfedea0SLionel Sambuc=item B<-noemailDN>
197ebfedea0SLionel Sambuc
198ebfedea0SLionel SambucThe DN of a certificate can contain the EMAIL field if present in the
199ebfedea0SLionel Sambucrequest DN, however it is good policy just having the e-mail set into
200ebfedea0SLionel Sambucthe altName extension of the certificate. When this option is set the
201ebfedea0SLionel SambucEMAIL field is removed from the certificate' subject and set only in
202ebfedea0SLionel Sambucthe, eventually present, extensions. The B<email_in_dn> keyword can be
203ebfedea0SLionel Sambucused in the configuration file to enable this behaviour.
204ebfedea0SLionel Sambuc
205ebfedea0SLionel Sambuc=item B<-batch>
206ebfedea0SLionel Sambuc
207ebfedea0SLionel Sambucthis sets the batch mode. In this mode no questions will be asked
208ebfedea0SLionel Sambucand all certificates will be certified automatically.
209ebfedea0SLionel Sambuc
210ebfedea0SLionel Sambuc=item B<-extensions section>
211ebfedea0SLionel Sambuc
212ebfedea0SLionel Sambucthe section of the configuration file containing certificate extensions
213ebfedea0SLionel Sambucto be added when a certificate is issued (defaults to B<x509_extensions>
214ebfedea0SLionel Sambucunless the B<-extfile> option is used). If no extension section is
215ebfedea0SLionel Sambucpresent then, a V1 certificate is created. If the extension section
216ebfedea0SLionel Sambucis present (even if it is empty), then a V3 certificate is created. See the:w
217ebfedea0SLionel SambucL<x509v3_config(5)|x509v3_config(5)> manual page for details of the
218ebfedea0SLionel Sambucextension section format.
219ebfedea0SLionel Sambuc
220ebfedea0SLionel Sambuc=item B<-extfile file>
221ebfedea0SLionel Sambuc
222ebfedea0SLionel Sambucan additional configuration file to read certificate extensions from
223ebfedea0SLionel Sambuc(using the default section unless the B<-extensions> option is also
224ebfedea0SLionel Sambucused).
225ebfedea0SLionel Sambuc
226ebfedea0SLionel Sambuc=item B<-engine id>
227ebfedea0SLionel Sambuc
228ebfedea0SLionel Sambucspecifying an engine (by its unique B<id> string) will cause B<ca>
229ebfedea0SLionel Sambucto attempt to obtain a functional reference to the specified engine,
230ebfedea0SLionel Sambucthus initialising it if needed. The engine will then be set as the default
231ebfedea0SLionel Sambucfor all available algorithms.
232ebfedea0SLionel Sambuc
233ebfedea0SLionel Sambuc=item B<-subj arg>
234ebfedea0SLionel Sambuc
235ebfedea0SLionel Sambucsupersedes subject name given in the request.
236ebfedea0SLionel SambucThe arg must be formatted as I</type0=value0/type1=value1/type2=...>,
237ebfedea0SLionel Sambuccharacters may be escaped by \ (backslash), no spaces are skipped.
238ebfedea0SLionel Sambuc
239ebfedea0SLionel Sambuc=item B<-utf8>
240ebfedea0SLionel Sambuc
241ebfedea0SLionel Sambucthis option causes field values to be interpreted as UTF8 strings, by
242ebfedea0SLionel Sambucdefault they are interpreted as ASCII. This means that the field
243ebfedea0SLionel Sambucvalues, whether prompted from a terminal or obtained from a
244ebfedea0SLionel Sambucconfiguration file, must be valid UTF8 strings.
245ebfedea0SLionel Sambuc
246ebfedea0SLionel Sambuc=item B<-multivalue-rdn>
247ebfedea0SLionel Sambuc
248ebfedea0SLionel Sambucthis option causes the -subj argument to be interpretedt with full
249ebfedea0SLionel Sambucsupport for multivalued RDNs. Example:
250ebfedea0SLionel Sambuc
251ebfedea0SLionel SambucI</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe>
252ebfedea0SLionel Sambuc
253ebfedea0SLionel SambucIf -multi-rdn is not used then the UID value is I<123456+CN=John Doe>.
254ebfedea0SLionel Sambuc
255ebfedea0SLionel Sambuc=back
256ebfedea0SLionel Sambuc
257ebfedea0SLionel Sambuc=head1 CRL OPTIONS
258ebfedea0SLionel Sambuc
259ebfedea0SLionel Sambuc=over 4
260ebfedea0SLionel Sambuc
261ebfedea0SLionel Sambuc=item B<-gencrl>
262ebfedea0SLionel Sambuc
263ebfedea0SLionel Sambucthis option generates a CRL based on information in the index file.
264ebfedea0SLionel Sambuc
265ebfedea0SLionel Sambuc=item B<-crldays num>
266ebfedea0SLionel Sambuc
267ebfedea0SLionel Sambucthe number of days before the next CRL is due. That is the days from
268ebfedea0SLionel Sambucnow to place in the CRL nextUpdate field.
269ebfedea0SLionel Sambuc
270ebfedea0SLionel Sambuc=item B<-crlhours num>
271ebfedea0SLionel Sambuc
272ebfedea0SLionel Sambucthe number of hours before the next CRL is due.
273ebfedea0SLionel Sambuc
274ebfedea0SLionel Sambuc=item B<-revoke filename>
275ebfedea0SLionel Sambuc
276ebfedea0SLionel Sambuca filename containing a certificate to revoke.
277ebfedea0SLionel Sambuc
278*0a6a1f1dSLionel Sambuc=item B<-status serial>
279*0a6a1f1dSLionel Sambuc
280*0a6a1f1dSLionel Sambucdisplays the revocation status of the certificate with the specified
281*0a6a1f1dSLionel Sambucserial number and exits.
282*0a6a1f1dSLionel Sambuc
283*0a6a1f1dSLionel Sambuc=item B<-updatedb>
284*0a6a1f1dSLionel Sambuc
285*0a6a1f1dSLionel SambucUpdates the database index to purge expired certificates.
286*0a6a1f1dSLionel Sambuc
287ebfedea0SLionel Sambuc=item B<-crl_reason reason>
288ebfedea0SLionel Sambuc
289ebfedea0SLionel Sambucrevocation reason, where B<reason> is one of: B<unspecified>, B<keyCompromise>,
290ebfedea0SLionel SambucB<CACompromise>, B<affiliationChanged>, B<superseded>, B<cessationOfOperation>,
291ebfedea0SLionel SambucB<certificateHold> or B<removeFromCRL>. The matching of B<reason> is case
292ebfedea0SLionel Sambucinsensitive. Setting any revocation reason will make the CRL v2.
293ebfedea0SLionel Sambuc
294ebfedea0SLionel SambucIn practive B<removeFromCRL> is not particularly useful because it is only used
295ebfedea0SLionel Sambucin delta CRLs which are not currently implemented.
296ebfedea0SLionel Sambuc
297ebfedea0SLionel Sambuc=item B<-crl_hold instruction>
298ebfedea0SLionel Sambuc
299ebfedea0SLionel SambucThis sets the CRL revocation reason code to B<certificateHold> and the hold
300ebfedea0SLionel Sambucinstruction to B<instruction> which must be an OID. Although any OID can be
301ebfedea0SLionel Sambucused only B<holdInstructionNone> (the use of which is discouraged by RFC2459)
302ebfedea0SLionel SambucB<holdInstructionCallIssuer> or B<holdInstructionReject> will normally be used.
303ebfedea0SLionel Sambuc
304ebfedea0SLionel Sambuc=item B<-crl_compromise time>
305ebfedea0SLionel Sambuc
306ebfedea0SLionel SambucThis sets the revocation reason to B<keyCompromise> and the compromise time to
307ebfedea0SLionel SambucB<time>. B<time> should be in GeneralizedTime format that is B<YYYYMMDDHHMMSSZ>.
308ebfedea0SLionel Sambuc
309ebfedea0SLionel Sambuc=item B<-crl_CA_compromise time>
310ebfedea0SLionel Sambuc
311ebfedea0SLionel SambucThis is the same as B<crl_compromise> except the revocation reason is set to
312ebfedea0SLionel SambucB<CACompromise>.
313ebfedea0SLionel Sambuc
314ebfedea0SLionel Sambuc=item B<-crlexts section>
315ebfedea0SLionel Sambuc
316ebfedea0SLionel Sambucthe section of the configuration file containing CRL extensions to
317ebfedea0SLionel Sambucinclude. If no CRL extension section is present then a V1 CRL is
318ebfedea0SLionel Sambuccreated, if the CRL extension section is present (even if it is
319ebfedea0SLionel Sambucempty) then a V2 CRL is created. The CRL extensions specified are
320ebfedea0SLionel SambucCRL extensions and B<not> CRL entry extensions.  It should be noted
321ebfedea0SLionel Sambucthat some software (for example Netscape) can't handle V2 CRLs. See
322ebfedea0SLionel SambucL<x509v3_config(5)|x509v3_config(5)> manual page for details of the
323ebfedea0SLionel Sambucextension section format.
324ebfedea0SLionel Sambuc
325ebfedea0SLionel Sambuc=back
326ebfedea0SLionel Sambuc
327ebfedea0SLionel Sambuc=head1 CONFIGURATION FILE OPTIONS
328ebfedea0SLionel Sambuc
329ebfedea0SLionel SambucThe section of the configuration file containing options for B<ca>
330ebfedea0SLionel Sambucis found as follows: If the B<-name> command line option is used,
331ebfedea0SLionel Sambucthen it names the section to be used. Otherwise the section to
332ebfedea0SLionel Sambucbe used must be named in the B<default_ca> option of the B<ca> section
333ebfedea0SLionel Sambucof the configuration file (or in the default section of the
334ebfedea0SLionel Sambucconfiguration file). Besides B<default_ca>, the following options are
335ebfedea0SLionel Sambucread directly from the B<ca> section:
336ebfedea0SLionel Sambuc RANDFILE
337ebfedea0SLionel Sambuc preserve
338ebfedea0SLionel Sambuc msie_hack
339ebfedea0SLionel SambucWith the exception of B<RANDFILE>, this is probably a bug and may
340ebfedea0SLionel Sambucchange in future releases.
341ebfedea0SLionel Sambuc
342ebfedea0SLionel SambucMany of the configuration file options are identical to command line
343ebfedea0SLionel Sambucoptions. Where the option is present in the configuration file
344ebfedea0SLionel Sambucand the command line the command line value is used. Where an
345ebfedea0SLionel Sambucoption is described as mandatory then it must be present in
346ebfedea0SLionel Sambucthe configuration file or the command line equivalent (if
347ebfedea0SLionel Sambucany) used.
348ebfedea0SLionel Sambuc
349ebfedea0SLionel Sambuc=over 4
350ebfedea0SLionel Sambuc
351ebfedea0SLionel Sambuc=item B<oid_file>
352ebfedea0SLionel Sambuc
353ebfedea0SLionel SambucThis specifies a file containing additional B<OBJECT IDENTIFIERS>.
354ebfedea0SLionel SambucEach line of the file should consist of the numerical form of the
355ebfedea0SLionel Sambucobject identifier followed by white space then the short name followed
356ebfedea0SLionel Sambucby white space and finally the long name.
357ebfedea0SLionel Sambuc
358ebfedea0SLionel Sambuc=item B<oid_section>
359ebfedea0SLionel Sambuc
360ebfedea0SLionel SambucThis specifies a section in the configuration file containing extra
361ebfedea0SLionel Sambucobject identifiers. Each line should consist of the short name of the
362ebfedea0SLionel Sambucobject identifier followed by B<=> and the numerical form. The short
363ebfedea0SLionel Sambucand long names are the same when this option is used.
364ebfedea0SLionel Sambuc
365ebfedea0SLionel Sambuc=item B<new_certs_dir>
366ebfedea0SLionel Sambuc
367ebfedea0SLionel Sambucthe same as the B<-outdir> command line option. It specifies
368ebfedea0SLionel Sambucthe directory where new certificates will be placed. Mandatory.
369ebfedea0SLionel Sambuc
370ebfedea0SLionel Sambuc=item B<certificate>
371ebfedea0SLionel Sambuc
372ebfedea0SLionel Sambucthe same as B<-cert>. It gives the file containing the CA
373ebfedea0SLionel Sambuccertificate. Mandatory.
374ebfedea0SLionel Sambuc
375ebfedea0SLionel Sambuc=item B<private_key>
376ebfedea0SLionel Sambuc
377ebfedea0SLionel Sambucsame as the B<-keyfile> option. The file containing the
378ebfedea0SLionel SambucCA private key. Mandatory.
379ebfedea0SLionel Sambuc
380ebfedea0SLionel Sambuc=item B<RANDFILE>
381ebfedea0SLionel Sambuc
382ebfedea0SLionel Sambuca file used to read and write random number seed information, or
383ebfedea0SLionel Sambucan EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
384ebfedea0SLionel Sambuc
385ebfedea0SLionel Sambuc=item B<default_days>
386ebfedea0SLionel Sambuc
387ebfedea0SLionel Sambucthe same as the B<-days> option. The number of days to certify
388ebfedea0SLionel Sambuca certificate for.
389ebfedea0SLionel Sambuc
390ebfedea0SLionel Sambuc=item B<default_startdate>
391ebfedea0SLionel Sambuc
392ebfedea0SLionel Sambucthe same as the B<-startdate> option. The start date to certify
393ebfedea0SLionel Sambuca certificate for. If not set the current time is used.
394ebfedea0SLionel Sambuc
395ebfedea0SLionel Sambuc=item B<default_enddate>
396ebfedea0SLionel Sambuc
397ebfedea0SLionel Sambucthe same as the B<-enddate> option. Either this option or
398ebfedea0SLionel SambucB<default_days> (or the command line equivalents) must be
399ebfedea0SLionel Sambucpresent.
400ebfedea0SLionel Sambuc
401ebfedea0SLionel Sambuc=item B<default_crl_hours default_crl_days>
402ebfedea0SLionel Sambuc
403ebfedea0SLionel Sambucthe same as the B<-crlhours> and the B<-crldays> options. These
404ebfedea0SLionel Sambucwill only be used if neither command line option is present. At
405ebfedea0SLionel Sambucleast one of these must be present to generate a CRL.
406ebfedea0SLionel Sambuc
407ebfedea0SLionel Sambuc=item B<default_md>
408ebfedea0SLionel Sambuc
409ebfedea0SLionel Sambucthe same as the B<-md> option. The message digest to use. Mandatory.
410ebfedea0SLionel Sambuc
411ebfedea0SLionel Sambuc=item B<database>
412ebfedea0SLionel Sambuc
413ebfedea0SLionel Sambucthe text database file to use. Mandatory. This file must be present
414ebfedea0SLionel Sambucthough initially it will be empty.
415ebfedea0SLionel Sambuc
416ebfedea0SLionel Sambuc=item B<unique_subject>
417ebfedea0SLionel Sambuc
418ebfedea0SLionel Sambucif the value B<yes> is given, the valid certificate entries in the
419ebfedea0SLionel Sambucdatabase must have unique subjects.  if the value B<no> is given,
420ebfedea0SLionel Sambucseveral valid certificate entries may have the exact same subject.
421ebfedea0SLionel SambucThe default value is B<yes>, to be compatible with older (pre 0.9.8)
422ebfedea0SLionel Sambucversions of OpenSSL.  However, to make CA certificate roll-over easier,
423ebfedea0SLionel Sambucit's recommended to use the value B<no>, especially if combined with
424ebfedea0SLionel Sambucthe B<-selfsign> command line option.
425ebfedea0SLionel Sambuc
426ebfedea0SLionel Sambuc=item B<serial>
427ebfedea0SLionel Sambuc
428ebfedea0SLionel Sambuca text file containing the next serial number to use in hex. Mandatory.
429ebfedea0SLionel SambucThis file must be present and contain a valid serial number.
430ebfedea0SLionel Sambuc
431ebfedea0SLionel Sambuc=item B<crlnumber>
432ebfedea0SLionel Sambuc
433ebfedea0SLionel Sambuca text file containing the next CRL number to use in hex. The crl number
434ebfedea0SLionel Sambucwill be inserted in the CRLs only if this file exists. If this file is
435ebfedea0SLionel Sambucpresent, it must contain a valid CRL number.
436ebfedea0SLionel Sambuc
437ebfedea0SLionel Sambuc=item B<x509_extensions>
438ebfedea0SLionel Sambuc
439ebfedea0SLionel Sambucthe same as B<-extensions>.
440ebfedea0SLionel Sambuc
441ebfedea0SLionel Sambuc=item B<crl_extensions>
442ebfedea0SLionel Sambuc
443ebfedea0SLionel Sambucthe same as B<-crlexts>.
444ebfedea0SLionel Sambuc
445ebfedea0SLionel Sambuc=item B<preserve>
446ebfedea0SLionel Sambuc
447ebfedea0SLionel Sambucthe same as B<-preserveDN>
448ebfedea0SLionel Sambuc
449ebfedea0SLionel Sambuc=item B<email_in_dn>
450ebfedea0SLionel Sambuc
451ebfedea0SLionel Sambucthe same as B<-noemailDN>. If you want the EMAIL field to be removed
452ebfedea0SLionel Sambucfrom the DN of the certificate simply set this to 'no'. If not present
453ebfedea0SLionel Sambucthe default is to allow for the EMAIL filed in the certificate's DN.
454ebfedea0SLionel Sambuc
455ebfedea0SLionel Sambuc=item B<msie_hack>
456ebfedea0SLionel Sambuc
457ebfedea0SLionel Sambucthe same as B<-msie_hack>
458ebfedea0SLionel Sambuc
459ebfedea0SLionel Sambuc=item B<policy>
460ebfedea0SLionel Sambuc
461ebfedea0SLionel Sambucthe same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section
462ebfedea0SLionel Sambucfor more information.
463ebfedea0SLionel Sambuc
464ebfedea0SLionel Sambuc=item B<name_opt>, B<cert_opt>
465ebfedea0SLionel Sambuc
466ebfedea0SLionel Sambucthese options allow the format used to display the certificate details
467ebfedea0SLionel Sambucwhen asking the user to confirm signing. All the options supported by
468ebfedea0SLionel Sambucthe B<x509> utilities B<-nameopt> and B<-certopt> switches can be used
469ebfedea0SLionel Sambuchere, except the B<no_signame> and B<no_sigdump> are permanently set
470ebfedea0SLionel Sambucand cannot be disabled (this is because the certificate signature cannot
471ebfedea0SLionel Sambucbe displayed because the certificate has not been signed at this point).
472ebfedea0SLionel Sambuc
473ebfedea0SLionel SambucFor convenience the values B<ca_default> are accepted by both to produce
474ebfedea0SLionel Sambuca reasonable output.
475ebfedea0SLionel Sambuc
476ebfedea0SLionel SambucIf neither option is present the format used in earlier versions of
477ebfedea0SLionel SambucOpenSSL is used. Use of the old format is B<strongly> discouraged because
478ebfedea0SLionel Sambucit only displays fields mentioned in the B<policy> section, mishandles
479ebfedea0SLionel Sambucmulticharacter string types and does not display extensions.
480ebfedea0SLionel Sambuc
481ebfedea0SLionel Sambuc=item B<copy_extensions>
482ebfedea0SLionel Sambuc
483ebfedea0SLionel Sambucdetermines how extensions in certificate requests should be handled.
484ebfedea0SLionel SambucIf set to B<none> or this option is not present then extensions are
485ebfedea0SLionel Sambucignored and not copied to the certificate. If set to B<copy> then any
486ebfedea0SLionel Sambucextensions present in the request that are not already present are copied
487ebfedea0SLionel Sambucto the certificate. If set to B<copyall> then all extensions in the
488ebfedea0SLionel Sambucrequest are copied to the certificate: if the extension is already present
489ebfedea0SLionel Sambucin the certificate it is deleted first. See the B<WARNINGS> section before
490ebfedea0SLionel Sambucusing this option.
491ebfedea0SLionel Sambuc
492ebfedea0SLionel SambucThe main use of this option is to allow a certificate request to supply
493ebfedea0SLionel Sambucvalues for certain extensions such as subjectAltName.
494ebfedea0SLionel Sambuc
495ebfedea0SLionel Sambuc=back
496ebfedea0SLionel Sambuc
497ebfedea0SLionel Sambuc=head1 POLICY FORMAT
498ebfedea0SLionel Sambuc
499ebfedea0SLionel SambucThe policy section consists of a set of variables corresponding to
500ebfedea0SLionel Sambuccertificate DN fields. If the value is "match" then the field value
501ebfedea0SLionel Sambucmust match the same field in the CA certificate. If the value is
502ebfedea0SLionel Sambuc"supplied" then it must be present. If the value is "optional" then
503ebfedea0SLionel Sambucit may be present. Any fields not mentioned in the policy section
504ebfedea0SLionel Sambucare silently deleted, unless the B<-preserveDN> option is set but
505ebfedea0SLionel Sambucthis can be regarded more of a quirk than intended behaviour.
506ebfedea0SLionel Sambuc
507ebfedea0SLionel Sambuc=head1 SPKAC FORMAT
508ebfedea0SLionel Sambuc
509ebfedea0SLionel SambucThe input to the B<-spkac> command line option is a Netscape
510ebfedea0SLionel Sambucsigned public key and challenge. This will usually come from
511ebfedea0SLionel Sambucthe B<KEYGEN> tag in an HTML form to create a new private key.
512ebfedea0SLionel SambucIt is however possible to create SPKACs using the B<spkac> utility.
513ebfedea0SLionel Sambuc
514ebfedea0SLionel SambucThe file should contain the variable SPKAC set to the value of
515ebfedea0SLionel Sambucthe SPKAC and also the required DN components as name value pairs.
516ebfedea0SLionel SambucIf you need to include the same component twice then it can be
517ebfedea0SLionel Sambucpreceded by a number and a '.'.
518ebfedea0SLionel Sambuc
519*0a6a1f1dSLionel SambucWhen processing SPKAC format, the output is DER if the B<-out>
520*0a6a1f1dSLionel Sambucflag is used, but PEM format if sending to stdout or the B<-outdir>
521*0a6a1f1dSLionel Sambucflag is used.
522*0a6a1f1dSLionel Sambuc
523ebfedea0SLionel Sambuc=head1 EXAMPLES
524ebfedea0SLionel Sambuc
525ebfedea0SLionel SambucNote: these examples assume that the B<ca> directory structure is
526ebfedea0SLionel Sambucalready set up and the relevant files already exist. This usually
527ebfedea0SLionel Sambucinvolves creating a CA certificate and private key with B<req>, a
528ebfedea0SLionel Sambucserial number file and an empty index file and placing them in
529ebfedea0SLionel Sambucthe relevant directories.
530ebfedea0SLionel Sambuc
531ebfedea0SLionel SambucTo use the sample configuration file below the directories demoCA,
532ebfedea0SLionel SambucdemoCA/private and demoCA/newcerts would be created. The CA
533ebfedea0SLionel Sambuccertificate would be copied to demoCA/cacert.pem and its private
534ebfedea0SLionel Sambuckey to demoCA/private/cakey.pem. A file demoCA/serial would be
535ebfedea0SLionel Sambuccreated containing for example "01" and the empty index file
536ebfedea0SLionel SambucdemoCA/index.txt.
537ebfedea0SLionel Sambuc
538ebfedea0SLionel Sambuc
539ebfedea0SLionel SambucSign a certificate request:
540ebfedea0SLionel Sambuc
541ebfedea0SLionel Sambuc openssl ca -in req.pem -out newcert.pem
542ebfedea0SLionel Sambuc
543ebfedea0SLionel SambucSign a certificate request, using CA extensions:
544ebfedea0SLionel Sambuc
545ebfedea0SLionel Sambuc openssl ca -in req.pem -extensions v3_ca -out newcert.pem
546ebfedea0SLionel Sambuc
547ebfedea0SLionel SambucGenerate a CRL
548ebfedea0SLionel Sambuc
549ebfedea0SLionel Sambuc openssl ca -gencrl -out crl.pem
550ebfedea0SLionel Sambuc
551ebfedea0SLionel SambucSign several requests:
552ebfedea0SLionel Sambuc
553ebfedea0SLionel Sambuc openssl ca -infiles req1.pem req2.pem req3.pem
554ebfedea0SLionel Sambuc
555ebfedea0SLionel SambucCertify a Netscape SPKAC:
556ebfedea0SLionel Sambuc
557ebfedea0SLionel Sambuc openssl ca -spkac spkac.txt
558ebfedea0SLionel Sambuc
559ebfedea0SLionel SambucA sample SPKAC file (the SPKAC line has been truncated for clarity):
560ebfedea0SLionel Sambuc
561ebfedea0SLionel Sambuc SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5
562ebfedea0SLionel Sambuc CN=Steve Test
563ebfedea0SLionel Sambuc emailAddress=steve@openssl.org
564ebfedea0SLionel Sambuc 0.OU=OpenSSL Group
565ebfedea0SLionel Sambuc 1.OU=Another Group
566ebfedea0SLionel Sambuc
567ebfedea0SLionel SambucA sample configuration file with the relevant sections for B<ca>:
568ebfedea0SLionel Sambuc
569ebfedea0SLionel Sambuc [ ca ]
570ebfedea0SLionel Sambuc default_ca      = CA_default            # The default ca section
571ebfedea0SLionel Sambuc
572ebfedea0SLionel Sambuc [ CA_default ]
573ebfedea0SLionel Sambuc
574ebfedea0SLionel Sambuc dir            = ./demoCA              # top dir
575ebfedea0SLionel Sambuc database       = $dir/index.txt        # index file.
576ebfedea0SLionel Sambuc new_certs_dir	= $dir/newcerts         # new certs dir
577ebfedea0SLionel Sambuc
578ebfedea0SLionel Sambuc certificate    = $dir/cacert.pem       # The CA cert
579ebfedea0SLionel Sambuc serial         = $dir/serial           # serial no file
580ebfedea0SLionel Sambuc private_key    = $dir/private/cakey.pem# CA private key
581ebfedea0SLionel Sambuc RANDFILE       = $dir/private/.rand    # random number file
582ebfedea0SLionel Sambuc
583ebfedea0SLionel Sambuc default_days   = 365                   # how long to certify for
584ebfedea0SLionel Sambuc default_crl_days= 30                   # how long before next CRL
585ebfedea0SLionel Sambuc default_md     = md5                   # md to use
586ebfedea0SLionel Sambuc
587ebfedea0SLionel Sambuc policy         = policy_any            # default policy
588ebfedea0SLionel Sambuc email_in_dn    = no                    # Don't add the email into cert DN
589ebfedea0SLionel Sambuc
590ebfedea0SLionel Sambuc name_opt	= ca_default		# Subject name display option
591ebfedea0SLionel Sambuc cert_opt	= ca_default		# Certificate display option
592ebfedea0SLionel Sambuc copy_extensions = none			# Don't copy extensions from request
593ebfedea0SLionel Sambuc
594ebfedea0SLionel Sambuc [ policy_any ]
595ebfedea0SLionel Sambuc countryName            = supplied
596ebfedea0SLionel Sambuc stateOrProvinceName    = optional
597ebfedea0SLionel Sambuc organizationName       = optional
598ebfedea0SLionel Sambuc organizationalUnitName = optional
599ebfedea0SLionel Sambuc commonName             = supplied
600ebfedea0SLionel Sambuc emailAddress           = optional
601ebfedea0SLionel Sambuc
602ebfedea0SLionel Sambuc=head1 FILES
603ebfedea0SLionel Sambuc
604ebfedea0SLionel SambucNote: the location of all files can change either by compile time options,
605ebfedea0SLionel Sambucconfiguration file entries, environment variables or command line options.
606ebfedea0SLionel SambucThe values below reflect the default values.
607ebfedea0SLionel Sambuc
608ebfedea0SLionel Sambuc /usr/local/ssl/lib/openssl.cnf - master configuration file
609ebfedea0SLionel Sambuc ./demoCA                       - main CA directory
610ebfedea0SLionel Sambuc ./demoCA/cacert.pem            - CA certificate
611ebfedea0SLionel Sambuc ./demoCA/private/cakey.pem     - CA private key
612ebfedea0SLionel Sambuc ./demoCA/serial                - CA serial number file
613ebfedea0SLionel Sambuc ./demoCA/serial.old            - CA serial number backup file
614ebfedea0SLionel Sambuc ./demoCA/index.txt             - CA text database file
615ebfedea0SLionel Sambuc ./demoCA/index.txt.old         - CA text database backup file
616ebfedea0SLionel Sambuc ./demoCA/certs                 - certificate output file
617ebfedea0SLionel Sambuc ./demoCA/.rnd                  - CA random seed information
618ebfedea0SLionel Sambuc
619ebfedea0SLionel Sambuc=head1 ENVIRONMENT VARIABLES
620ebfedea0SLionel Sambuc
621ebfedea0SLionel SambucB<OPENSSL_CONF> reflects the location of master configuration file it can
622ebfedea0SLionel Sambucbe overridden by the B<-config> command line option.
623ebfedea0SLionel Sambuc
624ebfedea0SLionel Sambuc=head1 RESTRICTIONS
625ebfedea0SLionel Sambuc
626ebfedea0SLionel SambucThe text database index file is a critical part of the process and
627ebfedea0SLionel Sambucif corrupted it can be difficult to fix. It is theoretically possible
628ebfedea0SLionel Sambucto rebuild the index file from all the issued certificates and a current
629ebfedea0SLionel SambucCRL: however there is no option to do this.
630ebfedea0SLionel Sambuc
631ebfedea0SLionel SambucV2 CRL features like delta CRLs are not currently supported.
632ebfedea0SLionel Sambuc
633ebfedea0SLionel SambucAlthough several requests can be input and handled at once it is only
634ebfedea0SLionel Sambucpossible to include one SPKAC or self signed certificate.
635ebfedea0SLionel Sambuc
636ebfedea0SLionel Sambuc=head1 BUGS
637ebfedea0SLionel Sambuc
638ebfedea0SLionel SambucThe use of an in memory text database can cause problems when large
639ebfedea0SLionel Sambucnumbers of certificates are present because, as the name implies
640ebfedea0SLionel Sambucthe database has to be kept in memory.
641ebfedea0SLionel Sambuc
642ebfedea0SLionel SambucThe B<ca> command really needs rewriting or the required functionality
643ebfedea0SLionel Sambucexposed at either a command or interface level so a more friendly utility
644ebfedea0SLionel Sambuc(perl script or GUI) can handle things properly. The scripts B<CA.sh> and
645ebfedea0SLionel SambucB<CA.pl> help a little but not very much.
646ebfedea0SLionel Sambuc
647ebfedea0SLionel SambucAny fields in a request that are not present in a policy are silently
648ebfedea0SLionel Sambucdeleted. This does not happen if the B<-preserveDN> option is used. To
649ebfedea0SLionel Sambucenforce the absence of the EMAIL field within the DN, as suggested by
650ebfedea0SLionel SambucRFCs, regardless the contents of the request' subject the B<-noemailDN>
651ebfedea0SLionel Sambucoption can be used. The behaviour should be more friendly and
652ebfedea0SLionel Sambucconfigurable.
653ebfedea0SLionel Sambuc
654ebfedea0SLionel SambucCancelling some commands by refusing to certify a certificate can
655ebfedea0SLionel Sambuccreate an empty file.
656ebfedea0SLionel Sambuc
657ebfedea0SLionel Sambuc=head1 WARNINGS
658ebfedea0SLionel Sambuc
659ebfedea0SLionel SambucThe B<ca> command is quirky and at times downright unfriendly.
660ebfedea0SLionel Sambuc
661ebfedea0SLionel SambucThe B<ca> utility was originally meant as an example of how to do things
662ebfedea0SLionel Sambucin a CA. It was not supposed to be used as a full blown CA itself:
663ebfedea0SLionel Sambucnevertheless some people are using it for this purpose.
664ebfedea0SLionel Sambuc
665ebfedea0SLionel SambucThe B<ca> command is effectively a single user command: no locking is
666ebfedea0SLionel Sambucdone on the various files and attempts to run more than one B<ca> command
667ebfedea0SLionel Sambucon the same database can have unpredictable results.
668ebfedea0SLionel Sambuc
669ebfedea0SLionel SambucThe B<copy_extensions> option should be used with caution. If care is
670ebfedea0SLionel Sambucnot taken then it can be a security risk. For example if a certificate
671ebfedea0SLionel Sambucrequest contains a basicConstraints extension with CA:TRUE and the
672ebfedea0SLionel SambucB<copy_extensions> value is set to B<copyall> and the user does not spot
673ebfedea0SLionel Sambucthis when the certificate is displayed then this will hand the requestor
674ebfedea0SLionel Sambuca valid CA certificate.
675ebfedea0SLionel Sambuc
676ebfedea0SLionel SambucThis situation can be avoided by setting B<copy_extensions> to B<copy>
677ebfedea0SLionel Sambucand including basicConstraints with CA:FALSE in the configuration file.
678ebfedea0SLionel SambucThen if the request contains a basicConstraints extension it will be
679ebfedea0SLionel Sambucignored.
680ebfedea0SLionel Sambuc
681ebfedea0SLionel SambucIt is advisable to also include values for other extensions such
682ebfedea0SLionel Sambucas B<keyUsage> to prevent a request supplying its own values.
683ebfedea0SLionel Sambuc
684ebfedea0SLionel SambucAdditional restrictions can be placed on the CA certificate itself.
685ebfedea0SLionel SambucFor example if the CA certificate has:
686ebfedea0SLionel Sambuc
687ebfedea0SLionel Sambuc basicConstraints = CA:TRUE, pathlen:0
688ebfedea0SLionel Sambuc
689ebfedea0SLionel Sambucthen even if a certificate is issued with CA:TRUE it will not be valid.
690ebfedea0SLionel Sambuc
691ebfedea0SLionel Sambuc=head1 SEE ALSO
692ebfedea0SLionel Sambuc
693ebfedea0SLionel SambucL<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.pl(1)>,
694ebfedea0SLionel SambucL<config(5)|config(5)>, L<x509v3_config(5)|x509v3_config(5)>
695ebfedea0SLionel Sambuc
696ebfedea0SLionel Sambuc=cut
697