Esempio n. 1
0
        public async Task HandleLogonProofAsync()
        {
            var clientPublicKey = await _reader.ReadBytesAsync(32);

            var clientProof = await _reader.ReadBytesAsync(20);

            var crc = await _reader.ReadBytesAsync(20);

            var keyCount = await _reader.ReadUInt8Async();

            var securityFlags = await _reader.ReadUInt8Async();

            var authStatus = _authentication.Authenticate(
                clientPublicKey.Span, clientProof.Span);

            if (!authStatus)
            {
                await _writer.FailProofAsync(AuthStatus.IncorrectPassword);

                return;
            }

            // TODO: check build number and send back appropriate packet
            // (assuming WotLK right now, 3.3.5a, build 12340)
            await _writer.PassProofAsync(
                _authentication.ComputeProof(),
                0, 0);
        }
Esempio n. 2
0
        public async Task HandleLogonProofAsync()
        {
            var clientPublicKey = await _reader.ReadBytesAsync(32);

            var clientProof = await _reader.ReadBytesAsync(20);

            var crc = await _reader.ReadBytesAsync(20);

            var keyCount = await _reader.ReadUInt8Async();

            var securityFlags = await _reader.ReadUInt8Async();

            if (!_authentication.Authenticate(clientPublicKey, clientProof))
            {
                await SendErrorAsync(AuthStatus.IncorrectPassword);

                return;
            }

            //print sessionkey

            var proof = _authentication.ComputeProof();

            _info.sessionkey = _authentication._K.ToString("x");
            _info.s          = _authentication._s.ToString("x");
            _info.v          = _authentication._v.ToString("x");
            Program.authDatabase.Accounts.Update(_info);
            Program.authDatabase.SaveChanges();

            Debug.WriteLine(_info.sessionkey);
            // TODO: check build number and send back appropriate packet
            // (assuming WotLK right now, 3.3.5a, build 12340)

            List <byte> data = new List <byte>();

            data.Add((byte)_currentCommand);              // cmd
            data.Add(0);                                  // error
            data.AddRange(proof);                         // server proof
            data.AddRange(Enumerable.Repeat((byte)0, 4)); //accountFlags
            data.AddRange(Enumerable.Repeat((byte)0, 4)); //surveyId
            data.AddRange(Enumerable.Repeat((byte)0, 2)); //unkFlags
            await _clientStream.WriteAsync(data.ToArray(), 0, data.Count);
        }