This tutorial will show you how to convert SSH private key with Putty keygen.
It is silly, but SSH2 private keys do not have standard format. OpenSSH, ssh.com, PuTTY have different formats, and any key generated with one client cannot immediately be used with another.

If I just copy and paste it in a file and include it when I am using PuTTY I will receive an error saying: ‘Server refused our key’

So save your key in a simple text file using Notepad. In order to have this key converted, you can use PuTTY keygen to import and save the key in appropriate format.

If you do not have PuTTY keygen tool, you may download it from http://putty.nl .
Usually it comes along with PuTTY package so if you have it installed it should be inside C:\Program Files\PuTTY .

Anyway, open it and click on ‘Conversions’ and then ‘Import key’, locate the text file you saved and open it.

PuTTY keygen imports such key like this:

Now simply click on ‘Save private key‘, choose a location and click save.
The new key will look rather different:

C++

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

PuTTY-User-Key-File-2:ssh-rsa

Encryption:aes256-cbc

Comment:imported-openssh-key

Public-Lines:4

AAAAB3NzaC1yc2EAAAABIwAAAIEAqGke075QDUb3Y+fLq8xJHwYccBQwaaFvPDi6

PiH4+FMTCbIwCnEBKksnfE4hhl4rdoh4f55q9k83WCHhrQ3i6ZYe8kR88iTJb6XW

ai9r2j5OGrg11YRSoJzf84q2pw36N6a39kTHvQgxiZGZiFy8psfjVJ0WqjmAqJp7

IR+kiX0=

Private-Lines:8

WJKnS254U4y85EYNfHeyMvfJRadMsUeqIDD69GgC0xDbKkjUbGyd8bO9TmJZIziz

oDDQp4bFqIhGZNrBU4b0KKw/27JnKYF79i0NT+cN7M7sWLTHGkosag4jmp+nKcYH

BbOOyzIuZpmwKP3UmGYo2P9oorBDPdA3fp8raeV3ia/9CasdWwZ717v6NYWg2cT4

tHXtMM52i8JRHrQseCq22FUj0rU/jpxPa5ZtykAZToigM8XbtDiUAsE53MUZX7y4

5dqtRcaMwWWwCEaO8SuMvaXXch8ASDAS3SU2L4z8MZNoshcRM9wauO5fFPFsGqyv

OU+fay6DC8kBIorZYJmt7ce8x+NQZM2WQIs7aLbcTMvDv/86D9S6G6qGycQv0gxc

qVqPdasud83&kjasd83kjasWejasHASJ1u4zvel2Q/Jpm3KYjwakri4jhFkjQ9zS

muuhM5DkYu9mAd2WCwYntw==

Private-MAC:b2385da6a3dbcd49fa90ea9c336fac575952645e

Now, load your PuTTY client and at left for category click on ‘Connection’ ‘“ ‘SSH’ ‘“ ‘Auth’. There under the section ‘Authentication parameters’ locate ‘Private key file for authentication‘, and browse for your new key.
The next will be to connect to your server.

About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the Onlinehowto.net website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Something that was driving me crazy: if you are getting “not a private key” errors when trying to import the text file you created, make sure you don’t have any extra spaces or lines in your document, it has to start with

‘”’“BEGIN RSA PRIVATE KEY’”’“

And finish with

‘”’“END RSA PRIVATE KEY’”’“

Be very strict about this and try again, worked for me (after several self inflicted corporal punishment attempts).