mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Change sequence of sending NEW_KEYS message, some servers would hang during key negotiation stage
This commit is contained in:
@@ -177,13 +177,7 @@ namespace Renci.SshClient.Security
|
||||
public virtual void Finish()
|
||||
{
|
||||
// Validate hash
|
||||
var validated = this.ValidateExchangeHash();
|
||||
|
||||
if (validated)
|
||||
{
|
||||
this.SendMessage(new NewKeysMessage());
|
||||
}
|
||||
else
|
||||
if (!this.ValidateExchangeHash())
|
||||
{
|
||||
throw new SshConnectionException("Key exchange negotiation failed.", DisconnectReasons.KeyExchangeFailed);
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ namespace Renci.SshClient.Security
|
||||
this._hostKey = hostKey;
|
||||
this.SharedKey = System.Numerics.BigInteger.ModPow(serverExchangeValue, this._randomValue, this._prime);
|
||||
this._signature = signature;
|
||||
|
||||
// Whare DH reply received key exchange is completed
|
||||
this.SendMessage(new NewKeysMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user