예제 #1
0
        protected override void ConstructResponse(GPCMSession session)
        {
            session.PlayerInfo.SessionKey = _crc.ComputeChecksum(session.PlayerInfo.Nick + session.PlayerInfo.NamespaceID);
            string responseProof = ChallengeProof.GenerateProof
                                   (
                session.PlayerInfo.UserData,
                session.PlayerInfo.LoginType,
                session.PlayerInfo.PartnerID,
                session.PlayerInfo.ServerChallenge,
                session.PlayerInfo.UserChallenge,
                session.PlayerInfo.PasswordHash
                                   );

            _sendingBuffer  = @"\lc\2\sesskey\" + session.PlayerInfo.SessionKey;
            _sendingBuffer += @"\proof\" + responseProof;
            _sendingBuffer += @"\userid\" + _result[0]["userid"];
            _sendingBuffer += @"\profileid\" + _result[0]["profileid"];

            if (session.PlayerInfo.LoginType != LoginType.Nick)
            {
                _sendingBuffer += @"\uniquenick\" + _result[0]["uniquenick"];
            }

            _sendingBuffer += @"\lt\" + session.Id.ToString().Replace("-", "").Substring(0, 22) + "__";
            _sendingBuffer += @"\id\" + _operationID + @"\final\";

            session.PlayerInfo.LoginProcess = LoginStatus.Completed;
        }
예제 #2
0
        protected override void BuildNormalResponse()
        {
            //string checkSumStr = _result.Nick + _result.UniqueNick + _result.NamespaceID;

            //_session.UserData.SessionKey = _crc.ComputeChecksum(checkSumStr);

            ChallengeProofData proofData = new ChallengeProofData(
                _request.UserData,
                _request.LoginType,
                _request.PartnerID,
                ChallengeProofData.ServerChallenge,
                _request.UserChallenge,
                _result.PasswordHash);

            string responseProof =
                ChallengeProof.GenerateProof(proofData);

            _sendingBuffer  = @"\lc\2\sesskey\" + UserData.SessionKey;
            _sendingBuffer += @"\proof\" + responseProof;
            _sendingBuffer += @"\userid\" + _result.UserID;
            _sendingBuffer += @"\profileid\" + _result.ProfileID;

            if (_request.LoginType != LoginType.NickEmail)
            {
                _sendingBuffer += @"\uniquenick\" + _result.UniqueNick;
            }
            _sendingBuffer += $@"\lt\{UserData.LoginTicket}";
            _sendingBuffer += $@"\id\{_request.OperationID}\final\";

            _session.UserData.LoginStatus = LoginStatus.Completed;
        }
예제 #3
0
        protected bool IsChallengeCorrect(GPCMSession session)
        {
            string response = ChallengeProof.GenerateProof
                              (
                session.PlayerInfo.UserData,
                session.PlayerInfo.LoginType,
                session.PlayerInfo.PartnerID,
                session.PlayerInfo.UserChallenge,
                session.PlayerInfo.ServerChallenge,
                session.PlayerInfo.PasswordHash
                              );

            if (_recv["response"] == response)
            {
                return(true);
            }
            return(false);
        }
예제 #4
0
        protected bool IsChallengeCorrect()
        {
            ChallengeProofData proofData = new ChallengeProofData(
                _request.UserData,
                _request.LoginType,
                _request.PartnerID,
                _request.UserChallenge,
                ChallengeProofData.ServerChallenge,
                _result.PasswordHash);

            string response = ChallengeProof.GenerateProof(proofData);

            if (_request.Response == response)
            {
                return(true);
            }
            return(false);
        }