handleDhMSG_KEXDH_REPLY method

Uint8List handleDhMSG_KEXDH_REPLY(
  1. MSG_KEXDH_REPLY msg
)

Completes Diffie-Hellman key exchange.

Implementation

Uint8List handleDhMSG_KEXDH_REPLY(MSG_KEXDH_REPLY msg) {
  Uint8List fingerprint;
  if (tracePrint != null) {
    tracePrint('$hostport: MSG_KEXDH_REPLY');
  }
  if (!acceptedHostkey) fingerprint = msg.kS;

  K = dh.computeSecret(msg.f);
  if (!computeExchangeHashAndVerifyHostKey(msg.kS, msg.hSig)) {
    throw FormatException('$hostport: verify hostkey failed');
  }

  return fingerprint;
}