handleDhMSG_KEXDH_INIT method
Implementation
void handleDhMSG_KEXDH_INIT(int packetId, MSG_KEXDH_INIT msg) {
if (packetId != MSG_KEX_DH_GEX_INIT.ID) {
initializeDiffieHellman(kexMethod, random);
}
K = dh.computeSecret(msg.e);
Uint8List kS = identity.getRawPublicKey(hostkeyType);
updateExchangeHash(kS);
Uint8List hSig = identity.signMessage(hostkeyType, exH, getSecureRandom());
writeClearOrEncrypted(packetId == MSG_KEX_DH_GEX_INIT.ID
? MSG_KEX_DH_GEX_REPLY(dh.e, kS, hSig)
: MSG_KEXDH_REPLY(dh.e, kS, hSig));
sendNewKeys();
}