OpenSSL "genpkey -paramfile" - Generate DSA Key

Q

How to generate a new DSA private key using OpenSSL "genpkey" command?

✍: FYIcenter.com

A

If you need a new DSA private key in order to create a new certificate, you can use the OpenSSL "genpkey" command as shown below:

C:\Users\fyicenter>\local\openssl\openssl.exe

OpenSSL> genpkey -paramfile my_dsa.prm -out my_dsa.key
OpenSSL> exit

C:\Users\fyicenter>type my_dsa.key
-----BEGIN PRIVATE KEY-----
MIIBTAIBADCCASwGByqGSM44BAEwggEfAoGBAJ4vZpJ9H6iJR/UU1gJbHTR6in8o
a4vX1Vdvj/V53Q1U2lS0VdkAZyZQiWfO9QTO5oM0Y4S7DtTX3UIiuSuKVWMD55pi
WuTgDemf4ZsVAdxcQ6RKCYSwiO0o3O+7RwX2aEzb/KaMqphoHtwRPWhxp5Mbz9kz
DD9T+xQAzsfsuhGVAhUA1kA8zoR9/NuIDs07OdP76UX3UnkCgYEAmB2kVCBqooud
n/zU0dFeXY8RD2OoobKbvdnFeyl8qG3BskLp+1qzHEVT9zI8+6DmJnSxcxyjuT+/
ZO1JnUSX9GNPfWwA4khntera6cLe8qm3fJiWRdsen5XZFFYqvj8A6e5x6qdVCehL
Gc1ZLn0ewTtLDYYpTM/QqFYI7XxKDaEEFwIVAMo3dtgvrFKyqGK1AOdZi0XW9y7f
-----END PRIVATE KEY-----

Note about this test:

  • You don't need to specify "-algorighm dsa", because the DSA parameter file is provided by the "-paramfile my_dsa.prm" option.
  • The output is labeled as private key. But it actually contains two parts, a private key and a matching public key, as a key pair for encryption and decryption.
  • The output is not password protected, which is not recommended. Private keys must be kept private with a password.

 

OpenSSL "genpkey" Command for DSA Keys

⇒⇒OpenSSL Tutorials

2017-12-21, 510👍, 0💬