Пример #1
0
        /// <summary>
        /// Checks if the client's proof matches our proof.
        /// </summary>
        /// <param name="packet">the packet to read from</param>
        /// <returns>true if the client proof matches; false otherwise</returns>
        public bool IsClientProofValid(PacketIn packet)
        {
            m_srp.PublicEphemeralValueA = packet.ReadBigInteger(32);

            BigInteger proof = packet.ReadBigInteger(20);

            // SHA1 of PublicEphemeralValueA and the 16 random bytes sent in
            // AUTH_LOGON_CHALLENGE from the server
            byte[] arr = packet.ReadBytes(20);

            byte keyCount = packet.ReadByte();

            for (int i = 0; i < keyCount; i++)
            {
                ushort keyUnk1     = packet.ReadUInt16();
                uint   keyUnk2     = packet.ReadUInt32();
                byte[] keyUnkArray = packet.ReadBytes(4);
                // sha of the SRP's PublicEphemeralValueA, PublicEphemeralValueB,
                // and 20 unknown bytes
                byte[] keyUnkSha = packet.ReadBytes(20);
            }

            byte securityFlags = packet.ReadByte();

            if ((securityFlags & 1) != 0)
            {
                // PIN
                byte[] pinRandom = packet.ReadBytes(16);
                byte[] pinSha    = packet.ReadBytes(20);
            }
            if ((securityFlags & 2) != 0)
            {
                byte[] security2Buf = packet.ReadBytes(20);
            }
            if ((securityFlags & 4) != 0)
            {
                byte   arrLen       = packet.ReadByte();
                byte[] security4Buf = packet.ReadBytes(arrLen);
            }

            return(m_srp.IsClientProofValid(proof));
        }
Пример #2
0
        /// <summary>Checks if the client's proof matches our proof.</summary>
        /// <param name="packet">the packet to read from</param>
        /// <returns>true if the client proof matches; false otherwise</returns>
        public bool IsClientProofValid(PacketIn packet)
        {
            this.m_srp.PublicEphemeralValueA = packet.ReadBigInteger(32);
            BigInteger client_proof = packet.ReadBigInteger(20);

            packet.ReadBytes(20);
            byte num1 = packet.ReadByte();

            for (int index = 0; index < (int)num1; ++index)
            {
                packet.ReadUInt16();
                packet.ReadUInt32();
                packet.ReadBytes(4);
                packet.ReadBytes(20);
            }

            byte num2 = packet.ReadByte();

            if (((int)num2 & 1) != 0)
            {
                packet.ReadBytes(16);
                packet.ReadBytes(20);
            }

            if (((int)num2 & 2) != 0)
            {
                packet.ReadBytes(20);
            }
            if (((int)num2 & 4) != 0)
            {
                byte num3 = packet.ReadByte();
                packet.ReadBytes((int)num3);
            }

            return(this.m_srp.IsClientProofValid(client_proof));
        }