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

EC PARAMETER GENERATION OPTIONS

93       ec_paramgen_curve:curve
94           the EC curve to use.
95

GOST2001 KEY GENERATION AND PARAMETER OPTIONS

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

NOTES

120       The use of the genpkey program is encouraged over the algorithm
121       specific utilities because additional algorithm options and ENGINE
122       provided algorithms can be used.
123

EXAMPLES

125       Generate an RSA private key using default parameters:
126
127        openssl genpkey -algorithm RSA -out key.pem
128
129       Encrypt output private key using 128 bit AES and the passphrase
130       "hello":
131
132        openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello
133
134       Generate a 2048 bit RSA key using 3 as the public exponent:
135
136        openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048 \
137                                                       -pkeyopt rsa_keygen_pubexp:3
138
139       Generate 1024 bit DSA parameters:
140
141        openssl genpkey -genparam -algorithm DSA -out dsap.pem \
142                                                       -pkeyopt dsa_paramgen_bits:1024
143
144       Generate DSA key from parameters:
145
146        openssl genpkey -paramfile dsap.pem -out dsakey.pem
147
148       Generate 1024 bit DH parameters:
149
150        openssl genpkey -genparam -algorithm DH -out dhp.pem \
151                                               -pkeyopt dh_paramgen_prime_len:1024
152
153       Generate DH key from parameters:
154
155        openssl genpkey -paramfile dhp.pem -out dhkey.pem
156

POD ERRORS

158       Hey! The above document had some coding errors, which are explained
159       below:
160
161       Around line 117:
162           You forgot a '=back' before '=head1'
163
164
165
1661.0.0e                            2009-04-10                        GENPKEY(1)
Impressum