How to Convert a pem file to ppk file format using PuTTYgen

convert pem to ppk from PuTTygen

PuTTygen is also known as ‘PuTTY Key Generator‘. This tool can used to create SSH key pairs (Public and Private keys). It is free and open source. PuTTYgen save file in .ppk format.

Amazon Elastic Compute Cloud service(Amazon EC2) provides secure and scalable capacity in the cloud. While accessing remotely, it creates the .pem file format private key. Conversion of this key to ppk format is necessary to connect to amazon ec2 instance.

What is a PEM File?

A PEM stands for Privacy Enhanced Mail, is a widely used format for storing and transmitting data in various types of data. It includes data like public key, private key, digital certificate, and other sensitive data. Mostly security-related data is used. 

The PEM used textual encoding, in Base64 a method to represent the data in a human readable format. Within pem file, data is divided into sections by “BEGIN” and “END” marker. These markers indicate the purpose of the data enclosed between them. For example

‘——–BEGIN CERTIFICATE——-’ and ‘——END CERTIFICATE—–‘ 

These markers in PEM files indicate that the data enclosed in them is a digital certificate.

Hence the text coding and marker system in the pem file helps to make the readable format for both the human and machine. PEM files can store and transfer sensitive data.

What is a PPK File?

PPK file stands for PuTTY private key. This file format is associated with PuTTY, which is an SSH and Telnet client. This extension is used for storing private key which is important for secure communication during the remote server connection.

You can create the .ppk file by using PuTTYgen. This tool can generate the key pair (public and private key). The private key is stored in .ppk format. While connecting to a remote server the private key can used for authentication. The server has the public key in the authorized file will allow access. 

The PPK file can be generated and managed by PuTTygen. These files are essential for a secure connection with the server.

Convert .pem to .ppk file

PuTTY does not natively support the pem file format of private key. So, to convert a pem file to ppk key file primary requirement is to download and install latest version PuTTY. PuTTY itself do not change the key. PuTTYgen is the component of PuTTY is used for this purpose. It comes with PuTTY installation package.

Convert .pem to .ppk file in window:

Open the PuTTYgen. Window>All program>PuTTY>PuTTYgen

PuTTYgen on Windows

Click on the load button, located at the right end. Select the all-type file *.* from the right end bar. It will show all file that contains the .pem extension.

open private key in PuTTYgen

Select the file you want to convert, then click to open. In the open window select to ‘save private key’ which change and saves the key in ppk extension.

save private key

PuTTYgen will show a screen to save private key without a passphrase. Click on ‘yes’. Then give the file name and it will automatically save it in a .ppk file.

save private key in PuTTYgen

Convert .pem to .ppk file in Linux:

In Linux, for this conversion install PuTTY first. Execute this command on command-line terminal to use PuTTYgen:

sudo apt install putty-tools

For key conversion run this command

$ sudo puttygen pemkey.pem -o ppkkey.ppk -O private 

The .pem file is now converted to a ppk format. In Linux, file conversion is very easy than Windows. 

Convert .ppk file to OpenSSH format in Linux:

To convert PuTTY private key format to OpenSSH format, run command

puttygen keyfile.ppk -O private-openssh -o keyfile

Also explore the process converting pub file to ppk file.