示例#1
0
        internal virtual byte[] DecodeAndVerify(byte type, Stream input, int len)
        {
            CheckLength(len, mCiphertextLimit, 22);
            byte[] array  = TlsUtilities.ReadFully(len, input);
            byte[] array2 = mReadCipher.DecodeCiphertext(mReadSeqNo++, type, array, 0, array.Length);
            CheckLength(array2.Length, mCompressedLimit, 22);
            Stream stream = mReadCompression.Decompress(mBuffer);

            if (stream != mBuffer)
            {
                stream.Write(array2, 0, array2.Length);
                stream.Flush();
                array2 = GetBufferContents();
            }
            CheckLength(array2.Length, mPlaintextLimit, 30);
            if (array2.Length < 1 && type != 23)
            {
                throw new TlsFatalAlert(47);
            }
            return(array2);
        }
示例#2
0
        internal byte[] DecodeAndVerify(
            ContentType type,
            Stream inStr,
            int len)
        {
            byte[] buf = new byte[len];
            TlsUtilities.ReadFully(buf, inStr);
            byte[] decoded = readCipher.DecodeCiphertext(type, buf, 0, buf.Length);

            Stream cOut = readCompression.Decompress(buffer);

            if (cOut == buffer)
            {
                return(decoded);
            }

            cOut.Write(decoded, 0, decoded.Length);
            cOut.Flush();
            byte[] contents = buffer.ToArray();
            buffer.SetLength(0);
            return(contents);
        }