Org.BouncyCastle.Crypto.Tls.TlsProtocolHandler.ProcessData C# (CSharp) Метод

ProcessData() приватный Метод

private ProcessData ( ContentType protocol, byte buf, int offset, int len ) : void
protocol ContentType
buf byte
offset int
len int
Результат void
        internal void ProcessData(
            ContentType	protocol,
            byte[]		buf,
            int			offset,
            int			len)
        {
            /*
            * Have a look at the protocol type, and add it to the correct queue.
            */
            switch (protocol)
            {
                case ContentType.change_cipher_spec:
                    changeCipherSpecQueue.AddData(buf, offset, len);
                    ProcessChangeCipherSpec();
                    break;
                case ContentType.alert:
                    alertQueue.AddData(buf, offset, len);
                    ProcessAlert();
                    break;
                case ContentType.handshake:
                    handshakeQueue.AddData(buf, offset, len);
                    ProcessHandshake();
                    break;
                case ContentType.application_data:
                    if (!appDataReady)
                    {
                        this.FailWithError(AlertLevel.fatal, AlertDescription.unexpected_message);
                    }
                    applicationDataQueue.AddData(buf, offset, len);
                    ProcessApplicationData();
                    break;
                default:
                    /*
                    * Uh, we don't know this protocol.
                    *
                    * RFC2246 defines on page 13, that we should ignore this.
                    */
                    break;
            }
        }

Usage Example

Пример #1
0
        public void ReadData()
        {
            ContentType type = (ContentType)TlsUtilities.ReadUint8(inStr);

            TlsUtilities.CheckVersion(inStr, handler);
            int size = TlsUtilities.ReadUint16(inStr);

            byte[] buf = DecodeAndVerify(type, inStr, size);
            handler.ProcessData(type, buf, 0, buf.Length);
        }