Master java skills

How to Generate SSH Key Pair on Windows Using the PuTTYgen

In this tutorial, we will learn how to generate public/private key pair using PuTTYgen.

  1. Download and install putty from this link – http://www.putty.org/
  2. Using the installer, install putty on your local machine
  3. Go to the installation folder and run puttygen.exe file
  4. Below window will be displayed

Click on Generate button with RSA button selected and number of bits in a generated key as ‘2048‘.

As the key is being generated, keep moving the mouse in the blank area as instructed to introduce some randomness in key generation.

After the keys are generated, below window will be opened.

Add a key passphrase and confirm passphrase. (This is like password for accessing the private key. Although it is optional to use, it is advisable that you set a passphrase)

5. Click on ‘Save private key’ to save the private key on your local machine. Just make sure that you give the file extension as .ppk (putty private key) to adhere to the naming convnetion of putty.

Note – The .ppk file extension indicates that the private key is in PuTTY’s proprietary format. You must use a key of this format when using PuTTY as your SSH client. It cannot be used with other SSH client tools. Refer to the PuTTY documentation to convert a private key in this format to a different format.

6. Click on ‘Save public key’ to save the public key. Save in the same folder as private key. Make sure you select all the characters, not just the ones you can see in the narrow window. If a scroll bar is next to the characters, you aren’t seeing all the characters. The extension of pubilc file would be .pub example (publicKey.pub)

7. If you or others are going to use an SSH client that requires the OpenSSH format for private keys (such as the ssh utility on Linux), export the private key:

On the Conversions menu, choose Export OpenSSH key.

Save the private key in OpenSSH format in the same folder where you saved the private key in .ppk format, using an extension such as .openssh to indicate the file’s content.