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