1GENPKEY(1)                          OpenSSL                         GENPKEY(1)
2
3
4

NAME

6       genpkey - generate a private key
7

SYNOPSIS

9       openssl genpkey [-out filename] [-outform PEM|DER] [-pass arg]
10       [-cipher] [-engine id] [-paramfile file] [-algorithm alg] [-pkeyopt
11       opt:value] [-genparam] [-text]
12

DESCRIPTION

14       The genpkey command generates a private key.
15

OPTIONS

17       -out filename
18           the output filename. If this argument is not specified then
19           standard output is used.
20
21       -outform DER|PEM
22           This specifies the output format DER or PEM.
23
24       -pass arg
25           the output file password source. For more information about the
26           format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
27
28       -cipher
29           This option encrypts the private key with the supplied cipher. Any
30           algorithm name accepted by EVP_get_cipherbyname() is acceptable
31           such as des3.
32
33       -engine id
34           specifying an engine (by its unique id string) will cause genpkey
35           to attempt to obtain a functional reference to the specified
36           engine, thus initialising it if needed. The engine will then be set
37           as the default for all available algorithms. If used this option
38           should precede all other options.
39
40       -algorithm alg
41           public key algorithm to use such as RSA, DSA or DH. If used this
42           option must precede any -pkeyopt options. The options -paramfile
43           and -algorithm are mutually exclusive.
44
45       -pkeyopt opt:value
46           set the public key algorithm option opt to value. The precise set
47           of options supported depends on the public key algorithm used and
48           its implementation. See KEY GENERATION OPTIONS below for more
49           details.
50
51       -genparam
52           generate a set of parameters instead of a private key. If used this
53           option must precede and -algorithm, -paramfile or -pkeyopt options.
54
55       -paramfile filename
56           Some public key algorithms generate a private key based on a set of
57           parameters.  They can be supplied using this option. If this option
58           is used the public key algorithm used is determined by the
59           parameters. If used this option must precede and -pkeyopt options.
60           The options -paramfile and -algorithm are mutually exclusive.
61
62       -text
63           Print an (unencrypted) text representation of private and public
64           keys and parameters along with the PEM or DER structure.
65

KEY GENERATION OPTIONS

67       The options supported by each algorith and indeed each implementation
68       of an algorithm can vary. The options for the OpenSSL implementations
69       are detailed below.
70

RSA KEY GENERATION OPTIONS

72       rsa_keygen_bits:numbits
73           The number of bits in the generated key. If not specified 1024 is
74           used.
75
76       rsa_keygen_pubexp:value
77           The RSA public exponent value. This can be a large decimal or
78           hexadecimal value if preceded by 0x. Default value is 65537.
79

DSA PARAMETER GENERATION OPTIONS

81       dsa_paramgen_bits:numbits
82           The number of bits in the generated parameters. If not specified
83           1024 is used.
84

DH PARAMETER GENERATION OPTIONS

86       dh_paramgen_prime_len:numbits
87           The number of bits in the prime parameter p.
88
89       dh_paramgen_generator:value
90           The value to use for the generator g.
91
92       dh_rfc5114:num
93           If this option is set then the appropriate RFC5114 parameters are
94           used instead of generating new parameters. The value num can take
95           the values 1, 2 or 3 corresponding to RFC5114 DH parameters
96           consisting of 1024 bit group with 160 bit subgroup, 2048 bit group
97           with 224 bit subgroup and 2048 bit group with 256 bit subgroup as
98           mentioned in RFC5114 sections 2.1, 2.2 and 2.3 respectively.
99

EC PARAMETER GENERATION OPTIONS

101       ec_paramgen_curve:curve
102           the EC curve to use.
103

GOST2001 KEY GENERATION AND PARAMETER OPTIONS

105       Gost 2001 support is not enabled by default. To enable this algorithm,
106       one should load the ccgost engine in the OpenSSL configuration file.
107       See README.gost file in the engines/ccgost directiry of the source
108       distribution for more details.
109
110       Use of a parameter file for the GOST R 34.10 algorithm is optional.
111       Parameters can be specified during key generation directly as well as
112       during generation of parameter file.
113
114       paramset:name
115           Specifies GOST R 34.10-2001 parameter set according to RFC 4357.
116           Parameter set can be specified using abbreviated name, object short
117           name or numeric OID. Following parameter sets are supported:
118
119             paramset   OID               Usage
120             A          1.2.643.2.2.35.1  Signature
121             B          1.2.643.2.2.35.2  Signature
122             C          1.2.643.2.2.35.3  Signature
123             XA         1.2.643.2.2.36.0  Key exchange
124             XB         1.2.643.2.2.36.1  Key exchange
125             test       1.2.643.2.2.35.0  Test purposes
126

NOTES

128       The use of the genpkey program is encouraged over the algorithm
129       specific utilities because additional algorithm options and ENGINE
130       provided algorithms can be used.
131

EXAMPLES

133       Generate an RSA private key using default parameters:
134
135        openssl genpkey -algorithm RSA -out key.pem
136
137       Encrypt output private key using 128 bit AES and the passphrase
138       "hello":
139
140        openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello
141
142       Generate a 2048 bit RSA key using 3 as the public exponent:
143
144        openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048 \
145                                                       -pkeyopt rsa_keygen_pubexp:3
146
147       Generate 1024 bit DSA parameters:
148
149        openssl genpkey -genparam -algorithm DSA -out dsap.pem \
150                                                       -pkeyopt dsa_paramgen_bits:1024
151
152       Generate DSA key from parameters:
153
154        openssl genpkey -paramfile dsap.pem -out dsakey.pem
155
156       Generate 1024 bit DH parameters:
157
158        openssl genpkey -genparam -algorithm DH -out dhp.pem \
159                                               -pkeyopt dh_paramgen_prime_len:1024
160
161       Output RFC5114 2048 bit DH parameters with 224 bit subgroup:
162
163        openssl genpkey -genparam -algorithm DH -out dhp.pem -pkeyopt dh_rfc5114:2
164
165       Generate DH key from parameters:
166
167        openssl genpkey -paramfile dhp.pem -out dhkey.pem
168
169
170
1711.0.2k                            2017-01-26                        GENPKEY(1)
Impressum