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