"Couldn't load private key (not a private key)" when converting id_rsa.pub to ppk using PuTTYgen

18,877

Solution 1

You are obviously loading a public key to the PuTTYgen, not the private key.


The ssh-keygen -t rsa generates two files:

  • The key pair id_rsa (containing both the public key and the private key):

    -----BEGIN RSA PRIVATE KEY-----
    ...
    -----END RSA PRIVATE KEY-----
    
  • The public key id_rsa.pub:

    ssh-rsa ... comment
    

You cannot load the id_rsa.pub to PuTTYgen. It makes no sense, as the file does not contain the private key.

You have to load the id_rsa.

Solution 2

I had a similar problem. For Puttygen 6.2 the error was "Couldn't load private key (not a private key)" and for Puttygen 7 the error was "Couldn't load private key (not a recognised key file format)".

It turns out the solution was pretty simple - the .pem file I was using was saved with UNIX line endings (LF). Converting the file to Windows line endings (CR LF) meant that Puttygen was able to read it.

Share:
18,877
Danni Asdani
Author by

Danni Asdani

Updated on June 13, 2022

Comments

  • Danni Asdani
    Danni Asdani about 2 years

    I'm installing Git 2.5.0 (included with latest docker-toolbox) on my Windows 7 64-bit.

    I try to regenerate new key using git-bash:

    ssh-keygen -t rsa
    

    and save the new key to specific location. When trying to convert using PuTTYgen to .ppk file there's error:

    Couldn't load private key (not a private key)

    Is there something wrong with my Git version?

    Here's the .pub file:

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4YN/jejgFKubJ7YBUdl18EKuxFcC2CS/Rl19u6giHIz6zP548guM22Vm1edOLHN6qh2tpJkbzN6FOtLrCUXQqQ4unBqPlAY0dU4Cvzh86TDqdWixOV3AuBGJAMmjrrGe/U3/yO1RgR1pARrl7ZpY7ma7tP/9o8rGDmbQclIULNcI5AYCjRLICgbDlawT8jRYBT33VztphLi9HzGgDtSPANGJpgRrnYcoF3ZJL4E/CC7SW33lz2S/cLsupDdjusPWJjzR8vDKCXYtBTjvNP+a5GY21Z7eQHwD0MBFdxyHCMM0rnVWMJFmNNYy0N2ho5TrJ7kUHbzz4tUfrGPdWzOqX dxx@dxx-SandBox