Surendra Sharma

Surendra Sharma

Search This Blog

Wednesday, March 12, 2014

How to convert Private key to OpenSSH Key to connect to SFTP server

When you are trying to connecting SFTP server using Renci SSH DLL using C#, then you have to either provide username and password or username and private key.

Private Key works only with WINSCP tool and the PrivateKeyFile class in Renci SSH DLL does not accept Private Key file, so we need to convert Private key file to OpenSSH key.

After conversion of Private key file to OpenSSH key file, with our code we can able to connect, download and upload to SFTP server.

                                  Steps to convert Private file to OpenSSH Key.

1. Open PuTTY key Generator.

   2.Click on Load button 


  3. Load PRI key file .


4. After click on open button a alert pops up, click on Yes to continue.


  5. Save dialog comes up, assign name to the file and save it with .ppk extension.


Please leave your comments or share this tip if it’s useful for you.

1 comment:

  1. comments I make are never shown on the site ?
    My private key is a ppk file generated by puttygen but still sshnet gives an error "Invalid private key file"
    What must I do now ?