xref: /minix3/crypto/external/bsd/openssl/dist/doc/apps/req.pod (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc
2ebfedea0SLionel Sambuc=pod
3ebfedea0SLionel Sambuc
4ebfedea0SLionel Sambuc=head1 NAME
5ebfedea0SLionel Sambuc
6ebfedea0SLionel Sambucreq - PKCS#10 certificate request and certificate generating utility.
7ebfedea0SLionel Sambuc
8ebfedea0SLionel Sambuc=head1 SYNOPSIS
9ebfedea0SLionel Sambuc
10ebfedea0SLionel SambucB<openssl> B<req>
11ebfedea0SLionel Sambuc[B<-inform PEM|DER>]
12ebfedea0SLionel Sambuc[B<-outform PEM|DER>]
13ebfedea0SLionel Sambuc[B<-in filename>]
14ebfedea0SLionel Sambuc[B<-passin arg>]
15ebfedea0SLionel Sambuc[B<-out filename>]
16ebfedea0SLionel Sambuc[B<-passout arg>]
17ebfedea0SLionel Sambuc[B<-text>]
18ebfedea0SLionel Sambuc[B<-pubkey>]
19ebfedea0SLionel Sambuc[B<-noout>]
20ebfedea0SLionel Sambuc[B<-verify>]
21ebfedea0SLionel Sambuc[B<-modulus>]
22ebfedea0SLionel Sambuc[B<-new>]
23ebfedea0SLionel Sambuc[B<-rand file(s)>]
24ebfedea0SLionel Sambuc[B<-newkey rsa:bits>]
25ebfedea0SLionel Sambuc[B<-newkey alg:file>]
26ebfedea0SLionel Sambuc[B<-nodes>]
27ebfedea0SLionel Sambuc[B<-key filename>]
28ebfedea0SLionel Sambuc[B<-keyform PEM|DER>]
29ebfedea0SLionel Sambuc[B<-keyout filename>]
30ebfedea0SLionel Sambuc[B<-keygen_engine id>]
31ebfedea0SLionel Sambuc[B<-[digest]>]
32ebfedea0SLionel Sambuc[B<-config filename>]
33ebfedea0SLionel Sambuc[B<-subj arg>]
34ebfedea0SLionel Sambuc[B<-multivalue-rdn>]
35ebfedea0SLionel Sambuc[B<-x509>]
36ebfedea0SLionel Sambuc[B<-days n>]
37ebfedea0SLionel Sambuc[B<-set_serial n>]
38ebfedea0SLionel Sambuc[B<-asn1-kludge>]
39ebfedea0SLionel Sambuc[B<-no-asn1-kludge>]
40ebfedea0SLionel Sambuc[B<-newhdr>]
41ebfedea0SLionel Sambuc[B<-extensions section>]
42ebfedea0SLionel Sambuc[B<-reqexts section>]
43ebfedea0SLionel Sambuc[B<-utf8>]
44ebfedea0SLionel Sambuc[B<-nameopt>]
45ebfedea0SLionel Sambuc[B<-reqopt>]
46ebfedea0SLionel Sambuc[B<-subject>]
47ebfedea0SLionel Sambuc[B<-subj arg>]
48ebfedea0SLionel Sambuc[B<-batch>]
49ebfedea0SLionel Sambuc[B<-verbose>]
50ebfedea0SLionel Sambuc[B<-engine id>]
51ebfedea0SLionel Sambuc
52ebfedea0SLionel Sambuc=head1 DESCRIPTION
53ebfedea0SLionel Sambuc
54ebfedea0SLionel SambucThe B<req> command primarily creates and processes certificate requests
55ebfedea0SLionel Sambucin PKCS#10 format. It can additionally create self signed certificates
56ebfedea0SLionel Sambucfor use as root CAs for example.
57ebfedea0SLionel Sambuc
58ebfedea0SLionel Sambuc=head1 COMMAND OPTIONS
59ebfedea0SLionel Sambuc
60ebfedea0SLionel Sambuc=over 4
61ebfedea0SLionel Sambuc
62ebfedea0SLionel Sambuc=item B<-inform DER|PEM>
63ebfedea0SLionel Sambuc
64ebfedea0SLionel SambucThis specifies the input format. The B<DER> option uses an ASN1 DER encoded
65ebfedea0SLionel Sambucform compatible with the PKCS#10. The B<PEM> form is the default format: it
66ebfedea0SLionel Sambucconsists of the B<DER> format base64 encoded with additional header and
67ebfedea0SLionel Sambucfooter lines.
68ebfedea0SLionel Sambuc
69ebfedea0SLionel Sambuc=item B<-outform DER|PEM>
70ebfedea0SLionel Sambuc
71ebfedea0SLionel SambucThis specifies the output format, the options have the same meaning as the
72ebfedea0SLionel SambucB<-inform> option.
73ebfedea0SLionel Sambuc
74ebfedea0SLionel Sambuc=item B<-in filename>
75ebfedea0SLionel Sambuc
76ebfedea0SLionel SambucThis specifies the input filename to read a request from or standard input
77ebfedea0SLionel Sambucif this option is not specified. A request is only read if the creation
78ebfedea0SLionel Sambucoptions (B<-new> and B<-newkey>) are not specified.
79ebfedea0SLionel Sambuc
80ebfedea0SLionel Sambuc=item B<-passin arg>
81ebfedea0SLionel Sambuc
82ebfedea0SLionel Sambucthe input file password source. For more information about the format of B<arg>
83ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
84ebfedea0SLionel Sambuc
85ebfedea0SLionel Sambuc=item B<-out filename>
86ebfedea0SLionel Sambuc
87ebfedea0SLionel SambucThis specifies the output filename to write to or standard output by
88ebfedea0SLionel Sambucdefault.
89ebfedea0SLionel Sambuc
90ebfedea0SLionel Sambuc=item B<-passout arg>
91ebfedea0SLionel Sambuc
92ebfedea0SLionel Sambucthe output file password source. For more information about the format of B<arg>
93ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
94ebfedea0SLionel Sambuc
95ebfedea0SLionel Sambuc=item B<-text>
96ebfedea0SLionel Sambuc
97ebfedea0SLionel Sambucprints out the certificate request in text form.
98ebfedea0SLionel Sambuc
99ebfedea0SLionel Sambuc=item B<-subject>
100ebfedea0SLionel Sambuc
101ebfedea0SLionel Sambucprints out the request subject (or certificate subject if B<-x509> is
102ebfedea0SLionel Sambucspecified)
103ebfedea0SLionel Sambuc
104ebfedea0SLionel Sambuc=item B<-pubkey>
105ebfedea0SLionel Sambuc
106ebfedea0SLionel Sambucoutputs the public key.
107ebfedea0SLionel Sambuc
108ebfedea0SLionel Sambuc=item B<-noout>
109ebfedea0SLionel Sambuc
110ebfedea0SLionel Sambucthis option prevents output of the encoded version of the request.
111ebfedea0SLionel Sambuc
112ebfedea0SLionel Sambuc=item B<-modulus>
113ebfedea0SLionel Sambuc
114ebfedea0SLionel Sambucthis option prints out the value of the modulus of the public key
115ebfedea0SLionel Sambuccontained in the request.
116ebfedea0SLionel Sambuc
117ebfedea0SLionel Sambuc=item B<-verify>
118ebfedea0SLionel Sambuc
119ebfedea0SLionel Sambucverifies the signature on the request.
120ebfedea0SLionel Sambuc
121ebfedea0SLionel Sambuc=item B<-new>
122ebfedea0SLionel Sambuc
123ebfedea0SLionel Sambucthis option generates a new certificate request. It will prompt
124ebfedea0SLionel Sambucthe user for the relevant field values. The actual fields
125ebfedea0SLionel Sambucprompted for and their maximum and minimum sizes are specified
126ebfedea0SLionel Sambucin the configuration file and any requested extensions.
127ebfedea0SLionel Sambuc
128ebfedea0SLionel SambucIf the B<-key> option is not used it will generate a new RSA private
129ebfedea0SLionel Sambuckey using information specified in the configuration file.
130ebfedea0SLionel Sambuc
131ebfedea0SLionel Sambuc=item B<-subj arg>
132ebfedea0SLionel Sambuc
133ebfedea0SLionel SambucReplaces subject field of input request with specified data and outputs
134ebfedea0SLionel Sambucmodified request. The arg must be formatted as
135ebfedea0SLionel SambucI</type0=value0/type1=value1/type2=...>,
136ebfedea0SLionel Sambuccharacters may be escaped by \ (backslash), no spaces are skipped.
137ebfedea0SLionel Sambuc
138ebfedea0SLionel Sambuc=item B<-rand file(s)>
139ebfedea0SLionel Sambuc
140ebfedea0SLionel Sambuca file or files containing random data used to seed the random number
141ebfedea0SLionel Sambucgenerator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
142ebfedea0SLionel SambucMultiple files can be specified separated by a OS-dependent character.
143ebfedea0SLionel SambucThe separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
144ebfedea0SLionel Sambucall others.
145ebfedea0SLionel Sambuc
146ebfedea0SLionel Sambuc=item B<-newkey arg>
147ebfedea0SLionel Sambuc
148ebfedea0SLionel Sambucthis option creates a new certificate request and a new private
149ebfedea0SLionel Sambuckey. The argument takes one of several forms. B<rsa:nbits>, where
150ebfedea0SLionel SambucB<nbits> is the number of bits, generates an RSA key B<nbits>
151ebfedea0SLionel Sambucin size. If B<nbits> is omitted, i.e. B<-newkey rsa> specified,
152ebfedea0SLionel Sambucthe default key size, specified in the configuration file is used.
153ebfedea0SLionel Sambuc
154ebfedea0SLionel SambucAll other algorithms support the B<-newkey alg:file> form, where file may be
155ebfedea0SLionel Sambucan algorithm parameter file, created by the B<genpkey -genparam> command
156ebfedea0SLionel Sambucor and X.509 certificate for a key with approriate algorithm.
157ebfedea0SLionel Sambuc
158ebfedea0SLionel SambucB<param:file> generates a key using the parameter file or certificate B<file>,
159ebfedea0SLionel Sambucthe algorithm is determined by the parameters. B<algname:file> use algorithm
160ebfedea0SLionel SambucB<algname> and parameter file B<file>: the two algorithms must match or an
161ebfedea0SLionel Sambucerror occurs. B<algname> just uses algorithm B<algname>, and parameters,
162ebfedea0SLionel Sambucif neccessary should be specified via B<-pkeyopt> parameter.
163ebfedea0SLionel Sambuc
164ebfedea0SLionel SambucB<dsa:filename> generates a DSA key using the parameters
165ebfedea0SLionel Sambucin the file B<filename>. B<ec:filename> generates EC key (usable both with
166ebfedea0SLionel SambucECDSA or ECDH algorithms), B<gost2001:filename> generates GOST R
167ebfedea0SLionel Sambuc34.10-2001 key (requires B<ccgost> engine configured in the configuration
168ebfedea0SLionel Sambucfile). If just B<gost2001> is specified a parameter set should be
169ebfedea0SLionel Sambucspecified by B<-pkeyopt paramset:X>
170ebfedea0SLionel Sambuc
171ebfedea0SLionel Sambuc
172ebfedea0SLionel Sambuc=item B<-pkeyopt opt:value>
173ebfedea0SLionel Sambuc
174ebfedea0SLionel Sambucset the public key algorithm option B<opt> to B<value>. The precise set of
175ebfedea0SLionel Sambucoptions supported depends on the public key algorithm used and its
176ebfedea0SLionel Sambucimplementation. See B<KEY GENERATION OPTIONS> in the B<genpkey> manual page
177ebfedea0SLionel Sambucfor more details.
178ebfedea0SLionel Sambuc
179ebfedea0SLionel Sambuc=item B<-key filename>
180ebfedea0SLionel Sambuc
181ebfedea0SLionel SambucThis specifies the file to read the private key from. It also
182ebfedea0SLionel Sambucaccepts PKCS#8 format private keys for PEM format files.
183ebfedea0SLionel Sambuc
184ebfedea0SLionel Sambuc=item B<-keyform PEM|DER>
185ebfedea0SLionel Sambuc
186ebfedea0SLionel Sambucthe format of the private key file specified in the B<-key>
187ebfedea0SLionel Sambucargument. PEM is the default.
188ebfedea0SLionel Sambuc
189ebfedea0SLionel Sambuc=item B<-keyout filename>
190ebfedea0SLionel Sambuc
191ebfedea0SLionel Sambucthis gives the filename to write the newly created private key to.
192ebfedea0SLionel SambucIf this option is not specified then the filename present in the
193ebfedea0SLionel Sambucconfiguration file is used.
194ebfedea0SLionel Sambuc
195ebfedea0SLionel Sambuc=item B<-nodes>
196ebfedea0SLionel Sambuc
197ebfedea0SLionel Sambucif this option is specified then if a private key is created it
198ebfedea0SLionel Sambucwill not be encrypted.
199ebfedea0SLionel Sambuc
200ebfedea0SLionel Sambuc=item B<-[digest]>
201ebfedea0SLionel Sambuc
202ebfedea0SLionel Sambucthis specifies the message digest to sign the request with (such as
203ebfedea0SLionel SambucB<-md5>, B<-sha1>). This overrides the digest algorithm specified in
204ebfedea0SLionel Sambucthe configuration file.
205ebfedea0SLionel Sambuc
206ebfedea0SLionel SambucSome public key algorithms may override this choice. For instance, DSA
207ebfedea0SLionel Sambucsignatures always use SHA1, GOST R 34.10 signatures always use
208ebfedea0SLionel SambucGOST R 34.11-94 (B<-md_gost94>).
209ebfedea0SLionel Sambuc
210ebfedea0SLionel Sambuc=item B<-config filename>
211ebfedea0SLionel Sambuc
212ebfedea0SLionel Sambucthis allows an alternative configuration file to be specified,
213ebfedea0SLionel Sambucthis overrides the compile time filename or any specified in
214ebfedea0SLionel Sambucthe B<OPENSSL_CONF> environment variable.
215ebfedea0SLionel Sambuc
216ebfedea0SLionel Sambuc=item B<-subj arg>
217ebfedea0SLionel Sambuc
218ebfedea0SLionel Sambucsets subject name for new request or supersedes the subject name
219ebfedea0SLionel Sambucwhen processing a request.
220ebfedea0SLionel SambucThe arg must be formatted as I</type0=value0/type1=value1/type2=...>,
221ebfedea0SLionel Sambuccharacters may be escaped by \ (backslash), no spaces are skipped.
222ebfedea0SLionel Sambuc
223ebfedea0SLionel Sambuc=item B<-multivalue-rdn>
224ebfedea0SLionel Sambuc
225ebfedea0SLionel Sambucthis option causes the -subj argument to be interpreted with full
226ebfedea0SLionel Sambucsupport for multivalued RDNs. Example:
227ebfedea0SLionel Sambuc
228ebfedea0SLionel SambucI</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe>
229ebfedea0SLionel Sambuc
230ebfedea0SLionel SambucIf -multi-rdn is not used then the UID value is I<123456+CN=John Doe>.
231ebfedea0SLionel Sambuc
232ebfedea0SLionel Sambuc=item B<-x509>
233ebfedea0SLionel Sambuc
234ebfedea0SLionel Sambucthis option outputs a self signed certificate instead of a certificate
235ebfedea0SLionel Sambucrequest. This is typically used to generate a test certificate or
236ebfedea0SLionel Sambuca self signed root CA. The extensions added to the certificate
237ebfedea0SLionel Sambuc(if any) are specified in the configuration file. Unless specified
238ebfedea0SLionel Sambucusing the B<set_serial> option B<0> will be used for the serial
239ebfedea0SLionel Sambucnumber.
240ebfedea0SLionel Sambuc
241ebfedea0SLionel Sambuc=item B<-days n>
242ebfedea0SLionel Sambuc
243ebfedea0SLionel Sambucwhen the B<-x509> option is being used this specifies the number of
244ebfedea0SLionel Sambucdays to certify the certificate for. The default is 30 days.
245ebfedea0SLionel Sambuc
246ebfedea0SLionel Sambuc=item B<-set_serial n>
247ebfedea0SLionel Sambuc
248ebfedea0SLionel Sambucserial number to use when outputting a self signed certificate. This
249ebfedea0SLionel Sambucmay be specified as a decimal value or a hex value if preceded by B<0x>.
250ebfedea0SLionel SambucIt is possible to use negative serial numbers but this is not recommended.
251ebfedea0SLionel Sambuc
252ebfedea0SLionel Sambuc=item B<-extensions section>
253ebfedea0SLionel Sambuc
254ebfedea0SLionel Sambuc=item B<-reqexts section>
255ebfedea0SLionel Sambuc
256ebfedea0SLionel Sambucthese options specify alternative sections to include certificate
257ebfedea0SLionel Sambucextensions (if the B<-x509> option is present) or certificate
258ebfedea0SLionel Sambucrequest extensions. This allows several different sections to
259ebfedea0SLionel Sambucbe used in the same configuration file to specify requests for
260ebfedea0SLionel Sambuca variety of purposes.
261ebfedea0SLionel Sambuc
262ebfedea0SLionel Sambuc=item B<-utf8>
263ebfedea0SLionel Sambuc
264ebfedea0SLionel Sambucthis option causes field values to be interpreted as UTF8 strings, by
265ebfedea0SLionel Sambucdefault they are interpreted as ASCII. This means that the field
266ebfedea0SLionel Sambucvalues, whether prompted from a terminal or obtained from a
267ebfedea0SLionel Sambucconfiguration file, must be valid UTF8 strings.
268ebfedea0SLionel Sambuc
269ebfedea0SLionel Sambuc=item B<-nameopt option>
270ebfedea0SLionel Sambuc
271ebfedea0SLionel Sambucoption which determines how the subject or issuer names are displayed. The
272ebfedea0SLionel SambucB<option> argument can be a single option or multiple options separated by
273ebfedea0SLionel Sambuccommas.  Alternatively the B<-nameopt> switch may be used more than once to
274ebfedea0SLionel Sambucset multiple options. See the L<x509(1)|x509(1)> manual page for details.
275ebfedea0SLionel Sambuc
276ebfedea0SLionel Sambuc=item B<-reqopt>
277ebfedea0SLionel Sambuc
278ebfedea0SLionel Sambuccustomise the output format used with B<-text>. The B<option> argument can be
279ebfedea0SLionel Sambuca single option or multiple options separated by commas.
280ebfedea0SLionel Sambuc
281ebfedea0SLionel SambucSee discission of the  B<-certopt> parameter in the L<B<x509>|x509(1)>
282ebfedea0SLionel Sambuccommand.
283ebfedea0SLionel Sambuc
284ebfedea0SLionel Sambuc
285ebfedea0SLionel Sambuc=item B<-asn1-kludge>
286ebfedea0SLionel Sambuc
287ebfedea0SLionel Sambucby default the B<req> command outputs certificate requests containing
288ebfedea0SLionel Sambucno attributes in the correct PKCS#10 format. However certain CAs will only
289ebfedea0SLionel Sambucaccept requests containing no attributes in an invalid form: this
290ebfedea0SLionel Sambucoption produces this invalid format.
291ebfedea0SLionel Sambuc
292ebfedea0SLionel SambucMore precisely the B<Attributes> in a PKCS#10 certificate request
293ebfedea0SLionel Sambucare defined as a B<SET OF Attribute>. They are B<not OPTIONAL> so
294ebfedea0SLionel Sambucif no attributes are present then they should be encoded as an
295ebfedea0SLionel Sambucempty B<SET OF>. The invalid form does not include the empty
296ebfedea0SLionel SambucB<SET OF> whereas the correct form does.
297ebfedea0SLionel Sambuc
298ebfedea0SLionel SambucIt should be noted that very few CAs still require the use of this option.
299ebfedea0SLionel Sambuc
300ebfedea0SLionel Sambuc=item B<-no-asn1-kludge>
301ebfedea0SLionel Sambuc
302ebfedea0SLionel SambucReverses effect of B<-asn1-kludge>
303ebfedea0SLionel Sambuc
304ebfedea0SLionel Sambuc=item B<-newhdr>
305ebfedea0SLionel Sambuc
306*0a6a1f1dSLionel SambucAdds the word B<NEW> to the PEM file header and footer lines on the outputted
307ebfedea0SLionel Sambucrequest. Some software (Netscape certificate server) and some CAs need this.
308ebfedea0SLionel Sambuc
309ebfedea0SLionel Sambuc=item B<-batch>
310ebfedea0SLionel Sambuc
311ebfedea0SLionel Sambucnon-interactive mode.
312ebfedea0SLionel Sambuc
313ebfedea0SLionel Sambuc=item B<-verbose>
314ebfedea0SLionel Sambuc
315ebfedea0SLionel Sambucprint extra details about the operations being performed.
316ebfedea0SLionel Sambuc
317ebfedea0SLionel Sambuc=item B<-engine id>
318ebfedea0SLionel Sambuc
319ebfedea0SLionel Sambucspecifying an engine (by its unique B<id> string) will cause B<req>
320ebfedea0SLionel Sambucto attempt to obtain a functional reference to the specified engine,
321ebfedea0SLionel Sambucthus initialising it if needed. The engine will then be set as the default
322ebfedea0SLionel Sambucfor all available algorithms.
323ebfedea0SLionel Sambuc
324ebfedea0SLionel Sambuc=item B<-keygen_engine id>
325ebfedea0SLionel Sambuc
326ebfedea0SLionel Sambucspecifies an engine (by its unique B<id> string) which would be used
327ebfedea0SLionel Sambucfor key generation operations.
328ebfedea0SLionel Sambuc
329ebfedea0SLionel Sambuc=back
330ebfedea0SLionel Sambuc
331ebfedea0SLionel Sambuc=head1 CONFIGURATION FILE FORMAT
332ebfedea0SLionel Sambuc
333ebfedea0SLionel SambucThe configuration options are specified in the B<req> section of
334ebfedea0SLionel Sambucthe configuration file. As with all configuration files if no
335ebfedea0SLionel Sambucvalue is specified in the specific section (i.e. B<req>) then
336ebfedea0SLionel Sambucthe initial unnamed or B<default> section is searched too.
337ebfedea0SLionel Sambuc
338ebfedea0SLionel SambucThe options available are described in detail below.
339ebfedea0SLionel Sambuc
340ebfedea0SLionel Sambuc=over 4
341ebfedea0SLionel Sambuc
342ebfedea0SLionel Sambuc=item B<input_password output_password>
343ebfedea0SLionel Sambuc
344ebfedea0SLionel SambucThe passwords for the input private key file (if present) and
345ebfedea0SLionel Sambucthe output private key file (if one will be created). The
346ebfedea0SLionel Sambuccommand line options B<passin> and B<passout> override the
347ebfedea0SLionel Sambucconfiguration file values.
348ebfedea0SLionel Sambuc
349ebfedea0SLionel Sambuc=item B<default_bits>
350ebfedea0SLionel Sambuc
351ebfedea0SLionel SambucThis specifies the default key size in bits. If not specified then
352ebfedea0SLionel Sambuc512 is used. It is used if the B<-new> option is used. It can be
353ebfedea0SLionel Sambucoverridden by using the B<-newkey> option.
354ebfedea0SLionel Sambuc
355ebfedea0SLionel Sambuc=item B<default_keyfile>
356ebfedea0SLionel Sambuc
357ebfedea0SLionel SambucThis is the default filename to write a private key to. If not
358ebfedea0SLionel Sambucspecified the key is written to standard output. This can be
359ebfedea0SLionel Sambucoverridden by the B<-keyout> option.
360ebfedea0SLionel Sambuc
361ebfedea0SLionel Sambuc=item B<oid_file>
362ebfedea0SLionel Sambuc
363ebfedea0SLionel SambucThis specifies a file containing additional B<OBJECT IDENTIFIERS>.
364ebfedea0SLionel SambucEach line of the file should consist of the numerical form of the
365ebfedea0SLionel Sambucobject identifier followed by white space then the short name followed
366ebfedea0SLionel Sambucby white space and finally the long name.
367ebfedea0SLionel Sambuc
368ebfedea0SLionel Sambuc=item B<oid_section>
369ebfedea0SLionel Sambuc
370ebfedea0SLionel SambucThis specifies a section in the configuration file containing extra
371ebfedea0SLionel Sambucobject identifiers. Each line should consist of the short name of the
372ebfedea0SLionel Sambucobject identifier followed by B<=> and the numerical form. The short
373ebfedea0SLionel Sambucand long names are the same when this option is used.
374ebfedea0SLionel Sambuc
375ebfedea0SLionel Sambuc=item B<RANDFILE>
376ebfedea0SLionel Sambuc
377ebfedea0SLionel SambucThis specifies a filename in which random number seed information is
378ebfedea0SLionel Sambucplaced and read from, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
379ebfedea0SLionel SambucIt is used for private key generation.
380ebfedea0SLionel Sambuc
381ebfedea0SLionel Sambuc=item B<encrypt_key>
382ebfedea0SLionel Sambuc
383ebfedea0SLionel SambucIf this is set to B<no> then if a private key is generated it is
384ebfedea0SLionel SambucB<not> encrypted. This is equivalent to the B<-nodes> command line
385ebfedea0SLionel Sambucoption. For compatibility B<encrypt_rsa_key> is an equivalent option.
386ebfedea0SLionel Sambuc
387ebfedea0SLionel Sambuc=item B<default_md>
388ebfedea0SLionel Sambuc
389ebfedea0SLionel SambucThis option specifies the digest algorithm to use. Possible values
390ebfedea0SLionel Sambucinclude B<md5 sha1 mdc2>. If not present then MD5 is used. This
391ebfedea0SLionel Sambucoption can be overridden on the command line.
392ebfedea0SLionel Sambuc
393ebfedea0SLionel Sambuc=item B<string_mask>
394ebfedea0SLionel Sambuc
395ebfedea0SLionel SambucThis option masks out the use of certain string types in certain
396ebfedea0SLionel Sambucfields. Most users will not need to change this option.
397ebfedea0SLionel Sambuc
398ebfedea0SLionel SambucIt can be set to several values B<default> which is also the default
399ebfedea0SLionel Sambucoption uses PrintableStrings, T61Strings and BMPStrings if the
400ebfedea0SLionel SambucB<pkix> value is used then only PrintableStrings and BMPStrings will
401ebfedea0SLionel Sambucbe used. This follows the PKIX recommendation in RFC2459. If the
402ebfedea0SLionel SambucB<utf8only> option is used then only UTF8Strings will be used: this
403ebfedea0SLionel Sambucis the PKIX recommendation in RFC2459 after 2003. Finally the B<nombstr>
404ebfedea0SLionel Sambucoption just uses PrintableStrings and T61Strings: certain software has
405ebfedea0SLionel Sambucproblems with BMPStrings and UTF8Strings: in particular Netscape.
406ebfedea0SLionel Sambuc
407ebfedea0SLionel Sambuc=item B<req_extensions>
408ebfedea0SLionel Sambuc
409ebfedea0SLionel Sambucthis specifies the configuration file section containing a list of
410ebfedea0SLionel Sambucextensions to add to the certificate request. It can be overridden
411ebfedea0SLionel Sambucby the B<-reqexts> command line switch. See the
412ebfedea0SLionel SambucL<x509v3_config(5)|x509v3_config(5)> manual page for details of the
413ebfedea0SLionel Sambucextension section format.
414ebfedea0SLionel Sambuc
415ebfedea0SLionel Sambuc=item B<x509_extensions>
416ebfedea0SLionel Sambuc
417ebfedea0SLionel Sambucthis specifies the configuration file section containing a list of
418ebfedea0SLionel Sambucextensions to add to certificate generated when the B<-x509> switch
419ebfedea0SLionel Sambucis used. It can be overridden by the B<-extensions> command line switch.
420ebfedea0SLionel Sambuc
421ebfedea0SLionel Sambuc=item B<prompt>
422ebfedea0SLionel Sambuc
423ebfedea0SLionel Sambucif set to the value B<no> this disables prompting of certificate fields
424ebfedea0SLionel Sambucand just takes values from the config file directly. It also changes the
425ebfedea0SLionel Sambucexpected format of the B<distinguished_name> and B<attributes> sections.
426ebfedea0SLionel Sambuc
427ebfedea0SLionel Sambuc=item B<utf8>
428ebfedea0SLionel Sambuc
429ebfedea0SLionel Sambucif set to the value B<yes> then field values to be interpreted as UTF8
430ebfedea0SLionel Sambucstrings, by default they are interpreted as ASCII. This means that
431ebfedea0SLionel Sambucthe field values, whether prompted from a terminal or obtained from a
432ebfedea0SLionel Sambucconfiguration file, must be valid UTF8 strings.
433ebfedea0SLionel Sambuc
434ebfedea0SLionel Sambuc=item B<attributes>
435ebfedea0SLionel Sambuc
436ebfedea0SLionel Sambucthis specifies the section containing any request attributes: its format
437ebfedea0SLionel Sambucis the same as B<distinguished_name>. Typically these may contain the
438ebfedea0SLionel SambucchallengePassword or unstructuredName types. They are currently ignored
439ebfedea0SLionel Sambucby OpenSSL's request signing utilities but some CAs might want them.
440ebfedea0SLionel Sambuc
441ebfedea0SLionel Sambuc=item B<distinguished_name>
442ebfedea0SLionel Sambuc
443ebfedea0SLionel SambucThis specifies the section containing the distinguished name fields to
444ebfedea0SLionel Sambucprompt for when generating a certificate or certificate request. The format
445ebfedea0SLionel Sambucis described in the next section.
446ebfedea0SLionel Sambuc
447ebfedea0SLionel Sambuc=back
448ebfedea0SLionel Sambuc
449ebfedea0SLionel Sambuc=head1 DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT
450ebfedea0SLionel Sambuc
451ebfedea0SLionel SambucThere are two separate formats for the distinguished name and attribute
452ebfedea0SLionel Sambucsections. If the B<prompt> option is set to B<no> then these sections
453ebfedea0SLionel Sambucjust consist of field names and values: for example,
454ebfedea0SLionel Sambuc
455ebfedea0SLionel Sambuc CN=My Name
456ebfedea0SLionel Sambuc OU=My Organization
457ebfedea0SLionel Sambuc emailAddress=someone@somewhere.org
458ebfedea0SLionel Sambuc
459ebfedea0SLionel SambucThis allows external programs (e.g. GUI based) to generate a template file
460ebfedea0SLionel Sambucwith all the field names and values and just pass it to B<req>. An example
461ebfedea0SLionel Sambucof this kind of configuration file is contained in the B<EXAMPLES> section.
462ebfedea0SLionel Sambuc
463ebfedea0SLionel SambucAlternatively if the B<prompt> option is absent or not set to B<no> then the
464ebfedea0SLionel Sambucfile contains field prompting information. It consists of lines of the form:
465ebfedea0SLionel Sambuc
466ebfedea0SLionel Sambuc fieldName="prompt"
467ebfedea0SLionel Sambuc fieldName_default="default field value"
468ebfedea0SLionel Sambuc fieldName_min= 2
469ebfedea0SLionel Sambuc fieldName_max= 4
470ebfedea0SLionel Sambuc
471ebfedea0SLionel Sambuc"fieldName" is the field name being used, for example commonName (or CN).
472ebfedea0SLionel SambucThe "prompt" string is used to ask the user to enter the relevant
473ebfedea0SLionel Sambucdetails. If the user enters nothing then the default value is used if no
474ebfedea0SLionel Sambucdefault value is present then the field is omitted. A field can
475ebfedea0SLionel Sambucstill be omitted if a default value is present if the user just
476ebfedea0SLionel Sambucenters the '.' character.
477ebfedea0SLionel Sambuc
478ebfedea0SLionel SambucThe number of characters entered must be between the fieldName_min and
479ebfedea0SLionel SambucfieldName_max limits: there may be additional restrictions based
480ebfedea0SLionel Sambucon the field being used (for example countryName can only ever be
481ebfedea0SLionel Sambuctwo characters long and must fit in a PrintableString).
482ebfedea0SLionel Sambuc
483ebfedea0SLionel SambucSome fields (such as organizationName) can be used more than once
484ebfedea0SLionel Sambucin a DN. This presents a problem because configuration files will
485ebfedea0SLionel Sambucnot recognize the same name occurring twice. To avoid this problem
486ebfedea0SLionel Sambucif the fieldName contains some characters followed by a full stop
487ebfedea0SLionel Sambucthey will be ignored. So for example a second organizationName can
488ebfedea0SLionel Sambucbe input by calling it "1.organizationName".
489ebfedea0SLionel Sambuc
490ebfedea0SLionel SambucThe actual permitted field names are any object identifier short or
491ebfedea0SLionel Sambuclong names. These are compiled into OpenSSL and include the usual
492ebfedea0SLionel Sambucvalues such as commonName, countryName, localityName, organizationName,
493ebfedea0SLionel SambucorganizationUnitName, stateOrProvinceName. Additionally emailAddress
494ebfedea0SLionel Sambucis include as well as name, surname, givenName initials and dnQualifier.
495ebfedea0SLionel Sambuc
496ebfedea0SLionel SambucAdditional object identifiers can be defined with the B<oid_file> or
497ebfedea0SLionel SambucB<oid_section> options in the configuration file. Any additional fields
498ebfedea0SLionel Sambucwill be treated as though they were a DirectoryString.
499ebfedea0SLionel Sambuc
500ebfedea0SLionel Sambuc
501ebfedea0SLionel Sambuc=head1 EXAMPLES
502ebfedea0SLionel Sambuc
503ebfedea0SLionel SambucExamine and verify certificate request:
504ebfedea0SLionel Sambuc
505ebfedea0SLionel Sambuc openssl req -in req.pem -text -verify -noout
506ebfedea0SLionel Sambuc
507ebfedea0SLionel SambucCreate a private key and then generate a certificate request from it:
508ebfedea0SLionel Sambuc
509ebfedea0SLionel Sambuc openssl genrsa -out key.pem 1024
510ebfedea0SLionel Sambuc openssl req -new -key key.pem -out req.pem
511ebfedea0SLionel Sambuc
512ebfedea0SLionel SambucThe same but just using req:
513ebfedea0SLionel Sambuc
514ebfedea0SLionel Sambuc openssl req -newkey rsa:1024 -keyout key.pem -out req.pem
515ebfedea0SLionel Sambuc
516ebfedea0SLionel SambucGenerate a self signed root certificate:
517ebfedea0SLionel Sambuc
518ebfedea0SLionel Sambuc openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem
519ebfedea0SLionel Sambuc
520ebfedea0SLionel SambucExample of a file pointed to by the B<oid_file> option:
521ebfedea0SLionel Sambuc
522ebfedea0SLionel Sambuc 1.2.3.4	shortName	A longer Name
523ebfedea0SLionel Sambuc 1.2.3.6	otherName	Other longer Name
524ebfedea0SLionel Sambuc
525ebfedea0SLionel SambucExample of a section pointed to by B<oid_section> making use of variable
526ebfedea0SLionel Sambucexpansion:
527ebfedea0SLionel Sambuc
528ebfedea0SLionel Sambuc testoid1=1.2.3.5
529ebfedea0SLionel Sambuc testoid2=${testoid1}.6
530ebfedea0SLionel Sambuc
531ebfedea0SLionel SambucSample configuration file prompting for field values:
532ebfedea0SLionel Sambuc
533ebfedea0SLionel Sambuc [ req ]
534ebfedea0SLionel Sambuc default_bits		= 1024
535ebfedea0SLionel Sambuc default_keyfile 	= privkey.pem
536ebfedea0SLionel Sambuc distinguished_name	= req_distinguished_name
537ebfedea0SLionel Sambuc attributes		= req_attributes
538ebfedea0SLionel Sambuc x509_extensions	= v3_ca
539ebfedea0SLionel Sambuc
540ebfedea0SLionel Sambuc dirstring_type = nobmp
541ebfedea0SLionel Sambuc
542ebfedea0SLionel Sambuc [ req_distinguished_name ]
543ebfedea0SLionel Sambuc countryName			= Country Name (2 letter code)
544ebfedea0SLionel Sambuc countryName_default		= AU
545ebfedea0SLionel Sambuc countryName_min		= 2
546ebfedea0SLionel Sambuc countryName_max		= 2
547ebfedea0SLionel Sambuc
548ebfedea0SLionel Sambuc localityName			= Locality Name (eg, city)
549ebfedea0SLionel Sambuc
550ebfedea0SLionel Sambuc organizationalUnitName		= Organizational Unit Name (eg, section)
551ebfedea0SLionel Sambuc
552ebfedea0SLionel Sambuc commonName			= Common Name (eg, YOUR name)
553ebfedea0SLionel Sambuc commonName_max			= 64
554ebfedea0SLionel Sambuc
555ebfedea0SLionel Sambuc emailAddress			= Email Address
556ebfedea0SLionel Sambuc emailAddress_max		= 40
557ebfedea0SLionel Sambuc
558ebfedea0SLionel Sambuc [ req_attributes ]
559ebfedea0SLionel Sambuc challengePassword		= A challenge password
560ebfedea0SLionel Sambuc challengePassword_min		= 4
561ebfedea0SLionel Sambuc challengePassword_max		= 20
562ebfedea0SLionel Sambuc
563ebfedea0SLionel Sambuc [ v3_ca ]
564ebfedea0SLionel Sambuc
565ebfedea0SLionel Sambuc subjectKeyIdentifier=hash
566ebfedea0SLionel Sambuc authorityKeyIdentifier=keyid:always,issuer:always
567ebfedea0SLionel Sambuc basicConstraints = CA:true
568ebfedea0SLionel Sambuc
569ebfedea0SLionel SambucSample configuration containing all field values:
570ebfedea0SLionel Sambuc
571ebfedea0SLionel Sambuc
572ebfedea0SLionel Sambuc RANDFILE		= $ENV::HOME/.rnd
573ebfedea0SLionel Sambuc
574ebfedea0SLionel Sambuc [ req ]
575ebfedea0SLionel Sambuc default_bits		= 1024
576ebfedea0SLionel Sambuc default_keyfile 	= keyfile.pem
577ebfedea0SLionel Sambuc distinguished_name	= req_distinguished_name
578ebfedea0SLionel Sambuc attributes		= req_attributes
579ebfedea0SLionel Sambuc prompt			= no
580ebfedea0SLionel Sambuc output_password	= mypass
581ebfedea0SLionel Sambuc
582ebfedea0SLionel Sambuc [ req_distinguished_name ]
583ebfedea0SLionel Sambuc C			= GB
584ebfedea0SLionel Sambuc ST			= Test State or Province
585ebfedea0SLionel Sambuc L			= Test Locality
586ebfedea0SLionel Sambuc O			= Organization Name
587ebfedea0SLionel Sambuc OU			= Organizational Unit Name
588ebfedea0SLionel Sambuc CN			= Common Name
589ebfedea0SLionel Sambuc emailAddress		= test@email.address
590ebfedea0SLionel Sambuc
591ebfedea0SLionel Sambuc [ req_attributes ]
592ebfedea0SLionel Sambuc challengePassword		= A challenge password
593ebfedea0SLionel Sambuc
594ebfedea0SLionel Sambuc
595ebfedea0SLionel Sambuc=head1 NOTES
596ebfedea0SLionel Sambuc
597ebfedea0SLionel SambucThe header and footer lines in the B<PEM> format are normally:
598ebfedea0SLionel Sambuc
599ebfedea0SLionel Sambuc -----BEGIN CERTIFICATE REQUEST-----
600ebfedea0SLionel Sambuc -----END CERTIFICATE REQUEST-----
601ebfedea0SLionel Sambuc
602ebfedea0SLionel Sambucsome software (some versions of Netscape certificate server) instead needs:
603ebfedea0SLionel Sambuc
604ebfedea0SLionel Sambuc -----BEGIN NEW CERTIFICATE REQUEST-----
605ebfedea0SLionel Sambuc -----END NEW CERTIFICATE REQUEST-----
606ebfedea0SLionel Sambuc
607ebfedea0SLionel Sambucwhich is produced with the B<-newhdr> option but is otherwise compatible.
608ebfedea0SLionel SambucEither form is accepted transparently on input.
609ebfedea0SLionel Sambuc
610ebfedea0SLionel SambucThe certificate requests generated by B<Xenroll> with MSIE have extensions
611ebfedea0SLionel Sambucadded. It includes the B<keyUsage> extension which determines the type of
612ebfedea0SLionel Sambuckey (signature only or general purpose) and any additional OIDs entered
613ebfedea0SLionel Sambucby the script in an extendedKeyUsage extension.
614ebfedea0SLionel Sambuc
615ebfedea0SLionel Sambuc=head1 DIAGNOSTICS
616ebfedea0SLionel Sambuc
617ebfedea0SLionel SambucThe following messages are frequently asked about:
618ebfedea0SLionel Sambuc
619ebfedea0SLionel Sambuc	Using configuration from /some/path/openssl.cnf
620ebfedea0SLionel Sambuc	Unable to load config info
621ebfedea0SLionel Sambuc
622ebfedea0SLionel SambucThis is followed some time later by...
623ebfedea0SLionel Sambuc
624ebfedea0SLionel Sambuc	unable to find 'distinguished_name' in config
625ebfedea0SLionel Sambuc	problems making Certificate Request
626ebfedea0SLionel Sambuc
627ebfedea0SLionel SambucThe first error message is the clue: it can't find the configuration
628ebfedea0SLionel Sambucfile! Certain operations (like examining a certificate request) don't
629ebfedea0SLionel Sambucneed a configuration file so its use isn't enforced. Generation of
630ebfedea0SLionel Sambuccertificates or requests however does need a configuration file. This
631ebfedea0SLionel Sambuccould be regarded as a bug.
632ebfedea0SLionel Sambuc
633ebfedea0SLionel SambucAnother puzzling message is this:
634ebfedea0SLionel Sambuc
635ebfedea0SLionel Sambuc        Attributes:
636ebfedea0SLionel Sambuc            a0:00
637ebfedea0SLionel Sambuc
638ebfedea0SLionel Sambucthis is displayed when no attributes are present and the request includes
639ebfedea0SLionel Sambucthe correct empty B<SET OF> structure (the DER encoding of which is 0xa0
640ebfedea0SLionel Sambuc0x00). If you just see:
641ebfedea0SLionel Sambuc
642ebfedea0SLionel Sambuc        Attributes:
643ebfedea0SLionel Sambuc
644ebfedea0SLionel Sambucthen the B<SET OF> is missing and the encoding is technically invalid (but
645ebfedea0SLionel Sambucit is tolerated). See the description of the command line option B<-asn1-kludge>
646ebfedea0SLionel Sambucfor more information.
647ebfedea0SLionel Sambuc
648ebfedea0SLionel Sambuc=head1 ENVIRONMENT VARIABLES
649ebfedea0SLionel Sambuc
650ebfedea0SLionel SambucThe variable B<OPENSSL_CONF> if defined allows an alternative configuration
651ebfedea0SLionel Sambucfile location to be specified, it will be overridden by the B<-config> command
652ebfedea0SLionel Sambucline switch if it is present. For compatibility reasons the B<SSLEAY_CONF>
653ebfedea0SLionel Sambucenvironment variable serves the same purpose but its use is discouraged.
654ebfedea0SLionel Sambuc
655ebfedea0SLionel Sambuc=head1 BUGS
656ebfedea0SLionel Sambuc
657ebfedea0SLionel SambucOpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively
658ebfedea0SLionel Sambuctreats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour.
659ebfedea0SLionel SambucThis can cause problems if you need characters that aren't available in
660ebfedea0SLionel SambucPrintableStrings and you don't want to or can't use BMPStrings.
661ebfedea0SLionel Sambuc
662ebfedea0SLionel SambucAs a consequence of the T61String handling the only correct way to represent
663ebfedea0SLionel Sambucaccented characters in OpenSSL is to use a BMPString: unfortunately Netscape
664ebfedea0SLionel Sambuccurrently chokes on these. If you have to use accented characters with Netscape
665ebfedea0SLionel Sambucand MSIE then you currently need to use the invalid T61String form.
666ebfedea0SLionel Sambuc
667ebfedea0SLionel SambucThe current prompting is not very friendly. It doesn't allow you to confirm what
668ebfedea0SLionel Sambucyou've just entered. Other things like extensions in certificate requests are
669ebfedea0SLionel Sambucstatically defined in the configuration file. Some of these: like an email
670ebfedea0SLionel Sambucaddress in subjectAltName should be input by the user.
671ebfedea0SLionel Sambuc
672ebfedea0SLionel Sambuc=head1 SEE ALSO
673ebfedea0SLionel Sambuc
674ebfedea0SLionel SambucL<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
675ebfedea0SLionel SambucL<gendsa(1)|gendsa(1)>, L<config(5)|config(5)>,
676ebfedea0SLionel SambucL<x509v3_config(5)|x509v3_config(5)>
677ebfedea0SLionel Sambuc
678ebfedea0SLionel Sambuc=cut
679