示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="packetReader"></param>
        /// <returns></returns>
        public static AuthLogonProof ReadAuthLogonProof(PacketReader packetReader)
        {
            AuthLogonProof authLogonProof = new AuthLogonProof();

            authLogonProof.CommandID = packetReader.ReadByte();

            packetReader.ReadBuffer(ref authLogonProof.m_iA, 0, authLogonProof.m_iA.Length);
            authLogonProof.m_iBigIntegerA = new BigInteger(authLogonProof.m_iA);

            packetReader.ReadBuffer(ref authLogonProof.m_iProof, 0, authLogonProof.m_iProof.Length);
            authLogonProof.m_iBigIntegerProof = new BigInteger(authLogonProof.m_iProof);

            packetReader.ReadBuffer(ref authLogonProof.m_iCrcHash, 0, authLogonProof.m_iCrcHash.Length);

            authLogonProof.NumberOfKeys = packetReader.ReadByte();
            authLogonProof.Unknown      = packetReader.ReadByte();

            return(authLogonProof);
        }
        /// <summary>
        /// 登陆验证
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void Auth_HandleAuthProof(NetState netState, PacketReader packetReader)
        {
            AuthExtendData extendData = netState.GetComponent <AuthExtendData>(AuthExtendData.COMPONENT_ID);

            if (extendData == null)
            {
                Debug.WriteLine("Auth_PacketHandlers.Auth_AuthProof(...) - extendData == null error!");
                return;
            }

            if (extendData.IsLoggedIn == false)
            {
                Debug.WriteLine("Auth_PacketHandlers.Auth_AuthProof(...) - extendData.IsLoggedIn == false error!");
                return;
            }

            extendData.AuthProof.AuthLogonProof = AuthLogonProof.ReadAuthLogonProof(packetReader);

            extendData.SRP.PublicEphemeralValueA = extendData.AuthProof.AuthLogonProof.PublicEphemeralValueA;

            if (extendData.SRP.IsClientProofValid(extendData.AuthProof.AuthLogonProof.ClientProof) == false)
            {
                // Authentication failed.
                //netState.Send( new RealmList_AuthProofResultError( RealmListErrorsInfo.LOGIN_NO_ACCOUNT ) );
                netState.Send(new Auth_AuthChallengeResultError(LogineErrorInfo.LOGIN_NO_ACCOUNT));
                return;
            }

            // 添加到全局的Key中
            SrpHandler.AddSRP(extendData.WowAccount.AccountName, extendData.SRP);

            // we're authenticated now :)
            extendData.IsAuthenticated = true;

            netState.Send(new Auth_AuthProofResult(extendData.SRP));
        }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="packetReader"></param>
        /// <returns></returns>
        public static AuthLogonProof ReadAuthLogonProof( PacketReader packetReader )
        {
            AuthLogonProof authLogonProof = new AuthLogonProof();

            authLogonProof.CommandID = packetReader.ReadByte();

            packetReader.ReadBuffer( ref authLogonProof.m_iA, 0, authLogonProof.m_iA.Length );
            authLogonProof.m_iBigIntegerA = new BigInteger( authLogonProof.m_iA );

            packetReader.ReadBuffer( ref authLogonProof.m_iProof, 0, authLogonProof.m_iProof.Length );
            authLogonProof.m_iBigIntegerProof = new BigInteger( authLogonProof.m_iProof );

            packetReader.ReadBuffer( ref authLogonProof.m_iCrcHash, 0, authLogonProof.m_iCrcHash.Length );

            authLogonProof.NumberOfKeys = packetReader.ReadByte();
            authLogonProof.Unknown = packetReader.ReadByte();

            return authLogonProof;
        }