This project is read-only.

Sftp using ppk authentication

Jan 27, 2012 at 2:49 PM

Hy at all,  I'm looking a valid working c# example to upload files on remote server using library, i need  doing SFTP with  publickey  authentication, could someone help me ?  thank you very much


Jan 27, 2012 at 4:40 PM

All you need to do is to use private key for authentication.

You can use this code to create connectionInfo object that can be used later for authentication.

            var connectionInfo = new PrivateKeyConnectionInfo("server", "username", new PrivateKeyFile(new MemoryStream(Encoding.ASCII.GetBytes(dsaKey))));

Where dsaKey is string that contain your private key.

You can also replace MemoryStream with FileStream, where it will read key information from the file.


Hope it helps,