Example #1
0
        public override void ParseFromNetworkMessage(NetworkMessage message)
        {
            ClientType         = message.ReadUInt16();
            ProtocolVersion    = message.ReadUInt16();
            ClientVersion      = message.ReadUInt32();
            DatRevision        = message.ReadUInt16();
            ClientPreviewState = message.ReadByte();

            var rsaStartPosition = message.Position;

            if (message.ReadByte() != 0)
            {
                throw new Exception("[ClientPackets.Login.ParseFromNetworkMessage] RSA decryption failed.");
            }

            XteaKey.Clear();
            for (var i = 0; i < 4; ++i)
            {
                XteaKey.Add(message.ReadUInt32());
            }
            Client.Connection.SetXteaKey(XteaKey);

            IsGameMaster       = message.ReadBool();
            SessionKey         = message.ReadString();
            CharacterName      = message.ReadString();
            ChallengeTimeStamp = message.ReadUInt32();
            ChallengeRandom    = message.ReadByte();

            // Skip the RSA encryption junk data.
            var rsaEndPosition = message.Position;

            message.Seek((int)(128 - (rsaStartPosition - rsaEndPosition)), SeekOrigin.Current);
        }
Example #2
0
        public override void ParseFromNetworkMessage(NetworkMessage message)
        {
            ClientType      = message.ReadUInt16();
            ProtocolVersion = message.ReadUInt16();
            ClientVersion   = message.ReadUInt32();

            if (Client.VersionNumber >= 124010030)
            {
                Version = message.ReadString();
            }

            DatRevision        = message.ReadUInt16();
            ClientPreviewState = message.ReadByte();

            if (message.ReadByte() != 0)
            {
                throw new Exception("[ClientPackets.Login.ParseFromNetworkMessage] RSA decryption failed.");
            }

            XteaKey.Clear();
            for (var i = 0; i < 4; ++i)
            {
                XteaKey.Add(message.ReadUInt32());
            }
            Client.Connection.SetXteaKey(XteaKey);

            IsGameMaster       = message.ReadBool();
            SessionKey         = message.ReadString();
            CharacterName      = message.ReadString();
            ChallengeTimeStamp = message.ReadUInt32();
            ChallengeRandom    = message.ReadByte();

            // Skip the RSA encryption junk data.
            message.Seek((int)message.Size, SeekOrigin.Begin);
        }