Let a session's transport say what it negotiated

ISshConnection and ISftpSession both carry Cipher now — the server-to-client
algorithm off SSH.NET's own ConnectionInfo, captured once because a rekey is
not an event that library raises — and TerminalWorkspace.GetSessionFacts hands
that plus the host key's algorithm back per session, without ever handing over
the connection itself. Nothing reads either yet; the status bar that will is
the next commit.
This commit is contained in:
2026-08-08 20:54:14 +02:00
parent 8915650a0d
commit 8209f15741
10 changed files with 134 additions and 0 deletions
+19
View File
@@ -98,6 +98,25 @@ public interface ISshConnection : IAsyncDisposable
/// <summary>The host key that was accepted for this connection.</summary>
HostKeyPresentation HostKey { get; }
/// <summary>
/// The negotiated server-to-client encryption algorithm, e.g. <c>aes256-gcm@openssh.com</c>.
/// </summary>
/// <remarks>
/// <para>
/// Read once, immediately after the handshake, off SSH.NET's own <c>ConnectionInfo.CurrentServerEncryption</c>.
/// The only event that could make this stale is a rekey, and SSH.NET raises no event for one and exposes no
/// way to ask again — there is nothing behind this property to go and re-read. A captured value is therefore
/// not a snapshot that might drift; it is the only value there has ever been a moment to observe.
/// </para>
/// <para>
/// <b>Server-to-client, not client-to-server.</b> SSH negotiates the two directions independently and a
/// server is free to choose differently for each, so the two can in principle disagree. This is the
/// direction the bytes drawn on a terminal pane travelled in, which is the fact a status bar showing what
/// the screen is made of should be naming.
/// </para>
/// </remarks>
string Cipher { get; }
/// <summary>Opens an interactive shell with a pseudo-terminal.</summary>
Task<ISshShellSession> OpenShellAsync(TerminalSize size, CancellationToken cancellationToken);
}