This project is read-only.

Puttygen ppk passphrase / encoding problem

Jun 23, 2013 at 9:46 AM
I have a private/public key pair generated with puttygen and exported to the OpenSSH format.
The passphrase contains an '€' (Euro sign).

Now when I try to open the private key ...
var key = new PrivateKeyFile(@"C:\Users\Me\.ssh\mykey.ppk", "t€st");
... I get an InvalidOperationException:
message: "Invalid data type, INTEGER(02) is expected."
stacktrace: "at Renci.SshNet.Common.DerData.ReadBigInteger()
at Renci.SshNet.Security.Key..ctor(Byte[] data)
at Renci.SshNet.Security.RsaKey..ctor(Byte[] data)
at Renci.SshNet.PrivateKeyFile.Open(Stream privateKey, String passPhrase)
at Renci.SshNet.PrivateKeyFile..ctor(String fileName, String passPhrase)

However the same passphrase does work when I mount the original (putty-format) key with pageant.
So I guess this is caused by some weird encoding problem.

The problem can be easily reproduced with Puttygen and any passphrase containing an '€' character.
OK, the workaround is obvious (... use another passphrase), but I'd still appreciate any ideas on this.

Thanks in advance,
Jun 23, 2013 at 11:44 AM
Edited Jun 23, 2013 at 11:54 AM

Are you sure this isn't a bug of Puttygen and UTF-8 Chars in Passphrases?
You are opening an ppk-File, are you sure it is it really OpenSSH-Format?

Just tried it with a keypair generated by ssh-keygen on Ubuntu-Linux and passphrase "€€€".
Works fine here.

Jun 23, 2013 at 11:56 AM
Funny... Puttygen is unable to import my ssh-keygen test-key, since it does not accept the passphrase "€€€".

Now I'm sure it is a puttygen-bug
Jun 23, 2013 at 1:23 PM
Indeed, I just came to the same conclusion (also tried to convert back from openssh to ppk format - without success).
Thanks for confirming this.