ReadUInt24() public method

public ReadUInt24 ( ) : UInt32
return System.UInt32
Ejemplo n.º 1
0
        protected override void DecodeDataBytes(ProtocolVersion version, byte[] data)
        {
            CertificateList.Clear();

            MemoryStream    memStream   = new MemoryStream(data);
            HandshakeStream stream      = new HandshakeStream(memStream);
            int             certsLength = (int)stream.ReadUInt24();

            int readBytes = 0;

            while (readBytes < certsLength)
            {
                int    certLength = (int)stream.ReadUInt24();
                byte[] certBytes  = stream.ReadBytes(certLength);
                readBytes += 3 + certLength;

                CertificateList.Add(new X509Certificate(certBytes));
            }
            if (readBytes != certsLength)
            {
                throw new AlertException(AlertDescription.IllegalParameter,
                                         "Certificate total length doesn't match contents");
            }
            stream.ConfirmEndOfStream();
        }
Ejemplo n.º 2
0
        protected override void DecodeDataBytes(ProtocolVersion version, byte[] data)
        {
            CertificateList.Clear();

            MemoryStream memStream = new MemoryStream(data);
            HandshakeStream stream = new HandshakeStream(memStream);
            int certsLength = (int) stream.ReadUInt24();

            int readBytes = 0;
            while (readBytes<certsLength) {
                int certLength = (int) stream.ReadUInt24();
                byte[] certBytes = stream.ReadBytes(certLength);
                readBytes += 3+certLength;

                CertificateList.Add(new X509Certificate(certBytes));
            }
            if (readBytes != certsLength) {
                throw new AlertException(AlertDescription.IllegalParameter,
                                         "Certificate total length doesn't match contents");
            }
            stream.ConfirmEndOfStream();
        }
Ejemplo n.º 3
0
        public void Decode(byte[] data)
        {
            MemoryStream    memStream = new MemoryStream(data);
            HandshakeStream stream    = new HandshakeStream(memStream);

            int type = (int)stream.ReadUInt8();

            if (type != (int)Type)
            {
                throw new AlertException(AlertDescription.InternalError, "Incorrect message type");
            }

            int fragmentLength = (int)stream.ReadUInt24();

            byte[] fragment = stream.ReadBytes(fragmentLength);

            try {
                DecodeDataBytes(_version, fragment);
            } catch (AlertException ae) {
                throw ae;
            } catch (Exception e) {
                throw new AlertException(AlertDescription.InternalError, e.Message);
            }
        }
Ejemplo n.º 4
0
        public void Decode(byte[] data)
        {
            MemoryStream memStream = new MemoryStream(data);
            HandshakeStream stream = new HandshakeStream(memStream);

            int type = (int) stream.ReadUInt8();
            if (type != (int) Type) {
                throw new AlertException(AlertDescription.InternalError, "Incorrect message type");
            }

            int fragmentLength = (int) stream.ReadUInt24();
            byte[] fragment = stream.ReadBytes(fragmentLength);

            try {
                DecodeDataBytes(_version, fragment);
            } catch (AlertException ae) {
                throw ae;
            } catch (Exception e) {
                throw new AlertException(AlertDescription.InternalError, e.Message);
            }
        }