private void Received_PhaseLogin(VirtualClient virtualClient) { if (virtualClient.LoginInformation.LoginKey.HasValue == false) { throw new Exception("No Login Key available"); } virtualClient.Encryption = true; CLogin2Packet packet = new CLogin2Packet { Username = virtualClient.LoginInformation.Username, LoginKey = virtualClient.LoginInformation.LoginKey.Value }; Array.Copy(virtualClient.ClientKey, packet.ClientKey, 4); virtualClient.SendPacket(packet); byte[] encryptKey = new byte[16]; Buffer.BlockCopy(virtualClient.ClientKey, 0, encryptKey, 0, 16); byte[] key = CryptoUtils.GetKey_20050304Myevan(); byte[] decryptKey = TinyEncryptionAlgorithm.Encrypt(encryptKey, key); virtualClient.SetXteaKey(encryptKey, decryptKey); }