return;
}
if (kxs.state == 2)
{
PacketKexDhGexReply dhgexrpl = new PacketKexDhGexReply(msg, 0, msglen);
kxs.hostkey = dhgexrpl.getHostKey();
if (verifier != null)
{
boolean vres = false;
try
{
vres = verifier.verifyServerHostKey(hostname, port, kxs.np.server_host_key_algo, kxs.hostkey);
}
catch (Exception e)
{
throw (IOException) new IOException(
"The server hostkey was not accepted by the verifier callback.").initCause(e);
}
if (vres == false)
throw new IOException("The server hostkey was not accepted by the verifier callback");
}
kxs.dhgx.setF(dhgexrpl.getF());
try
{
kxs.H = kxs.dhgx.calculateH(csh.getClientString(), csh.getServerString(),
kxs.localKEX.getPayload(), kxs.remoteKEX.getPayload(), dhgexrpl.getHostKey(),
kxs.dhgexParameters);
}
catch (IllegalArgumentException e)
{
throw (IOException) new IOException("KEX error.").initCause(e);
}
boolean res = verifySignature(dhgexrpl.getSignature(), kxs.hostkey);
if (res == false)
throw new IOException("Hostkey signature sent by remote is wrong!");
kxs.K = kxs.dhgx.getK();