How to Convert PEM KeyFile into PPK KeyFile and vice versa?



Hi,

In this post, we will learn that how can we convert PEM KeyFile into PPK KeyFile and vice versa including the installation of the tool which we will use to accomplish this.

For the Windows Operating System


In Windows system is easy and straight forward. You just need a tool called "puttygen.exe" from the URL - https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Choose the appropriate version as per your OS.



Convert PEM into PPK in Windows

After downloading the PuTTYgen and open it, load your file (select All Files (*.*) in the bottom dropdown to select your PEM key file). 

You will get a message Successfully imported foreign key, Just click OK, Now click on Save private key button to save that key in the location where do you want to save it.

Convert PPK into PEM in Windows

Now we will convert PPK file into PEM using PuTTYgen in Windows PC

Open the PuTTYgen tool, now load your PPK file into it, and finally, Go to Conversions Menu and Click on Export OpenSSH key. It will ask you to save your PEM file, just name it "AnyName.pem".


Installation of PuTTY in Linux distributions



Install PuTTY, if it’s not already on your system, by running one of these commands:

RHEL - RPM-based

yum install putty
Debian -Dpkg-based

apt-get install putty
OR

apt-get install putty-tools
Fedora

dnf install putty
ARCH-Linux

pacman install putty


Installation of PuTTY in MacOSX

Install the Homebrew if not already installed in your macOSX if not already installed, Brew is the package manager like Apptitude for Debian-based and Yum is for RHEL-based Linux distribution. You can use Port also but I will recommend you to use Brew.

How to install Brew in you macOSX -

Just open the URL "https://brew.sh/" into your browser and you will get the brew installation command on the Homepage of the site like the image below -




Run the following command which you will get on the Homebrew page.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"


It will take at least 5-7 minutes according to your internet bandwidth connection (download 500MB-600MB).

Once the Brew package is successfully installed into you macOSX. Just run the following command to installed PuTTy into your system.


brew install putty


Now, How to convert PEM into PPK and vice versa into Linux and macOSX based distribution.


Conversion of PEM Key file into PPK in Linux and macOSX

puttygen privatekey.ppk -O private-openssh -o privatekey.pem

  • key.ppk: the original file name/path. 
  • -O private-openssh: the output type. private-openssh is used to save an SSH-2 private key in OpenSSH’s format. 
  • -o key.pem: the output file name/path.

Conversion of PPK Key file into PEM in Linux and macOSX

puttygen privatekey.pem -O private-openssh -o privatekey.ppk

If the above command is not working, then try this

puttygen pemKey.pem -o ppkKey.ppk -O private
OR

puttygen mykey.pem -o mykey.ppk

That's all about how can you convert your PEM KeyFile into PPK Key File and vice versa. :)

Popular posts from this blog

How to reset MySQL root password in Ubuntu in latest Ubuntu versions 18.04 and above

Ubuntu default Firewall UFW (Uncomplicated Firewall) Command-Line

How to deploy Java Springboot application in Ubuntu 16.04/18.04