req.1 29 KB

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