OpenSSL "pkey -aes*" - Re-Encrypt DH Keys


How to re-encrypt a DH key file using OpenSSL "pkey" command? I want to change the encryption password, and maybe change the encryption algorithm.



If you want to encrypt an existing DH key file again, you can use the "pkey -aes*" command as shown below:


OpenSSL> pkey -in my_dh_des.key -aes128 -out my_dh_aes.key
Enter pass phrase for my_dh_des.key: fyicenter
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:

Options used in this command are:

  • "-in my_dh_des.key" - Read the DH private key file.
  • "-out my_dh_aea.key" - Save the output to a file.
  • "-aes128" - Encrypt the output (DH private key and public key).
  • "fyicenter" - The password of the input key file.
  • "" - The password of the output key file.


OpenSSL "genpkey" Command for EC Keys

OpenSSL "pkey" - Open Encrypted DH Keys

OpenSSL "genpkey" Command for DH Keys

⇑⇑ OpenSSL Tutorials

2017-08-13, 1213👍, 0💬