This project is read-only.

Invalid private key file

Sep 14, 2012 at 7:41 PM
Edited Sep 14, 2012 at 8:56 PM

I used puttygen to create my public/private keys. The posting at
http://sshnet.codeplex.com/workitem/1031 makes it sound like that should work. 

However, when I call PrivateKeyFile() I get: 

Renci.sshnet.common.sshexception

Invalid private key file. Do you know what I'm doing wrong?

 

This is a sample ppk file I generated with puttygen:

 

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20120914
Public-Lines: 4
AAAAB3NzaC1yc2EAAAABJQAAAIB1Vloiwrkfz6urXrjjU+pHPTQMJUoRu7kTGMxM
MxAKfPMW3rPjlqDvb7KWVwZuMCP0orfk4fCcMglcZpT5KU53z3ZvIivqK3rcHwQq
14MOzPZ09DMOFWzD+7zhcu9KZVLIioZzcZHjkt4XRxFcDdluKMc1/g/rY88ey8nd
6LadwQ==
Private-Lines: 8
AAAAgB+2eTnTw1S0qvALw0Rb3nQeYRgKFATK87/43UUG4b2lOsfpKbMhyqGTz2bn
Fn6lOiZxKsg9EJjq7cXyNhnT0ARWit9IqQnUiNgfJimFhcyFwxW5+NspQOaWaDNc
q2mX3W60ULPqdyO2QaAP8/77EWjafroLSuamosov//yqK2lVAAAAQQC9wPE/lL95
obme0NRkz7PsqMkJ0ettql6V9DdXUoxyRu1cWLycC/6euiDpLsmlFhIbyh2CGkLp
VzvtOZIo6387AAAAQQCeTUO8JbmF3s+mjImeREyK+9uHFSr1hXafrYWrIoQN8if5
aYOLmeDRyr+8dWL7AvGxW2ge+h/etyn5w4tKKn8zAAAAQBioRozuesAw7xigsjqn
ul1K+YrgmlNnxvGiqWDI0kdh+0JY2d774A8y6IyDamgxqriFtF7b2+fAaSW+nz7P
6cY=
Private-MAC: 0d94a12415750e669e9755e520fdc967a07af47c
Sep 14, 2012 at 9:57 PM

What you need to do it open the private key in puttygen, go to the Conversions menu and choose Export OpenSSH Key. Save that new key to a file and use it.

The private key file should begin with BEGIN RSA PRIVATE KEY.

Sep 15, 2012 at 2:30 PM

That resolved my issue, thanks!