OpenSSL "gendsa" - Generate DSA Key Pair

Q

How to generate a new DSA key pair using OpenSSL "gendsa" command?

✍: FYIcenter.com

A

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

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

OpenSSL> gendsa -out my_dsa_2048.key my_dsa_2048.prm
Generating DSA key, 2048 bits
OpenSSL> exit

C:\Users\fyicenter>type my_dsa_2048.key
-----BEGIN DSA PRIVATE KEY-----
MIIDVwIBAAKCAQEA09NkEULPGkTsLxKZPNzZfbTUSOiADv6L/552mIjnK+EaDpxm
zUuG0Bscbya3e0AcfvfzkrW6oksTbS9RR/DXICoWel6ZnM/hSVjDKDUtbGljcXz7
h51ff6zfQAUsMvXCMxT/Ma7r9KtCxlHg/RDMUbp5c89X8hfKLulml6OWj2FT/9/B
UOOdScojFPFevqs5HbQCB4SlWfLxumBp2qMQbQ56u+Xwwrg3ECiziswIi/g/ouko
GTlOnY0c4pU8KbbXobmMPxhIf+nVc8ENF6CXOPoDbHr1wm9GYmmDtdv239FswPxE
9k8A3KzLa8UbYmMfrXn0a/9hn/zyLkHbD4XM4QIhAM1zlYDIDBYRPH9sc4kNwlDK
Qbkk0j8LYjTcHuyTseIhAoIBAFn61R63xnxGdoGHC2FwiZ4U0WsTHFx6RUQSLgqX
9N4j9t4IXBHQ8uYtr2XL8M463LnCCmLpC3YJVoELsYUAkpoJ5hfwjKLc4L61jd7L
fT/ko96RhHQNLcB/MOb1XKmQUDq4GSatHCDhvmV9s3NOxCSlJae1xni0/6xkoqx2
lbk1K6vFolWY/GkpGWddDYOJgL6l9QljByd8hXYYndGhdbl8Cpm746BxD6I3AYOz
uC7P4tAhzpLbaGBYh3BBaxjHvnqY2XwQdg3LLGQI57WVe3TyvT7qUZzZshgiFhKe
xv2KSTYkMQyPjYsA0eSSIolTFGQLUQIZycYpX4TzieJISyACggEBALBizVZauswn
fXuM9O5UYNF/ZIoM+X7cenDdduEKyD3S4HYQASRPrYEx2jOuwIr31qNboxWGUGX9
MZ/axk+PbxH7ezTfgsto5Xj7cyz9UgQSkbnkjNjg2r1ztGyWFgg7iEKEYR4LNWD3
FYk+anzzAiQzUnLwYcMH1eb5wzuFKQVSgvA0fzumhwLmBm8xtQxrzzn1HbICQdfN
8wc0QMu1JyFksHG7LUfceMNbNqCOJw00Reep13Tx2YYeGJa3ibGEkMkupYN3o57U
oEavoMraVgbFOCI8+47DffSmdCdmlc2gugY2tCulXkNUZKzApbSgIg+LC3Ex4vcr
7wWEgG98DFYCIQC7eIp94iSJmLsWfTNmphWITSUOBd7HZfOHWjEAeZqVIA==
-----END DSA PRIVATE KEY-----

Note that 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.

Also note that the output is not password protected, which is not recommended. Private keys must be kept private with a password.

 

OpenSSL "gendsa" and "dsa" Commands

⇒⇒OpenSSL Tutorials

2017-01-07, 195👍, 0💬