ReadUInt24() 공개 메소드

public ReadUInt24 ( ) : UInt32
리턴 System.UInt32
예제 #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();
        }
예제 #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();
        }
예제 #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);
            }
        }
예제 #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);
            }
        }