Table of Contents

Method RekeyAsync

Namespace
SshSharp
Assembly
SshSharp.dll

RekeyAsync(CancellationToken)

Re-exchanges keys now, as ssh's ~R escape does, and completes once the new keys are in use in both directions. Keys are also renewed on their own after RekeyAfterBytes or RekeyAfterTime, and when the server asks; if a re-exchange is already running, this waits for it instead of starting another. Channels stay open: data waits while the keys change and then continues. The host key must be the same as at the start, or the connection fails.

public Task RekeyAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Stops waiting. Once started, the exchange continues; the connection cannot go back to the old keys.

Returns

Task

Exceptions

SshException

The connection is closed or failed, or failed during the exchange.