public ClientSession(Socket pSocket) : base(pSocket) { IP = BitConverter.ToUInt32(IPAddress.Parse(GetIP()).GetAddressBytes(), 0); InitiateReceive(2, true); CurrentChannel = null; CurrentRoom = null; CRYPT_KEY = CryptoGenerators.GenerateKey(); CRYPT_HMAC = CryptoGenerators.GenerateKey(); byte[] TEMP_PREFIX = CryptoGenerators.GeneratePrefix(); // Prefix LogFactory.GetLog("Main").LogHex("IV: ", CRYPT_KEY); LogFactory.GetLog("Main").LogHex("HMAC: ", CRYPT_HMAC); using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_ACCEPT_CONNECTION_NOT)) { oPacket.WriteBytes(TEMP_PREFIX); oPacket.WriteInt((int)8); oPacket.WriteBytes(CRYPT_HMAC); oPacket.WriteInt((int)8); oPacket.WriteBytes(CRYPT_KEY); oPacket.WriteHexString("00 00 00 01 00 00 00 00 00 00 00 00"); oPacket.Assemble(CryptoConstants.GC_DES_KEY, CryptoConstants.GC_HMAC_KEY, CRYPT_PREFIX, ++CRYPT_COUNT); Send(oPacket); } // Prefix CRYPT_PREFIX = TEMP_PREFIX; }
public ClientSession(Socket pSocket) : base(pSocket) { IP = BitConverter.ToUInt32(IPAddress.Parse(GetIP()).GetAddressBytes(), 0); InitiateReceive(2, true); CRYPT_KEY = CryptoGenerators.GenerateKey(); CRYPT_HMAC = CryptoGenerators.GenerateKey(); byte[] TEMP_PREFIX = CryptoGenerators.GeneratePrefix(); using (OutPacket oPacket = new OutPacket(CenterOpcodes.SET_SECURITY_KEY_NOT)) { oPacket.WriteBytes(TEMP_PREFIX); oPacket.WriteInt((int)8); oPacket.WriteBytes(CRYPT_HMAC); oPacket.WriteInt((int)8); oPacket.WriteBytes(CRYPT_KEY); oPacket.WriteHexString("00 00 00 01 00 00 00 00 00 00 00 00"); oPacket.Assemble(CryptoConstants.GC_DES_KEY, CryptoConstants.GC_HMAC_KEY, CRYPT_PREFIX, ++CRYPT_COUNT); Send(oPacket); } CRYPT_PREFIX = TEMP_PREFIX; using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_WAIT_TIME_NOT)) { oPacket.WriteHexString("00 00 27 10"); oPacket.Assemble(CRYPT_KEY, CRYPT_HMAC, CRYPT_PREFIX, ++CRYPT_COUNT); Send(oPacket); } }