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