PPK (PuTTY Private Key) and PEM (Privacy Enhanced Mail) are two file formats that are commonly used for SSH and SSL/TLS connections. While PPK files are primarily used with PuTTY on Windows, PEM files are more widely supported and can be used with various tools and platforms. If you have a PPK file and need to use it with a tool or platform that requires a PEM file, you can convert the PPK file to a PEM file. In this article, we will explore how to convert a PPK file to a PEM file on Linux and Windows.
You may like: How to Convert a PEM file to PPK?
Method 1: Convert PPK to PEM in Linux Using `puttygen`
To convert a PPK file to a PEM file on Linux, you can use the `puttygen` command line utility from the putty-tools package.
- First, make sure that the putty-tools package is installed on your system. You can install it using your package manager, such as apt or yum, or you can download and install it manually from the PuTTY website (https://www.putty.org/).
sudo apt install putty-tools
- Open a terminal window and navigate to the directory where the PPK file is stored.
- Run the following command to convert the PPK file to a PEM file:
puttygen ppk_file.ppk -O private-openssh -o pem_file.pem
Replace `ppk_file.ppk` with the name of your PPK file and `pem_file.pem` with the desired name for the PEM file.
- The command will prompt you for a passphrase to protect the PEM file. Enter a passphrase, or leave it blank if you don’t want to use a passphrase.
- Save the output file on your system
Method 2: Convert PPK to PEM in Linux Using `openssl`
If you have the `openssl`
command installed on your system, you can also use it to convert a PPK file to a PEM file. To do this, run the following command:
openssl pkcs8 -inform DER -in ppk_file.ppk -outform PEM -out pem_file.pem
Replace ppk_file.ppk with the name of your PPK file and pem_file.pem with the desired name for the PEM file.
Method 3: Convert PPK to PEM on Windows with PuTTYgen
Windows users can also convert a PPK file to PEM using PuTTYgen utility. Assume you already have downloaded Puttygen from its official download site.
Next, follow the steps to convert PPK to PEM:
- Launch PuTTYgen application
- Under File menu, click Load private key.
- Select your .ppk file, and then choose Open.
- Now, under the Conversions menu, click Export OpenSSH Key (force new file format).
- Set a new name with the “.pem” extension and click the “Save” button
Conclusion
In conclusion, converting a PPK file to a PEM file on Linux and Windows is a simple process that can be accomplished using the puttygen command on Linux and Windows or the openssl command on Linux. Understanding how to convert a PPK file to a PEM file can be helpful in various scenarios when you need to use a PPK file with a tool or platform that requires a PEM file. By following the steps outlined in this article, you can easily convert a PPK file to a PEM file and use it for SSH and SSL/TLS connections.
8 Comments
how to convert .ppk file to .key file ?
thanks !
Or if you want a script to do it :
#!/bin/bash
[[ “${1##*.}” =~ “ppk” ]] && { puttygen ${1} -O private-openssh -o “${1%.*}.pem”; chmod 400 “${1%.*}.pem”; } || { puttygen ${1} -o “${1%.*}.ppk” -O private; chmod 400 “${1%.*}.ppk”; }
(checks extension and writes a file)
When type:
puttygen key.ppk -O private-openssh -o key.pem
puttygen: unable to load file `key.ppk’: unable to open file
What is this?
what is [username] in
ssh -i server1.pem [username]@11.22.33.44
I am using my ftp username, and again it is asking for password
Thank You Its Worked..
thanks!
Thanks it worked!