How to convert ed25519 private key to putty ppk?

takaomag picture takaomag · Mar 3, 2018 · Viewed 19.8k times · Source

I want to convert an ed25519 private key (which is generated by ssh-keygen command) to a ppk file. But I got the error.

Couldn't load private key (unrecognized cipher name)

Can someone help me?

  • tested openssh version: OpenSSH_7.6p1, OpenSSL 1.1.0g 2 Nov 2017 and OpenSSH_7.6p1, OpenSSL 1.0.2n 7 Dec 2017 (on CoreOS and ArchLinux docker container)

  • tested putty version: 0.70 64bit, 0.70 32bit and snapshot (on windows 10)

My procedure is as follows.

1. Generate an ed25519 private key

# ssh-keygen -t ed25519 -a 100
Generating public/private ed25519 key pair.
Enter file in which to save the key (/root/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_ed25519.
Your public key has been saved in /root/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:2HfORujStwmC9c91rmDxMbaV9kVMT70gWxnRXAvNrNU root@f46f23bbad55
The key's randomart image is:
+--[ED25519 256]--+
|             +X B|
|           . +.@E|
|            + +.=|
|       o   o . o.|
|      . S o + +oo|
|       o = = +.=o|
|      . o = B + o|
|         o B = o |
|            = ...|
+----[SHA256]-----+

# cat .ssh/id_ed25519
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABClhk1367
G8CQYpo/0c7UShAAAAZAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIIJiwIymcly4s66p
za/IL3ZNyT5CiMPj0R+/LnMDmABUAAAAoMJIakdbIL7TOAmX8n4xGSrtp8mc/Mr6qimZAZ
zGB7iRhNUXT+isPdf0YuC9mh5NbX43ZYFl+/sWdi2hVmJxbGTwrjaSdNzF3ZnSpi/aVlzF
t3bUCtdwhHLaLqy9unw0zPHlfcQsB700GS/bf4VKRmm1+imj3cAldUm2RF3VdI0U9/04yX
Mj+VBOmevM0i7R/0d6xUFTH3zj99xxeLI2J6A=
-----END OPENSSH PRIVATE KEY-----

# cat .ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIJiwIymcly4s66pza/IL3ZNyT5CiMPj0R+/LnMDmABU root@f46f23bbad55

2. Run puttygen.exe on windows and try to import the ed25519 private key (.ssh/id_ed25519)

Couldn't load private key (unrecognized cipher name)

Answer

Adam Baxter picture Adam Baxter · Jan 17, 2019

Update 2019-03-20: https://www.chiark.greenend.org.uk/~sgtatham/putty/releases/0.71.html supports these keys

ssh-keygen -t ed25519 -f test-key-for-stackoverflow

puttygen 0.71 importing an ed25519 key successfully

At the time of writing this, the puttygen snapshot from https://www.chiark.greenend.org.uk/~sgtatham/putty/snapshot.html seems to support these keys where 0.70 did not. It's not explicitly mentioned in the changelog.

I tested Development snapshot 2019-01-17.53747ad