SSH.NET is a .NET library that implements the SSH-2 protocol for encrypted remote connections and secure file transfers. It provides a complete SSH-2 protocol stack implementation with a channel multiplexing engine that manages multiple concurrent channels over a single connection, supporting simultaneous shell sessions, remote command execution, SFTP transfers, and port forwarding tunnels. The library includes a pluggable authentication pipeline supporting password, public key, certificate, keyboard-interactive, and multi-factor authentication combinations.
The library distinguishes itself through its comprehensive file transfer capabilities, offering both SFTP and SCP protocols with stream-based file access patterns that integrate with standard .NET I/O patterns. It includes a port forwarding tunnel manager for creating local, remote, and dynamic port forwarding tunnels with lifecycle events and configurable timeout handling. SSH.NET also supports NETCONF device management over SSH, proxy connections through SOCKS4, SOCKS5, and HTTP proxies, and provides event-driven protocol message dispatching for extensible message processing.
The library covers the full range of SSH operations including remote command execution with background execution and stream-based input, interactive shell sessions with terminal resizing and output pattern matching, and comprehensive file management through SFTP including directory synchronization, permission changes, and metadata queries. It includes key generation for ECDSA, ED25519, and RSA key pairs, private key loading and decryption in multiple formats, and OpenSSH certificate parsing. Session management features include keep-alive signals, configurable timeouts, retry logic for channel creation, and resource limit controls.
The library is available as a set of client libraries covering SSH authentication, SFTP, SCP, port forwarding, and NETCONF operations, with internal logging support for troubleshooting connections.