19

I use SharpSSH to connect to a stfp-server.

This for I need to add a privatekey-file like this:

sftp.AddIdentityFile(KeyFilePath);

But this throws an exception:

invaid privatekey: C:\KeyFile\privatekey_2.ppk

The file was created with puttygen and works with filezilla. The privatekey-type doesn't matter (SSH-1 RSA, SSH-2 RSA, SSH-2 DSA). Everytime the same result.

Do you know how to handle this problem?

abc
  • 2,285
  • 5
  • 29
  • 64
  • 3
    I'm not fond of your specific library but the Putty key format is just their own format. Did you try by using a normal keyfile generated with __ssh-keygen__? – Jack Nov 19 '12 at 07:45
  • 1
    You also have the option to export the key in the standard format from puttygen, in `Conversions->Export OpenSSH Key` – onon15 Nov 19 '12 at 07:46
  • Just a note - there's no "standard" format for SSH keys - different software uses different formats. OpenSSH format is one of the popular ones, but not a standard, as it's not defined in any standard specification. – Eugene Mayevski 'Callback Nov 19 '12 at 07:56

1 Answers1

27

You have to convert your key to OpenSSH Format:

Use PuttyGen to generate and convert the key (Conversion -> export OpenSSH Key)

Carlos Landeras
  • 11,025
  • 11
  • 56
  • 82