WriteUInt24() public method

public WriteUInt24 ( UInt32 value ) : void
value System.UInt32
return void
Esempio n. 1
0
        protected override byte[] EncodeDataBytes(ProtocolVersion version)
        {
            int certsLength = 0;

            foreach (X509Certificate cert in CertificateList)
            {
                certsLength += 3;
                certsLength += cert.GetRawCertData().Length;
            }

            MemoryStream    memStream = new MemoryStream();
            HandshakeStream stream    = new HandshakeStream(memStream);

            stream.WriteUInt24((UInt32)certsLength);
            foreach (X509Certificate cert in CertificateList)
            {
                byte[] certBytes = cert.GetRawCertData();

                stream.WriteUInt24((UInt32)certBytes.Length);
                stream.WriteBytes(certBytes);
            }

            return(memStream.ToArray());
        }
Esempio n. 2
0
        public byte[] Encode()
        {
            MemoryStream    memStream = new MemoryStream();
            HandshakeStream stream    = new HandshakeStream(memStream);

            byte[] dataBytes;
            try {
                dataBytes = EncodeDataBytes(_version);
            } catch (AlertException ae) {
                throw ae;
            } catch (Exception e) {
                throw new AlertException(AlertDescription.InternalError, e.Message);
            }

            stream.WriteUInt8((byte)Type);
            stream.WriteUInt24((UInt32)dataBytes.Length);
            stream.WriteBytes(dataBytes);

            return(memStream.ToArray());
        }
Esempio n. 3
0
        protected override byte[] EncodeDataBytes(ProtocolVersion version)
        {
            int certsLength = 0;
            foreach (X509Certificate cert in CertificateList) {
                certsLength += 3;
                certsLength += cert.GetRawCertData().Length;
            }

            MemoryStream memStream = new MemoryStream();
            HandshakeStream stream = new HandshakeStream(memStream);

            stream.WriteUInt24((UInt32) certsLength);
            foreach (X509Certificate cert in CertificateList) {
                byte[] certBytes = cert.GetRawCertData();

                stream.WriteUInt24((UInt32) certBytes.Length);
                stream.WriteBytes(certBytes);
            }

            return memStream.ToArray();
        }
Esempio n. 4
0
        public byte[] Encode()
        {
            MemoryStream memStream = new MemoryStream();
            HandshakeStream stream = new HandshakeStream(memStream);

            byte[] dataBytes;
            try {
                dataBytes = EncodeDataBytes(_version);
            } catch (AlertException ae) {
                throw ae;
            } catch (Exception e) {
                throw new AlertException(AlertDescription.InternalError, e.Message);
            }

            stream.WriteUInt8((byte) Type);
            stream.WriteUInt24((UInt32) dataBytes.Length);
            stream.WriteBytes(dataBytes);

            return memStream.ToArray();
        }