Por que o OpenSSL fornece dois utilitários com tanta sobreposição
genpkey:
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.
E 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)
-seed
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
Os documentos no Debian também são realmente estranhos sobre isso,
genpkey Generation of Private Key or Parameters.
genrsa Generation of RSA Private Key. Superceded by genpkey.
É genpkeyum substituto? Se sim, como é que não tem -des3? E, como adicionamos uma senha a ela e especificamos o tamanho da chave?
genrsaegenpkeyé realmente diferente. A estrutura ASN.1 das chaves geradas usandogenrsaé pkcs # 1, enquanto as chaves geradas usandogenpkeyé pkcs # 8. Se isso não for ruim o suficiente, se você usargenpkey -outform der, retornará ao pkcs # 1. Com CE, é ainda pior, de alguma formagenecestá faltando, ao contrário, háecparam -genkey, e de alguma formaecparam -genkey,genpkey -outform pem,genpkey -outform dertodos têm ASN.1 estrutura diferente.