Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Why does OpenSSL provide two utilities with so much overlap


OpenSSL> genpkey -
Usage: genpkey [options]
where options may be
-out file          output file
-outform X         output format (DER or PEM)
-pass arg          output file pass phrase source
-<cipher>          use cipher <cipher> to encrypt the key
-engine e          use engine e, possibly a hardware device.
-paramfile file    parameters file
-algorithm alg     the public key algorithm
-pkeyopt opt:value set the public key algorithm option <opt>
                   to value <value>
-genparam          generate parameters, not key
-text              print the in text
NB: options order may be important!  See the manual page.

And genrsa:

OpenSSL> genrsa -
usage: genrsa [args] [numbits]
 -des            encrypt the generated key with DES in cbc mode
 -des3           encrypt the generated key with DES in ede cbc mode (168 bit key)
                 encrypt PEM output with cbc seed
 -aes128, -aes192, -aes256
                 encrypt PEM output with cbc aes
 -camellia128, -camellia192, -camellia256
                 encrypt PEM output with cbc camellia
 -out file       output the key to 'file
 -passout arg    output file pass phrase source
 -f4             use F4 (0x10001) for the E value
 -3              use 3 for the E value
 -engine e       use engine e, possibly a hardware device.
 -rand file:file:...
                 load the file (or the files in the directory) into
                 the random number generator

The docs in Debian are also really strange about this,

   genpkey   Generation of Private Key or Parameters.
   genrsa    Generation of RSA Private Key. Superceded by genpkey.

Is genpkey a replacement? If so, how come it doesn't have -des3? And, how do we add a password to it, and specify the key length?

share|improve this question

1 Answer 1

It clearly states that genrsa has been superceded by genpkey, so yes, genpkey is a replacement.

You can change the cipher to 3des by using the -cipher argument

Also, it should tell you that to add a password, you use the -pass argument

You can find more information here

share|improve this answer
Well, I do see the -pass argument now (assuming that is the same as -3des), but I don't even see an option to specify key length on genpkey? I also pasted the entirety of what the Ubuntu 14.04 man pages had to say about it. –  Evan Carroll Apr 19 at 20:18
May I point you to this documentation then: genpkey –  MichelZ Apr 19 at 20:24
Lol, this is nuts... -pkeyopt rsa_keygen_bits:numbits. –  Evan Carroll Apr 19 at 20:24
Why is it nuts? :) –  MichelZ Apr 19 at 20:29
Because the whole purpose of -h is to provide a synopsis of the command. That said, I just found out genpkey is actually documented in its own man pages. That's interesting. The whole project should move the direction of git-core, with the man pages all prefixed with openssl-, and the ui permitting openssl help genpkey to render the man pages. tldr; better docs would help. –  Evan Carroll Apr 19 at 20:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.