ssh2: Cannot parse Private Keys from PuttyGen?

Are the private keys generated from PuttyGen not compatible with ssh2?

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

The private keys that are generated (SSH-2 RSA) look like this:

PuTTY-User-Key-File-2: ssh-dss
Encryption: none
Comment: dsa-key-20141119
Public-Lines: 18
AAAAB3NzaC1kc3MAAAEBALRAc0iurfC9QcN8svhWZ696BsMwCSqlh4lB7SgUfhsI
7qClbw+5Lf4xUHjy0/851/a/iL4wPa5pEpN35cql8JTOfVdukhOPUqyiZzdxNdWC
IY9xu0DDQjRmkKQ5QSumbVggWyTe/Td1nbQlMT4RcQBDut1viKLueWkWsecj0vLJ
wGI1P80Vwz+FgMY/9mRJjPZl0nZAhi791/Ig3N6Nyq8ecAA+Z+KNa6Dj6g96GslU
H9hZbviuPaoFnaaq150rZBo6owe2CI7ITofS30jNL8LuFeaQg9P51/39YLi6RNS4
0zyiSWhFw+S/m9GayzwGGQQyCUoaxSCRo7//WxxMPCEAAAAVAO6ae6AgEuerk0Wa
/HfbwxbsPOHzAAABAHPoUUfiIl16qFb9SzpTDPuo0ZxChX9zbkL8Y+vDo1k4664P
--- redacted ---
Private-Lines: 1
AAAAFHhl3RpT/xmScMoRL2RcA5z6gGO3
Private-MAC: 3617639b950751ab5149bdbf8b88044b6af394f1

I get this error message:

[Error: Cannot parse privateKey: Unsupported key format]

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@ganna-shmatova That’s not for generating PuTTY keys, that’s for generating a TLS certificate (for the server). Those are two different things. As far as I know the only way to generate PuTTY keys is to use PuTTYGen, which can save out to the .PPK key format.

You want it to start like this:

-----BEGIN RSA PRIVATE KEY-----

Using PuTTYgen, load the existing key, and then select Conversions -> Export OpenSSH key. This file should work fine. You’ll want this version for other tools as well.

That being said, supporting PuTTY style keys might be a useful feature request for some, I suppose. In fact, there’s a TODO for it.

-[Unknown]