SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
SSH.NET is a Secure Shell (SSH-2) library for .NET, optimized for parallelism.
This project was inspired by Sharp.SSH library which was ported from java and it seems like was not supported for quite some time. This library is a complete rewrite, without any third party dependencies, using parallelism to achieve the best performance possible.
There is MSDN-style class documentation in a .chm file for each release, which you can find in the Assets section of the latest release page. Please note that you will need to right-click and "unblock" the CHM file after you download it.
Currently (4/18/2020), the documentation is very sparse. Fortunately, there are a large number of tests in Renci.SshNet.Tests that demonstrate usage with working code.
If the test for the functionality you would like to see documented is not complete, then you are cordially invited to read the source, Luke, and highly encouraged to generate a pull request for the implementation of the missing test once you figure things out. 🤓
SSH.NET supports the following encryption methods:
SSH.NET supports the following key exchange methods:
SSH.NET supports the following private key formats:
Private keys can be encrypted using one of the following cipher methods:
SSH.NET supports the following host key algorithms:
SSH.NET supports the following MAC algorithms:
SSH.NET supports the following target frameworks:
Establish a SFTP connection using both password and public-key authentication:
var connectionInfo = new ConnectionInfo("sftp.foo.com",
"guest",
new PasswordAuthenticationMethod("guest", "pwd"),
new PrivateKeyAuthenticationMethod("rsa.key"));
using (var client = new SftpClient(connectionInfo))
{
client.Connect();
}
Establish a SSH connection using user name and password, and reject the connection if the fingerprint of the server does not match the expected fingerprint:
string expectedFingerPrint = "LKOy5LvmtEe17S4lyxVXqvs7uPMy+yF79MQpHeCs/Qo";
using (var client = new SshClient("sftp.foo.com", "guest", "pwd"))
{
client.HostKeyReceived += (sender, e) =>
{
e.CanTrust = expectedFingerPrint.Equals(e.FingerPrintSHA256);
};
client.Connect();
}
Do you or your company rely on SSH.NET in your projects? If you want to encourage us to keep on going and show us that you appreciate our work, please consider becoming a sponsor through GitHub Sponsors.