示例#1
0
    private void ProcessHandshake()
    {
        bool flag;

        do
        {
            flag = false;
            if (mHandshakeQueue.Available < 4)
            {
                continue;
            }
            byte[] array = new byte[4];
            mHandshakeQueue.Read(array, 0, 4, 0);
            byte b   = TlsUtilities.ReadUint8(array, 0);
            int  num = TlsUtilities.ReadUint24(array, 1);
            if (mHandshakeQueue.Available < num + 4)
            {
                continue;
            }
            byte[] array2 = mHandshakeQueue.RemoveData(num, 4);
            CheckReceivedChangeCipherSpec(mConnectionState == 16 || b == 20);
            if (b != 0)
            {
                TlsContext context = Context;
                if (b == 20 && mExpectedVerifyData == null && context.SecurityParameters.MasterSecret != null)
                {
                    mExpectedVerifyData = CreateVerifyData(!context.IsServer);
                }
                mRecordStream.UpdateHandshakeData(array, 0, 4);
                mRecordStream.UpdateHandshakeData(array2, 0, num);
            }
            HandleHandshakeMessage(b, array2);
            flag = true;
        }while (flag);
    }