To convert an SSH private key between .ppk (PuTTY Private Key) and .pem (PEM – Privacy Enhanced Mail) formats, you typically use different tools based on the direction of the conversion. Below are the steps for both conversions:
.pem to .ppk Conversion
To convert a .pem file to a .ppk format, you need to use PuTTYgen, a key generator tool for PuTTY. PuTTYgen can convert keys into various formats. Here’s how you do it:
- Open PuTTYgen: If you don’t have PuTTYgen, you’ll need to download and install PuTTY, which includes PuTTYgen.
- Load the .pem File: Start PuTTYgen, then click “Load”. By default, PuTTYgen only shows files with the extension
.ppk,so you must select “All Files (.)” from the drop-down menu to see your.pemfile. Select your.pemfile. - Enter the Passphrase (if applicable): If a passphrase protects your
.pemfile, enter it when prompted. - Save the Private Key in .ppk Format: Once the key is loaded, click on “Save private key.” You may be warned about saving the key without a passphrase. Based on your security requirements, choose whether or not to heed this warning. Save the file with a
.ppkextension.
.ppk to .pem Conversion
To convert a .ppk file to a .pem format, you can use PuTTYgen for Windows or the putty-tools package in Linux.
Windows
- Open PuTTYgen and load your
.ppkfile by clicking “Load” and selecting the.ppkfile. - Once loaded, go to “Conversions” in the menu and select “Export OpenSSH key.” If your .ppk file has a passphrase, you’ll need to enter it.
- Save the Key: Name your file and save it with a
.pemextension.
Linux (Using putty-tools)
- Install
putty-tools: If not already installed, you can typically install it using your distribution’s package manager. For Debian-based systems, you would use:sudo apt-get install putty-tools. - Convert the Key: Use the command
puttygen yourkey.ppk -O private-openssh -o yourkey.pem, replacingyourkey.ppkwith your.ppkfile name andyourkey.pemwith the desired output file name. - Set Correct Permissions: For your ‘.pem’ file to be recognized as secure by SSH, it’s important to set the correct permissions. You can do this with the command ‘chmod 600 yourkey.pem’.
This should cover the basic process of converting between .ppk and .pem formats. Remember, the security of your private key is paramount, so ensure it’s always kept secure and never shared.

Leave a Reply