'Test that the KEX_DH_GEX_INIT message after the client sends
KEX_DH_GEX_REQUEST_OLD causes the server to send a KEX_DH_GEX_INIT
message with a public key and signature.'

def test_KEX_DH_GEX_INIT_after_REQUEST_OLD(self):

    self.test_KEX_DH_GEX_REQUEST_OLD()
    e = pow(self.proto.g, 3, self.proto.p)
    y = common.getMP(('\x00\x00\x01\x00' + ('\x99' * 256)))[0]
    f = common._MPpow(self.proto.g, y, self.proto.p)
    sharedSecret = common._MPpow(e, y, self.proto.p)
    h = self.hashProcessor()
    h.update((common.NS(self.proto.ourVersionString) * 2))
    h.update((common.NS(self.proto.ourKexInitPayload) * 2))
    h.update(common.NS(self.proto.factory.publicKeys['ssh-rsa'].blob()))
    h.update('\x00\x00\x04\x00')
    h.update(common.MP(self.proto.p))
    h.update(common.MP(self.proto.g))
    h.update(common.MP(e))
    h.update(f)
    h.update(sharedSecret)
    exchangeHash = h.digest()
    self.proto.ssh_KEX_DH_GEX_INIT(common.MP(e))
    self.assertEqual(self.packets[1:], [(transport.MSG_KEX_DH_GEX_REPLY, ((common.NS(self.proto.factory.publicKeys['ssh-rsa'].blob()) + f) + common.NS(self.proto.factory.privateKeys['ssh-rsa'].sign(exchangeHash)))), (transport.MSG_NEWKEYS, '')])
