Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharpSSH invalid privatekey

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?

like image 611
abc Avatar asked Nov 19 '12 07:11

abc


1 Answers

You have to convert your key to OpenSSH Format:

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

like image 91
Carlos Landeras Avatar answered Oct 20 '22 02:10

Carlos Landeras