SshSession Class
Namespace: Rebex.Net
Assembly: Rebex.Networking.dll (version 7.0.9313)
Represents a client-side SSH 2.0 session.
Syntax
public class SshSession : NetworkSession, ILogWriterProvider, IDisposable
Inherited Members
Constructors
| Name | Description |
|---|---|
| SshSession() | Initializes an instance of the SshSession class. |
| SshSession(ISocket) | Initializes an instance of the SshSession class with the specified base socket. |
| SshSession(Socket) | Initializes an instance of the SshSession class with the specified base socket. |
Fields
| Name | Description |
|---|---|
| DefaultPort | Default SSH port (22). |
Properties
| Name | Description |
|---|---|
| Cipher | Gets the active cipher. |
| DefaultLogWriter | Gets or sets a default log writer used by all new instances of NetworkSession object. Inherited from NetworkSession. |
| Encoding | Gets or sets the Encoding to use to encode and decode command parameters and server responses. |
| Fingerprint | Gets the server public key fingerprint. |
| HasAuthenticationRequestEventHandler | Gets a value indicating whether the AuthenticationRequest event is registered. |
| HasFingerprintEventHandler | Gets a value indicating whether the FingerprintCheck event is registered. |
| HasForwardingRequestEventHandler | Gets a value indicating whether the ForwardingRequest event is registered. |
| Information | Gets socket information on the underlying socket object. |
| InstanceId | Gets instance ID (intended for logging purposes). Inherited from NetworkSession. |
| IsAuthenticated | Gets a value indicating whether the session is authenticated. |
| IsConnected | Gets a value indicating whether the session is connected. |
| LocalEndPoint | Gets the local endpoint. |
| LogWriter | Gets or sets the LogWriter used by this object. Inherited from NetworkSession. |
| Options | Gets or sets SshSession options. |
| Parameters | Gets or sets the security parameters of the current socket. |
| RemoteEndPoint | Gets the remote endpoint. |
| ServerIdentification | Gets the server's identification string it returns after connected. |
| ServerInfo | Gets information about SSH negotiation. |
| ServerKey | Gets the server public key. |
| ServerName | Gets the server name, if available. Inherited from NetworkSession. |
| ServerPort | Gets the server port, if available. Inherited from NetworkSession. |
| Socket | Gets the internal ISocket value. |
| State | Gets the current session state. |
| Timeout | Gets or sets the length of time before the operation times out (specify -1 or 0 to indicate that the request does not time out). |
| UserName | Gets the authenticated user name, if available. Inherited from NetworkSession. |
Methods
| Name | Description |
|---|---|
| AcceptTcpIpForward(SshForwardingHandle) | Accepts a forwarded incoming connection. If there is no incoming connection in the queue, waits indefinitely. |
| AcceptTcpIpForward(SshForwardingHandle, Int32) | Accepts a forwarded incoming connection. |
| Authenticate(SshGssApiCredentials) | Authenticates to the server using GSSAPI. Kerberos is only supported on Mono. NTLM is supported on Windows and partially on Mono. |
| Authenticate(String) | Authenticates to the SSH server interactively. Uses AuthenticationRequest to ask for credentials. |
| Authenticate(String, SshAuthenticationAgent) | Authenticates to the SSH server using a username and a private key that is stored in |
| Authenticate(String, SshPrivateKey) | Authenticates to the SSH server using a username and an RSA or DSA private key. |
| Authenticate(String, String) | Authenticates to the SSH server using a username and password. |
| Authenticate(String, String, SshAuthenticationAgent) | Authenticates to the SSH server using a username and an RSA or DSA private key and a password. |
| Authenticate(String, String, SshPrivateKey) | Authenticates to the SSH server using a username and an RSA or DSA private key and a password. |
| ChangePassword(String, String, String) | Changes the specified user's password on the SSH server and authenticates. |
| Connect(EndPoint) | Establishes a connection to an SSH server. |
| Connect(String) | Establishes a connection to port 22 of an SSH server. |
| Connect(String, Int32) | Establishes a connection to an SSH server. |
| Disconnect() | Terminates the SSH session. |
| Dispose() | Disposes the SshSession object and the underlying socket object. |
| GetHashCode() | Gets hash code for this object. Inherited from NetworkSession. |
| KeepAlive() | Sends an SSH_MSG_IGNORE packet to the server. |
| Negotiate() | Requests and/or performs a key exchange. |
| OnAuthenticationRequest(SshAuthenticationRequestEventArgs) | Raises the AuthenticationRequest event. |
| OnBannerReceived(SshMessageEventArgs) | Raises the BannerReceived event. |
| OnFingerprintCheck(SshFingerprintEventArgs) | Raises the FingerprintCheck event. |
| OpenChannel(SshChannelType, Int32) | Opens an SSH channel of the specified type. |
| OpenSession() | Opens an SSH session channel. |
| OpenTcpIpTunnel(IPEndPoint) | Opens an outgoing TCP/IP tunnel to the specified remote endpoint. |
| OpenTcpIpTunnel(String, Int32) | Opens an outgoing TCP/IP tunnel to the specified remote endpoint. |
| StartTcpIpForward(String, Int32) | Starts incoming TCP/IP tunnel on the specified IP address and port at the SSH server. |
| StopTcpIpForward(SshForwardingHandle) | Stops an incoming TCP/IP tunnel. |
| ToSocketFactory() | Gets a socket factory that creates socket tunneled through this SSH session. |
Events
| Name | Description |
|---|---|
| AuthenticationRequest | Occurs when an authentication request is received from the server that cannot be answered programmatically. |
| BannerReceived | Occurs when a banner message is received from the server. |
| FingerprintCheck | Occurs when a fingerprint is received from the server and needs to be validated. |
| ForwardingRequest | Occurs when an incoming tunnel request has arrived. |