private void finishKex() throws IOException { if (sessionId == null) sessionId = kxs.H; establishKeyMaterial(); /* Tell the other side that we start using the new material */ PacketNewKeys ign = new PacketNewKeys(); tm.sendKexMessage(ign.getPayload()); BlockCipher cbc; MAC mac; ICompressor comp; try { cbc = BlockCipherFactory.createCipher( kxs.np.enc_algo_client_to_server, true, km.enc_key_client_to_server, km.initial_iv_client_to_server); mac = new MAC(kxs.np.mac_algo_client_to_server, km.integrity_key_client_to_server); comp = CompressionFactory.createCompressor(kxs.np.comp_algo_client_to_server); } catch (IllegalArgumentException e1) { throw new IOException("Fatal error during MAC startup!"); } tm.changeSendCipher(cbc, mac); tm.changeSendCompression(comp); tm.kexFinished(); }