Tại sao OpenSSL cung cấp hai tiện ích với nhiều sự chồng ché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.
Và 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
Các tài liệu trong Debian cũng thực sự lạ về điều này,
genpkey Generation of Private Key or Parameters.
genrsa Generation of RSA Private Key. Superceded by genpkey.
Là genpkeymột sự thay thế? Nếu vậy, tại sao nó không có -des3? Và, làm thế nào để chúng ta thêm mật khẩu vào nó và chỉ định độ dài khóa?
genrsavàgenpkeythực sự khác nhau. Cấu trúc ASN.1 của các khóa được tạo bằnggenrsapkcs # 1, trong khi các khóa được tạo bằnggenpkeypkcs # 8. Nếu điều đó không đủ tệ, nếu bạn sử dụnggenpkey -outform derthì nó trở lại pkcs # 1. Với EC, nó thậm chí còn tồi tệ hơn, bằng cách nào đógeneclà mất tích, thay vào đó làecparam -genkey, và bằng cách nào đóecparam -genkey,genpkey -outform pem,genpkey -outform dertất cả đều có cấu trúc ASN.1 khác nhau.