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