openssl: Adjust manual pages for 1.0.1n.
[dragonfly.git] / secure / usr.bin / openssl / man / genpkey.1
1 .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is turned on, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{
60 .    if \nF \{
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "GENPKEY 1"
136 .TH GENPKEY 1 "2015-06-11" "1.0.1n" "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 genpkey \- generate a private key
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 \&\fBopenssl\fR \fBgenpkey\fR
146 [\fB\-out filename\fR]
147 [\fB\-outform PEM|DER\fR]
148 [\fB\-pass arg\fR]
149 [\fB\-cipher\fR]
150 [\fB\-engine id\fR]
151 [\fB\-paramfile file\fR]
152 [\fB\-algorithm alg\fR]
153 [\fB\-pkeyopt opt:value\fR]
154 [\fB\-genparam\fR]
155 [\fB\-text\fR]
156 .SH "DESCRIPTION"
157 .IX Header "DESCRIPTION"
158 The \fBgenpkey\fR command generates a private key.
159 .SH "OPTIONS"
160 .IX Header "OPTIONS"
161 .IP "\fB\-out filename\fR" 4
162 .IX Item "-out filename"
163 the output filename. If this argument is not specified then standard output is
164 used.
165 .IP "\fB\-outform DER|PEM\fR" 4
166 .IX Item "-outform DER|PEM"
167 This specifies the output format \s-1DER\s0 or \s-1PEM.\s0
168 .IP "\fB\-pass arg\fR" 4
169 .IX Item "-pass arg"
170 the output file password source. For more information about the format of \fBarg\fR
171 see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
172 .IP "\fB\-cipher\fR" 4
173 .IX Item "-cipher"
174 This option encrypts the private key with the supplied cipher. Any algorithm
175 name accepted by \fIEVP_get_cipherbyname()\fR is acceptable such as \fBdes3\fR.
176 .IP "\fB\-engine id\fR" 4
177 .IX Item "-engine id"
178 specifying an engine (by its unique \fBid\fR string) will cause \fBgenpkey\fR
179 to attempt to obtain a functional reference to the specified engine,
180 thus initialising it if needed. The engine will then be set as the default
181 for all available algorithms. If used this option should precede all other
182 options.
183 .IP "\fB\-algorithm alg\fR" 4
184 .IX Item "-algorithm alg"
185 public key algorithm to use such as \s-1RSA, DSA\s0 or \s-1DH.\s0 If used this option must
186 precede any \fB\-pkeyopt\fR options. The options \fB\-paramfile\fR and \fB\-algorithm\fR
187 are mutually exclusive.
188 .IP "\fB\-pkeyopt opt:value\fR" 4
189 .IX Item "-pkeyopt opt:value"
190 set the public key algorithm option \fBopt\fR to \fBvalue\fR. The precise set of
191 options supported depends on the public key algorithm used and its
192 implementation. See \fB\s-1KEY GENERATION OPTIONS\s0\fR below for more details.
193 .IP "\fB\-genparam\fR" 4
194 .IX Item "-genparam"
195 generate a set of parameters instead of a private key. If used this option must
196 precede and \fB\-algorithm\fR, \fB\-paramfile\fR or \fB\-pkeyopt\fR options.
197 .IP "\fB\-paramfile filename\fR" 4
198 .IX Item "-paramfile filename"
199 Some public key algorithms generate a private key based on a set of parameters.
200 They can be supplied using this option. If this option is used the public key
201 algorithm used is determined by the parameters. If used this option must
202 precede and \fB\-pkeyopt\fR options. The options \fB\-paramfile\fR and \fB\-algorithm\fR
203 are mutually exclusive.
204 .IP "\fB\-text\fR" 4
205 .IX Item "-text"
206 Print an (unencrypted) text representation of private and public keys and
207 parameters along with the \s-1PEM\s0 or \s-1DER\s0 structure.
208 .SH "KEY GENERATION OPTIONS"
209 .IX Header "KEY GENERATION OPTIONS"
210 The options supported by each algorith and indeed each implementation of an
211 algorithm can vary. The options for the OpenSSL implementations are detailed
212 below.
213 .SH "RSA KEY GENERATION OPTIONS"
214 .IX Header "RSA KEY GENERATION OPTIONS"
215 .IP "\fBrsa_keygen_bits:numbits\fR" 4
216 .IX Item "rsa_keygen_bits:numbits"
217 The number of bits in the generated key. If not specified 1024 is used.
218 .IP "\fBrsa_keygen_pubexp:value\fR" 4
219 .IX Item "rsa_keygen_pubexp:value"
220 The \s-1RSA\s0 public exponent value. This can be a large decimal or
221 hexadecimal value if preceded by \fB0x\fR. Default value is 65537.
222 .SH "DSA PARAMETER GENERATION OPTIONS"
223 .IX Header "DSA PARAMETER GENERATION OPTIONS"
224 .IP "\fBdsa_paramgen_bits:numbits\fR" 4
225 .IX Item "dsa_paramgen_bits:numbits"
226 The number of bits in the generated parameters. If not specified 1024 is used.
227 .SH "DH PARAMETER GENERATION OPTIONS"
228 .IX Header "DH PARAMETER GENERATION OPTIONS"
229 .IP "\fBdh_paramgen_prime_len:numbits\fR" 4
230 .IX Item "dh_paramgen_prime_len:numbits"
231 The number of bits in the prime parameter \fBp\fR.
232 .IP "\fBdh_paramgen_generator:value\fR" 4
233 .IX Item "dh_paramgen_generator:value"
234 The value to use for the generator \fBg\fR.
235 .SH "EC PARAMETER GENERATION OPTIONS"
236 .IX Header "EC PARAMETER GENERATION OPTIONS"
237 .IP "\fBec_paramgen_curve:curve\fR" 4
238 .IX Item "ec_paramgen_curve:curve"
239 the \s-1EC\s0 curve to use.
240 .SH "GOST2001 KEY GENERATION AND PARAMETER OPTIONS"
241 .IX Header "GOST2001 KEY GENERATION AND PARAMETER OPTIONS"
242 Gost 2001 support is not enabled by default. To enable this algorithm,
243 one should load the ccgost engine in the OpenSSL configuration file.
244 See \s-1README\s0.gost file in the engines/ccgost directiry of the source
245 distribution for more details.
246 .PP
247 Use of a parameter file for the \s-1GOST R 34.10\s0 algorithm is optional.
248 Parameters can be specified during key generation directly as well as
249 during generation of parameter file.
250 .IP "\fBparamset:name\fR" 4
251 .IX Item "paramset:name"
252 Specifies \s-1GOST R 34.10\-2001\s0 parameter set according to \s-1RFC 4357.\s0
253 Parameter set can be specified using abbreviated name, object short name or
254 numeric \s-1OID.\s0 Following parameter sets are supported:
255 .Sp
256 .Vb 7
257 \&  paramset   OID               Usage
258 \&  A          1.2.643.2.2.35.1  Signature
259 \&  B          1.2.643.2.2.35.2  Signature
260 \&  C          1.2.643.2.2.35.3  Signature
261 \&  XA         1.2.643.2.2.36.0  Key exchange
262 \&  XB         1.2.643.2.2.36.1  Key exchange
263 \&  test       1.2.643.2.2.35.0  Test purposes
264 .Ve
265 .SH "NOTES"
266 .IX Header "NOTES"
267 The use of the genpkey program is encouraged over the algorithm specific
268 utilities because additional algorithm options and \s-1ENGINE\s0 provided algorithms
269 can be used.
270 .SH "EXAMPLES"
271 .IX Header "EXAMPLES"
272 Generate an \s-1RSA\s0 private key using default parameters:
273 .PP
274 .Vb 1
275 \& openssl genpkey \-algorithm RSA \-out key.pem
276 .Ve
277 .PP
278 Encrypt output private key using 128 bit \s-1AES\s0 and the passphrase \*(L"hello\*(R":
279 .PP
280 .Vb 1
281 \& openssl genpkey \-algorithm RSA \-out key.pem \-aes\-128\-cbc \-pass pass:hello
282 .Ve
283 .PP
284 Generate a 2048 bit \s-1RSA\s0 key using 3 as the public exponent:
285 .PP
286 .Vb 2
287 \& openssl genpkey \-algorithm RSA \-out key.pem \-pkeyopt rsa_keygen_bits:2048 \e
288 \&                                                \-pkeyopt rsa_keygen_pubexp:3
289 .Ve
290 .PP
291 Generate 1024 bit \s-1DSA\s0 parameters:
292 .PP
293 .Vb 2
294 \& openssl genpkey \-genparam \-algorithm DSA \-out dsap.pem \e
295 \&                                                \-pkeyopt dsa_paramgen_bits:1024
296 .Ve
297 .PP
298 Generate \s-1DSA\s0 key from parameters:
299 .PP
300 .Vb 1
301 \& openssl genpkey \-paramfile dsap.pem \-out dsakey.pem
302 .Ve
303 .PP
304 Generate 1024 bit \s-1DH\s0 parameters:
305 .PP
306 .Vb 2
307 \& openssl genpkey \-genparam \-algorithm DH \-out dhp.pem \e
308 \&                                        \-pkeyopt dh_paramgen_prime_len:1024
309 .Ve
310 .PP
311 Generate \s-1DH\s0 key from parameters:
312 .PP
313 .Vb 1
314 \& openssl genpkey \-paramfile dhp.pem \-out dhkey.pem
315 .Ve