0

Following Windows Azure documentation, I generated a pair of private/public keys on an Ubuntu machine using the exact comment as given:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout myPrivateKey.key -out myCert.pem

When I open the private key in puttygen, the following error is displayed:

Couldn't load private key (unrecognised key type)

The private key generated by openssl looks correct:

-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG6w0xAQEFAASCBKcwggSjAgEsAoIBAQC6OEZ5ULe6F6u2
Cybhqqfqqh2ao9sd2tpqB+HGIoMMHrmnD3YegRgZJIddTQaWKdwaKrYul21YNt5y
...
P0RyfL9kDnX/XmIOM38FOoucGvO+Zozsbmgmvw6AUhE0sPhkZnlaodAU1OnfaWJz
KpBxkXulBaCJnC8w29dGKng=
-----END PRIVATE KEY-----

Note that the comments to Azure documentation (the same link as above) report that the pair should be generated using OpenSSL for Windows instead of openssl on Linux. This doesn't help, since the same error appears for a private key generated by OpenSSL for Windows.

What am I doing wrong?

Arseni Mourzenko
  • 2,275
  • 5
  • 28
  • 41

1 Answers1

0

ssh-keys and puttygen doesn't have the same format. You need convert to puttygen

  1. Open PuttyGen
  2. Click Load
  3. Load your private key
  4. Go to Conversions->Export OpenSSH and export your private key
  5. Copy your private key to ~/.ssh/id_dsa (or id_rsa).
  6. Create the RFC 4716 version of the public key using ssh-keygen

    ssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/id_dsa_com.pub

  7. Convert the RFC 4716 version of the public key to the OpenSSH format:

    ssh-keygen -i -f ~/.ssh/id_dsa_com.pub > ~/.ssh/id_dsa.pub

More info:

http://linux-sxs.org/networking/openssh.putty.html

http://www.wellsi.com/sme/ssh/ssh.html