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