Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authenticate using .ppk private key using SSH.NET library

I am trying to login to the remote SFTP server from my .NET code using Renci.SshNet library using .ppk format private key. It is showing error.

I know it will work with .PEM format. But as the key for the application is generated by client, I can't change the format.

Is there a way to use .ppk private key to authenticate and upload file from my .NET C# code?

Any suitable library?

like image 938
Metallic Skeleton Avatar asked May 18 '26 08:05

Metallic Skeleton


1 Answers

It has to be PEM format if you want to keep using SSH.NET. So either they generate the key in PEM format. Or at least they convert it to the PEM format. Or your software will have to convert it.

I'm not aware of any library that can do the conversion. All I can suggest is that you use bundle some command-line tool that can do it. For example my WinSCP can do that.
See Convert .pem key file to .ppk in Windows automatically/script/command line.


If want to change the library, you can use my WinSCP .NET assembly. It supports .ppk keys. But it's just a wrapper around WinSCP itself. So it's about the same as using WinSCP for the conversion.

like image 59
Martin Prikryl Avatar answered May 20 '26 22:05

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!