Local adjustments for OpenSSL-1.0.1p.
[dragonfly.git] / secure / usr.bin / openssl / man / req.1
1 .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
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 turned on, 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 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{
60 .    if \nF \{
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "REQ 1"
136 .TH REQ 1 "2015-07-09" "1.0.1p" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 req \- PKCS#10 certificate request and certificate generating utility.
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 \&\fBopenssl\fR \fBreq\fR
146 [\fB\-inform PEM|DER\fR]
147 [\fB\-outform PEM|DER\fR]
148 [\fB\-in filename\fR]
149 [\fB\-passin arg\fR]
150 [\fB\-out filename\fR]
151 [\fB\-passout arg\fR]
152 [\fB\-text\fR]
153 [\fB\-pubkey\fR]
154 [\fB\-noout\fR]
155 [\fB\-verify\fR]
156 [\fB\-modulus\fR]
157 [\fB\-new\fR]
158 [\fB\-rand file(s)\fR]
159 [\fB\-newkey rsa:bits\fR]
160 [\fB\-newkey alg:file\fR]
161 [\fB\-nodes\fR]
162 [\fB\-key filename\fR]
163 [\fB\-keyform PEM|DER\fR]
164 [\fB\-keyout filename\fR]
165 [\fB\-keygen_engine id\fR]
166 [\fB\-[digest]\fR]
167 [\fB\-config filename\fR]
168 [\fB\-subj arg\fR]
169 [\fB\-multivalue\-rdn\fR]
170 [\fB\-x509\fR]
171 [\fB\-days n\fR]
172 [\fB\-set_serial n\fR]
173 [\fB\-asn1\-kludge\fR]
174 [\fB\-no\-asn1\-kludge\fR]
175 [\fB\-newhdr\fR]
176 [\fB\-extensions section\fR]
177 [\fB\-reqexts section\fR]
178 [\fB\-utf8\fR]
179 [\fB\-nameopt\fR]
180 [\fB\-reqopt\fR]
181 [\fB\-subject\fR]
182 [\fB\-subj arg\fR]
183 [\fB\-batch\fR]
184 [\fB\-verbose\fR]
185 [\fB\-engine id\fR]
186 .SH "DESCRIPTION"
187 .IX Header "DESCRIPTION"
188 The \fBreq\fR command primarily creates and processes certificate requests
189 in PKCS#10 format. It can additionally create self signed certificates
190 for use as root CAs for example.
191 .SH "COMMAND OPTIONS"
192 .IX Header "COMMAND OPTIONS"
193 .IP "\fB\-inform DER|PEM\fR" 4
194 .IX Item "-inform DER|PEM"
195 This specifies the input format. The \fB\s-1DER\s0\fR option uses an \s-1ASN1 DER\s0 encoded
196 form compatible with the PKCS#10. The \fB\s-1PEM\s0\fR form is the default format: it
197 consists of the \fB\s-1DER\s0\fR format base64 encoded with additional header and
198 footer lines.
199 .IP "\fB\-outform DER|PEM\fR" 4
200 .IX Item "-outform DER|PEM"
201 This specifies the output format, the options have the same meaning as the 
202 \&\fB\-inform\fR option.
203 .IP "\fB\-in filename\fR" 4
204 .IX Item "-in filename"
205 This specifies the input filename to read a request from or standard input
206 if this option is not specified. A request is only read if the creation
207 options (\fB\-new\fR and \fB\-newkey\fR) are not specified.
208 .IP "\fB\-passin arg\fR" 4
209 .IX Item "-passin arg"
210 the input file password source. For more information about the format of \fBarg\fR
211 see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
212 .IP "\fB\-out filename\fR" 4
213 .IX Item "-out filename"
214 This specifies the output filename to write to or standard output by
215 default.
216 .IP "\fB\-passout arg\fR" 4
217 .IX Item "-passout arg"
218 the output file password source. For more information about the format of \fBarg\fR
219 see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
220 .IP "\fB\-text\fR" 4
221 .IX Item "-text"
222 prints out the certificate request in text form.
223 .IP "\fB\-subject\fR" 4
224 .IX Item "-subject"
225 prints out the request subject (or certificate subject if \fB\-x509\fR is
226 specified)
227 .IP "\fB\-pubkey\fR" 4
228 .IX Item "-pubkey"
229 outputs the public key.
230 .IP "\fB\-noout\fR" 4
231 .IX Item "-noout"
232 this option prevents output of the encoded version of the request.
233 .IP "\fB\-modulus\fR" 4
234 .IX Item "-modulus"
235 this option prints out the value of the modulus of the public key
236 contained in the request.
237 .IP "\fB\-verify\fR" 4
238 .IX Item "-verify"
239 verifies the signature on the request.
240 .IP "\fB\-new\fR" 4
241 .IX Item "-new"
242 this option generates a new certificate request. It will prompt
243 the user for the relevant field values. The actual fields
244 prompted for and their maximum and minimum sizes are specified
245 in the configuration file and any requested extensions.
246 .Sp
247 If the \fB\-key\fR option is not used it will generate a new \s-1RSA\s0 private
248 key using information specified in the configuration file.
249 .IP "\fB\-subj arg\fR" 4
250 .IX Item "-subj arg"
251 Replaces subject field of input request with specified data and outputs
252 modified request. The arg must be formatted as
253 \&\fI/type0=value0/type1=value1/type2=...\fR,
254 characters may be escaped by \e (backslash), no spaces are skipped.
255 .IP "\fB\-rand file(s)\fR" 4
256 .IX Item "-rand file(s)"
257 a file or files containing random data used to seed the random number
258 generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
259 Multiple files can be specified separated by a OS-dependent character.
260 The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
261 all others.
262 .IP "\fB\-newkey arg\fR" 4
263 .IX Item "-newkey arg"
264 this option creates a new certificate request and a new private
265 key. The argument takes one of several forms. \fBrsa:nbits\fR, where
266 \&\fBnbits\fR is the number of bits, generates an \s-1RSA\s0 key \fBnbits\fR
267 in size. If \fBnbits\fR is omitted, i.e. \fB\-newkey rsa\fR specified,
268 the default key size, specified in the configuration file is used.
269 .Sp
270 All other algorithms support the \fB\-newkey alg:file\fR form, where file may be
271 an algorithm parameter file, created by the \fBgenpkey \-genparam\fR command
272 or and X.509 certificate for a key with approriate algorithm.
273 .Sp
274 \&\fBparam:file\fR generates a key using the parameter file or certificate \fBfile\fR,
275 the algorithm is determined by the parameters. \fBalgname:file\fR use algorithm
276 \&\fBalgname\fR and parameter file \fBfile\fR: the two algorithms must match or an
277 error occurs. \fBalgname\fR just uses algorithm \fBalgname\fR, and parameters,
278 if neccessary should be specified via \fB\-pkeyopt\fR parameter.
279 .Sp
280 \&\fBdsa:filename\fR generates a \s-1DSA\s0 key using the parameters
281 in the file \fBfilename\fR. \fBec:filename\fR generates \s-1EC\s0 key (usable both with
282 \&\s-1ECDSA\s0 or \s-1ECDH\s0 algorithms), \fBgost2001:filename\fR generates \s-1GOST R
283 34.10\-2001\s0 key (requires \fBccgost\fR engine configured in the configuration
284 file). If just \fBgost2001\fR is specified a parameter set should be
285 specified by \fB\-pkeyopt paramset:X\fR
286 .IP "\fB\-pkeyopt opt:value\fR" 4
287 .IX Item "-pkeyopt opt:value"
288 set the public key algorithm option \fBopt\fR to \fBvalue\fR. The precise set of
289 options supported depends on the public key algorithm used and its
290 implementation. See \fB\s-1KEY GENERATION OPTIONS\s0\fR in the \fBgenpkey\fR manual page
291 for more details.
292 .IP "\fB\-key filename\fR" 4
293 .IX Item "-key filename"
294 This specifies the file to read the private key from. It also
295 accepts PKCS#8 format private keys for \s-1PEM\s0 format files.
296 .IP "\fB\-keyform PEM|DER\fR" 4
297 .IX Item "-keyform PEM|DER"
298 the format of the private key file specified in the \fB\-key\fR
299 argument. \s-1PEM\s0 is the default.
300 .IP "\fB\-keyout filename\fR" 4
301 .IX Item "-keyout filename"
302 this gives the filename to write the newly created private key to.
303 If this option is not specified then the filename present in the
304 configuration file is used.
305 .IP "\fB\-nodes\fR" 4
306 .IX Item "-nodes"
307 if this option is specified then if a private key is created it
308 will not be encrypted.
309 .IP "\fB\-[digest]\fR" 4
310 .IX Item "-[digest]"
311 this specifies the message digest to sign the request with (such as
312 \&\fB\-md5\fR, \fB\-sha1\fR). This overrides the digest algorithm specified in
313 the configuration file.
314 .Sp
315 Some public key algorithms may override this choice. For instance, \s-1DSA\s0
316 signatures always use \s-1SHA1, GOST R 34.10\s0 signatures always use
317 \&\s-1GOST R 34.11\-94 \s0(\fB\-md_gost94\fR).
318 .IP "\fB\-config filename\fR" 4
319 .IX Item "-config filename"
320 this allows an alternative configuration file to be specified,
321 this overrides the compile time filename or any specified in
322 the \fB\s-1OPENSSL_CONF\s0\fR environment variable.
323 .IP "\fB\-subj arg\fR" 4
324 .IX Item "-subj arg"
325 sets subject name for new request or supersedes the subject name
326 when processing a request.
327 The arg must be formatted as \fI/type0=value0/type1=value1/type2=...\fR,
328 characters may be escaped by \e (backslash), no spaces are skipped.
329 .IP "\fB\-multivalue\-rdn\fR" 4
330 .IX Item "-multivalue-rdn"
331 this option causes the \-subj argument to be interpreted with full
332 support for multivalued RDNs. Example:
333 .Sp
334 \&\fI/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe\fR
335 .Sp
336 If \-multi\-rdn is not used then the \s-1UID\s0 value is \fI123456+CN=John Doe\fR.
337 .IP "\fB\-x509\fR" 4
338 .IX Item "-x509"
339 this option outputs a self signed certificate instead of a certificate
340 request. This is typically used to generate a test certificate or
341 a self signed root \s-1CA.\s0 The extensions added to the certificate
342 (if any) are specified in the configuration file. Unless specified
343 using the \fBset_serial\fR option \fB0\fR will be used for the serial
344 number.
345 .IP "\fB\-days n\fR" 4
346 .IX Item "-days n"
347 when the \fB\-x509\fR option is being used this specifies the number of
348 days to certify the certificate for. The default is 30 days.
349 .IP "\fB\-set_serial n\fR" 4
350 .IX Item "-set_serial n"
351 serial number to use when outputting a self signed certificate. This
352 may be specified as a decimal value or a hex value if preceded by \fB0x\fR.
353 It is possible to use negative serial numbers but this is not recommended.
354 .IP "\fB\-extensions section\fR" 4
355 .IX Item "-extensions section"
356 .PD 0
357 .IP "\fB\-reqexts section\fR" 4
358 .IX Item "-reqexts section"
359 .PD
360 these options specify alternative sections to include certificate
361 extensions (if the \fB\-x509\fR option is present) or certificate
362 request extensions. This allows several different sections to
363 be used in the same configuration file to specify requests for
364 a variety of purposes.
365 .IP "\fB\-utf8\fR" 4
366 .IX Item "-utf8"
367 this option causes field values to be interpreted as \s-1UTF8\s0 strings, by 
368 default they are interpreted as \s-1ASCII.\s0 This means that the field
369 values, whether prompted from a terminal or obtained from a
370 configuration file, must be valid \s-1UTF8\s0 strings.
371 .IP "\fB\-nameopt option\fR" 4
372 .IX Item "-nameopt option"
373 option which determines how the subject or issuer names are displayed. The
374 \&\fBoption\fR argument can be a single option or multiple options separated by
375 commas.  Alternatively the \fB\-nameopt\fR switch may be used more than once to
376 set multiple options. See the \fIx509\fR\|(1) manual page for details.
377 .IP "\fB\-reqopt\fR" 4
378 .IX Item "-reqopt"
379 customise the output format used with \fB\-text\fR. The \fBoption\fR argument can be
380 a single option or multiple options separated by commas.
381 .Sp
382 See discission of the  \fB\-certopt\fR parameter in the \fBx509\fR
383 command.
384 .IP "\fB\-asn1\-kludge\fR" 4
385 .IX Item "-asn1-kludge"
386 by default the \fBreq\fR command outputs certificate requests containing
387 no attributes in the correct PKCS#10 format. However certain CAs will only
388 accept requests containing no attributes in an invalid form: this
389 option produces this invalid format.
390 .Sp
391 More precisely the \fBAttributes\fR in a PKCS#10 certificate request
392 are defined as a \fB\s-1SET OF\s0 Attribute\fR. They are \fBnot \s-1OPTIONAL\s0\fR so
393 if no attributes are present then they should be encoded as an
394 empty \fB\s-1SET OF\s0\fR. The invalid form does not include the empty
395 \&\fB\s-1SET OF\s0\fR whereas the correct form does.
396 .Sp
397 It should be noted that very few CAs still require the use of this option.
398 .IP "\fB\-no\-asn1\-kludge\fR" 4
399 .IX Item "-no-asn1-kludge"
400 Reverses effect of \fB\-asn1\-kludge\fR
401 .IP "\fB\-newhdr\fR" 4
402 .IX Item "-newhdr"
403 Adds the word \fB\s-1NEW\s0\fR to the \s-1PEM\s0 file header and footer lines on the outputted
404 request. Some software (Netscape certificate server) and some CAs need this.
405 .IP "\fB\-batch\fR" 4
406 .IX Item "-batch"
407 non-interactive mode.
408 .IP "\fB\-verbose\fR" 4
409 .IX Item "-verbose"
410 print extra details about the operations being performed.
411 .IP "\fB\-engine id\fR" 4
412 .IX Item "-engine id"
413 specifying an engine (by its unique \fBid\fR string) will cause \fBreq\fR
414 to attempt to obtain a functional reference to the specified engine,
415 thus initialising it if needed. The engine will then be set as the default
416 for all available algorithms.
417 .IP "\fB\-keygen_engine id\fR" 4
418 .IX Item "-keygen_engine id"
419 specifies an engine (by its unique \fBid\fR string) which would be used
420 for key generation operations.
421 .SH "CONFIGURATION FILE FORMAT"
422 .IX Header "CONFIGURATION FILE FORMAT"
423 The configuration options are specified in the \fBreq\fR section of
424 the configuration file. As with all configuration files if no
425 value is specified in the specific section (i.e. \fBreq\fR) then
426 the initial unnamed or \fBdefault\fR section is searched too.
427 .PP
428 The options available are described in detail below.
429 .IP "\fBinput_password output_password\fR" 4
430 .IX Item "input_password output_password"
431 The passwords for the input private key file (if present) and
432 the output private key file (if one will be created). The
433 command line options \fBpassin\fR and \fBpassout\fR override the
434 configuration file values.
435 .IP "\fBdefault_bits\fR" 4
436 .IX Item "default_bits"
437 This specifies the default key size in bits. If not specified then
438 512 is used. It is used if the \fB\-new\fR option is used. It can be
439 overridden by using the \fB\-newkey\fR option.
440 .IP "\fBdefault_keyfile\fR" 4
441 .IX Item "default_keyfile"
442 This is the default filename to write a private key to. If not
443 specified the key is written to standard output. This can be
444 overridden by the \fB\-keyout\fR option.
445 .IP "\fBoid_file\fR" 4
446 .IX Item "oid_file"
447 This specifies a file containing additional \fB\s-1OBJECT IDENTIFIERS\s0\fR.
448 Each line of the file should consist of the numerical form of the
449 object identifier followed by white space then the short name followed
450 by white space and finally the long name.
451 .IP "\fBoid_section\fR" 4
452 .IX Item "oid_section"
453 This specifies a section in the configuration file containing extra
454 object identifiers. Each line should consist of the short name of the
455 object identifier followed by \fB=\fR and the numerical form. The short
456 and long names are the same when this option is used.
457 .IP "\fB\s-1RANDFILE\s0\fR" 4
458 .IX Item "RANDFILE"
459 This specifies a filename in which random number seed information is
460 placed and read from, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
461 It is used for private key generation.
462 .IP "\fBencrypt_key\fR" 4
463 .IX Item "encrypt_key"
464 If this is set to \fBno\fR then if a private key is generated it is
465 \&\fBnot\fR encrypted. This is equivalent to the \fB\-nodes\fR command line
466 option. For compatibility \fBencrypt_rsa_key\fR is an equivalent option.
467 .IP "\fBdefault_md\fR" 4
468 .IX Item "default_md"
469 This option specifies the digest algorithm to use. Possible values
470 include \fBmd5 sha1 mdc2\fR. If not present then \s-1MD5\s0 is used. This
471 option can be overridden on the command line.
472 .IP "\fBstring_mask\fR" 4
473 .IX Item "string_mask"
474 This option masks out the use of certain string types in certain
475 fields. Most users will not need to change this option.
476 .Sp
477 It can be set to several values \fBdefault\fR which is also the default
478 option uses PrintableStrings, T61Strings and BMPStrings if the 
479 \&\fBpkix\fR value is used then only PrintableStrings and BMPStrings will
480 be used. This follows the \s-1PKIX\s0 recommendation in \s-1RFC2459.\s0 If the
481 \&\fButf8only\fR option is used then only UTF8Strings will be used: this
482 is the \s-1PKIX\s0 recommendation in \s-1RFC2459\s0 after 2003. Finally the \fBnombstr\fR
483 option just uses PrintableStrings and T61Strings: certain software has
484 problems with BMPStrings and UTF8Strings: in particular Netscape.
485 .IP "\fBreq_extensions\fR" 4
486 .IX Item "req_extensions"
487 this specifies the configuration file section containing a list of
488 extensions to add to the certificate request. It can be overridden
489 by the \fB\-reqexts\fR command line switch. See the 
490 \&\fIx509v3_config\fR\|(5) manual page for details of the
491 extension section format.
492 .IP "\fBx509_extensions\fR" 4
493 .IX Item "x509_extensions"
494 this specifies the configuration file section containing a list of
495 extensions to add to certificate generated when the \fB\-x509\fR switch
496 is used. It can be overridden by the \fB\-extensions\fR command line switch.
497 .IP "\fBprompt\fR" 4
498 .IX Item "prompt"
499 if set to the value \fBno\fR this disables prompting of certificate fields
500 and just takes values from the config file directly. It also changes the
501 expected format of the \fBdistinguished_name\fR and \fBattributes\fR sections.
502 .IP "\fButf8\fR" 4
503 .IX Item "utf8"
504 if set to the value \fByes\fR then field values to be interpreted as \s-1UTF8\s0
505 strings, by default they are interpreted as \s-1ASCII.\s0 This means that
506 the field values, whether prompted from a terminal or obtained from a
507 configuration file, must be valid \s-1UTF8\s0 strings.
508 .IP "\fBattributes\fR" 4
509 .IX Item "attributes"
510 this specifies the section containing any request attributes: its format
511 is the same as \fBdistinguished_name\fR. Typically these may contain the
512 challengePassword or unstructuredName types. They are currently ignored
513 by OpenSSL's request signing utilities but some CAs might want them.
514 .IP "\fBdistinguished_name\fR" 4
515 .IX Item "distinguished_name"
516 This specifies the section containing the distinguished name fields to
517 prompt for when generating a certificate or certificate request. The format
518 is described in the next section.
519 .SH "DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT"
520 .IX Header "DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT"
521 There are two separate formats for the distinguished name and attribute
522 sections. If the \fBprompt\fR option is set to \fBno\fR then these sections
523 just consist of field names and values: for example,
524 .PP
525 .Vb 3
526 \& CN=My Name
527 \& OU=My Organization
528 \& emailAddress=someone@somewhere.org
529 .Ve
530 .PP
531 This allows external programs (e.g. \s-1GUI\s0 based) to generate a template file
532 with all the field names and values and just pass it to \fBreq\fR. An example
533 of this kind of configuration file is contained in the \fB\s-1EXAMPLES\s0\fR section.
534 .PP
535 Alternatively if the \fBprompt\fR option is absent or not set to \fBno\fR then the
536 file contains field prompting information. It consists of lines of the form:
537 .PP
538 .Vb 4
539 \& fieldName="prompt"
540 \& fieldName_default="default field value"
541 \& fieldName_min= 2
542 \& fieldName_max= 4
543 .Ve
544 .PP
545 \&\*(L"fieldName\*(R" is the field name being used, for example commonName (or \s-1CN\s0).
546 The \*(L"prompt\*(R" string is used to ask the user to enter the relevant
547 details. If the user enters nothing then the default value is used if no
548 default value is present then the field is omitted. A field can
549 still be omitted if a default value is present if the user just
550 enters the '.' character.
551 .PP
552 The number of characters entered must be between the fieldName_min and
553 fieldName_max limits: there may be additional restrictions based
554 on the field being used (for example countryName can only ever be
555 two characters long and must fit in a PrintableString).
556 .PP
557 Some fields (such as organizationName) can be used more than once
558 in a \s-1DN.\s0 This presents a problem because configuration files will
559 not recognize the same name occurring twice. To avoid this problem
560 if the fieldName contains some characters followed by a full stop
561 they will be ignored. So for example a second organizationName can
562 be input by calling it \*(L"1.organizationName\*(R".
563 .PP
564 The actual permitted field names are any object identifier short or
565 long names. These are compiled into OpenSSL and include the usual
566 values such as commonName, countryName, localityName, organizationName,
567 organizationUnitName, stateOrProvinceName. Additionally emailAddress
568 is include as well as name, surname, givenName initials and dnQualifier.
569 .PP
570 Additional object identifiers can be defined with the \fBoid_file\fR or
571 \&\fBoid_section\fR options in the configuration file. Any additional fields
572 will be treated as though they were a DirectoryString.
573 .SH "EXAMPLES"
574 .IX Header "EXAMPLES"
575 Examine and verify certificate request:
576 .PP
577 .Vb 1
578 \& openssl req \-in req.pem \-text \-verify \-noout
579 .Ve
580 .PP
581 Create a private key and then generate a certificate request from it:
582 .PP
583 .Vb 2
584 \& openssl genrsa \-out key.pem 1024
585 \& openssl req \-new \-key key.pem \-out req.pem
586 .Ve
587 .PP
588 The same but just using req:
589 .PP
590 .Vb 1
591 \& openssl req \-newkey rsa:1024 \-keyout key.pem \-out req.pem
592 .Ve
593 .PP
594 Generate a self signed root certificate:
595 .PP
596 .Vb 1
597 \& openssl req \-x509 \-newkey rsa:1024 \-keyout key.pem \-out req.pem
598 .Ve
599 .PP
600 Example of a file pointed to by the \fBoid_file\fR option:
601 .PP
602 .Vb 2
603 \& 1.2.3.4        shortName       A longer Name
604 \& 1.2.3.6        otherName       Other longer Name
605 .Ve
606 .PP
607 Example of a section pointed to by \fBoid_section\fR making use of variable
608 expansion:
609 .PP
610 .Vb 2
611 \& testoid1=1.2.3.5
612 \& testoid2=${testoid1}.6
613 .Ve
614 .PP
615 Sample configuration file prompting for field values:
616 .PP
617 .Vb 6
618 \& [ req ]
619 \& default_bits           = 1024
620 \& default_keyfile        = privkey.pem
621 \& distinguished_name     = req_distinguished_name
622 \& attributes             = req_attributes
623 \& x509_extensions        = v3_ca
624 \&
625 \& dirstring_type = nobmp
626 \&
627 \& [ req_distinguished_name ]
628 \& countryName                    = Country Name (2 letter code)
629 \& countryName_default            = AU
630 \& countryName_min                = 2
631 \& countryName_max                = 2
632 \&
633 \& localityName                   = Locality Name (eg, city)
634 \&
635 \& organizationalUnitName         = Organizational Unit Name (eg, section)
636 \&
637 \& commonName                     = Common Name (eg, YOUR name)
638 \& commonName_max                 = 64
639 \&
640 \& emailAddress                   = Email Address
641 \& emailAddress_max               = 40
642 \&
643 \& [ req_attributes ]
644 \& challengePassword              = A challenge password
645 \& challengePassword_min          = 4
646 \& challengePassword_max          = 20
647 \&
648 \& [ v3_ca ]
649 \&
650 \& subjectKeyIdentifier=hash
651 \& authorityKeyIdentifier=keyid:always,issuer:always
652 \& basicConstraints = CA:true
653 .Ve
654 .PP
655 Sample configuration containing all field values:
656 .PP
657 .Vb 1
658 \& RANDFILE               = $ENV::HOME/.rnd
659 \&
660 \& [ req ]
661 \& default_bits           = 1024
662 \& default_keyfile        = keyfile.pem
663 \& distinguished_name     = req_distinguished_name
664 \& attributes             = req_attributes
665 \& prompt                 = no
666 \& output_password        = mypass
667 \&
668 \& [ req_distinguished_name ]
669 \& C                      = GB
670 \& ST                     = Test State or Province
671 \& L                      = Test Locality
672 \& O                      = Organization Name
673 \& OU                     = Organizational Unit Name
674 \& CN                     = Common Name
675 \& emailAddress           = test@email.address
676 \&
677 \& [ req_attributes ]
678 \& challengePassword              = A challenge password
679 .Ve
680 .SH "NOTES"
681 .IX Header "NOTES"
682 The header and footer lines in the \fB\s-1PEM\s0\fR format are normally:
683 .PP
684 .Vb 2
685 \& \-\-\-\-\-BEGIN CERTIFICATE REQUEST\-\-\-\-\-
686 \& \-\-\-\-\-END CERTIFICATE REQUEST\-\-\-\-\-
687 .Ve
688 .PP
689 some software (some versions of Netscape certificate server) instead needs:
690 .PP
691 .Vb 2
692 \& \-\-\-\-\-BEGIN NEW CERTIFICATE REQUEST\-\-\-\-\-
693 \& \-\-\-\-\-END NEW CERTIFICATE REQUEST\-\-\-\-\-
694 .Ve
695 .PP
696 which is produced with the \fB\-newhdr\fR option but is otherwise compatible.
697 Either form is accepted transparently on input.
698 .PP
699 The certificate requests generated by \fBXenroll\fR with \s-1MSIE\s0 have extensions
700 added. It includes the \fBkeyUsage\fR extension which determines the type of
701 key (signature only or general purpose) and any additional OIDs entered
702 by the script in an extendedKeyUsage extension.
703 .SH "DIAGNOSTICS"
704 .IX Header "DIAGNOSTICS"
705 The following messages are frequently asked about:
706 .PP
707 .Vb 2
708 \&        Using configuration from /some/path/openssl.cnf
709 \&        Unable to load config info
710 .Ve
711 .PP
712 This is followed some time later by...
713 .PP
714 .Vb 2
715 \&        unable to find \*(Aqdistinguished_name\*(Aq in config
716 \&        problems making Certificate Request
717 .Ve
718 .PP
719 The first error message is the clue: it can't find the configuration
720 file! Certain operations (like examining a certificate request) don't
721 need a configuration file so its use isn't enforced. Generation of
722 certificates or requests however does need a configuration file. This
723 could be regarded as a bug.
724 .PP
725 Another puzzling message is this:
726 .PP
727 .Vb 2
728 \&        Attributes:
729 \&            a0:00
730 .Ve
731 .PP
732 this is displayed when no attributes are present and the request includes
733 the correct empty \fB\s-1SET OF\s0\fR structure (the \s-1DER\s0 encoding of which is 0xa0
734 0x00). If you just see:
735 .PP
736 .Vb 1
737 \&        Attributes:
738 .Ve
739 .PP
740 then the \fB\s-1SET OF\s0\fR is missing and the encoding is technically invalid (but
741 it is tolerated). See the description of the command line option \fB\-asn1\-kludge\fR
742 for more information.
743 .SH "ENVIRONMENT VARIABLES"
744 .IX Header "ENVIRONMENT VARIABLES"
745 The variable \fB\s-1OPENSSL_CONF\s0\fR if defined allows an alternative configuration
746 file location to be specified, it will be overridden by the \fB\-config\fR command
747 line switch if it is present. For compatibility reasons the \fB\s-1SSLEAY_CONF\s0\fR
748 environment variable serves the same purpose but its use is discouraged.
749 .SH "BUGS"
750 .IX Header "BUGS"
751 OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively
752 treats them as \s-1ISO\-8859\-1 \s0(Latin 1), Netscape and \s-1MSIE\s0 have similar behaviour.
753 This can cause problems if you need characters that aren't available in
754 PrintableStrings and you don't want to or can't use BMPStrings.
755 .PP
756 As a consequence of the T61String handling the only correct way to represent
757 accented characters in OpenSSL is to use a BMPString: unfortunately Netscape
758 currently chokes on these. If you have to use accented characters with Netscape
759 and \s-1MSIE\s0 then you currently need to use the invalid T61String form.
760 .PP
761 The current prompting is not very friendly. It doesn't allow you to confirm what
762 you've just entered. Other things like extensions in certificate requests are
763 statically defined in the configuration file. Some of these: like an email
764 address in subjectAltName should be input by the user.
765 .SH "SEE ALSO"
766 .IX Header "SEE ALSO"
767 \&\fIx509\fR\|(1), \fIca\fR\|(1), \fIgenrsa\fR\|(1),
768 \&\fIgendsa\fR\|(1), \fIconfig\fR\|(5),
769 \&\fIx509v3_config\fR\|(5)