handleEcDhMSG_KEX_ECDH_REPLY method

Uint8List handleEcDhMSG_KEX_ECDH_REPLY(
  1. MSG_KEX_ECDH_REPLY msg
)

Completes Elliptic-curve Diffie–Hellman key exchange.

Implementation

Uint8List handleEcDhMSG_KEX_ECDH_REPLY(MSG_KEX_ECDH_REPLY msg) {
  Uint8List fingerprint;
  if (tracePrint != null) {
    tracePrint('$hostport: MSG_KEX_ECDH_REPLY for ECDH');
  }
  if (!acceptedHostkey) fingerprint = msg.kS;

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

  return fingerprint;
}