Change sequence of sending NEW_KEYS message, some servers would hang during key negotiation stage

This commit is contained in:
olegkap_cp
2010-12-30 19:58:16 +00:00
parent a9c7addecd
commit 5c535899db
2 changed files with 4 additions and 7 deletions
@@ -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());
}
}
}