CheckUint24() public static method

public static CheckUint24 ( int i ) : void
i int
return void
示例#1
0
        public virtual void Encode(Stream output)
        {
            global::System.Collections.IList list = Platform.CreateArrayList(mCertificateList.Length);
            int num = 0;

            X509CertificateStructure[] array = mCertificateList;
            foreach (Asn1Encodable asn1Encodable in array)
            {
                byte[] encoded = asn1Encodable.GetEncoded("DER");
                list.Add((object)encoded);
                num += encoded.Length + 3;
            }
            TlsUtilities.CheckUint24(num);
            TlsUtilities.WriteUint24(num, output);
            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)list).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    byte[] buf = (byte[])enumerator.get_Current();
                    TlsUtilities.WriteOpaque24(buf, output);
                }
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
示例#2
0
        public virtual void Encode(Stream output)
        {
            IList list = Platform.CreateArrayList(this.mCertificateList.Length);
            int   i    = 0;

            X509CertificateStructure[] mCertificateList = this.mCertificateList;
            for (int j = 0; j < mCertificateList.Length; j++)
            {
                byte[] encoded = mCertificateList[j].GetEncoded("DER");
                list.Add(encoded);
                i += encoded.Length + 3;
            }
            TlsUtilities.CheckUint24(i);
            TlsUtilities.WriteUint24(i, output);
            IEnumerator enumerator = list.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    byte[] current = (byte[])enumerator.Current;
                    TlsUtilities.WriteOpaque24(current, output);
                }
            }
            finally
            {
                if (enumerator is IDisposable disposable)
                {
                    IDisposable disposable;
                    disposable.Dispose();
                }
            }
        }
示例#3
0
            internal void WriteToRecordStream(TlsProtocol protocol)
            {
                long num = this.Length - 4L;

                TlsUtilities.CheckUint24(num);
                this.Position = 1L;
                TlsUtilities.WriteUint24((int)num, this);
                protocol.WriteHandshakeMessage(this.GetBuffer(), 0, (int)this.Length);
                this.Close();
            }
示例#4
0
            internal void WriteToRecordStream(TlsProtocol protocol)
            {
                // Patch actual length back in
                long length = Length - 4;

                TlsUtilities.CheckUint24(length);
                this.Position = 1;
                TlsUtilities.WriteUint24((int)length, this);
                protocol.WriteHandshakeMessage(GetBuffer(), 0, (int)Length);
                this.Close();
            }
示例#5
0
            internal void WriteToRecordStream(TlsProtocol protocol)
            {
                long num = Length - 4;

                TlsUtilities.CheckUint24(num);
                Position = 1L;
                TlsUtilities.WriteUint24((int)num, this);
                byte[] buf = ToArray();
                protocol.WriteHandshakeMessage(buf, 0, (int)Length);
                Dispose();
            }
示例#6
0
            internal void WriteToRecordStream(TlsProtocol protocol)
            {
                long i = this.Length - 4L;

                TlsUtilities.CheckUint24(i);
                this.Position = 1L;
                TlsUtilities.WriteUint24((int)i, this);
                byte[] buf    = this.GetBuffer();
                int    length = (int)this.Length;

                protocol.WriteHandshakeMessage(buf, 0, length);
                Platform.Dispose(this);
            }
示例#7
0
            internal void WriteToRecordStream(TlsProtocol protocol)
            {
                long num = ((Stream)this).get_Length() - 4;

                TlsUtilities.CheckUint24(num);
                ((Stream)this).set_Position(1L);
                TlsUtilities.WriteUint24((int)num, (Stream)(object)this);
                byte[] buffer = ((MemoryStream)this).GetBuffer();
                int    len    = (int)((Stream)this).get_Length();

                protocol.WriteHandshakeMessage(buffer, 0, len);
                Platform.Dispose((Stream)(object)this);
            }
 internal void SendMessage(byte msg_type, byte[] body)
 {
     TlsUtilities.CheckUint24(body.Length);
     if (!this.mSending)
     {
         this.CheckInboundFlight();
         this.mSending = true;
         this.mOutboundFlight.Clear();
     }
     DtlsReliableHandshake.Message message = new DtlsReliableHandshake.Message(this.mMessageSeq++, msg_type, body);
     this.mOutboundFlight.Add(message);
     this.WriteMessage(message);
     this.UpdateHandshakeMessagesDigest(message);
 }
        internal void SendMessage(byte msg_type, byte[] body)
        {
            TlsUtilities.CheckUint24(body.Length);
            if (!mSending)
            {
                CheckInboundFlight();
                mSending = true;
                mOutboundFlight.Clear();
            }
            Message message = new Message(mMessageSeq++, msg_type, body);

            mOutboundFlight.Add((object)message);
            WriteMessage(message);
            UpdateHandshakeMessagesDigest(message);
        }
示例#10
0
        public virtual void Encode(Stream output)
        {
            IList list = Platform.CreateArrayList(mCertificateList.Length);
            int   num  = 0;

            X509CertificateStructure[] array = mCertificateList;
            foreach (Asn1Encodable asn1Encodable in array)
            {
                byte[] encoded = asn1Encodable.GetEncoded("DER");
                list.Add(encoded);
                num += encoded.Length + 3;
            }
            TlsUtilities.CheckUint24(num);
            TlsUtilities.WriteUint24(num, output);
            foreach (byte[] item in list)
            {
                TlsUtilities.WriteOpaque24(item, output);
            }
        }
示例#11
0
        public virtual void Encode(Stream output)
        {
            IList list = Platform.CreateArrayList(this.mCertificateList.Length);
            int   num  = 0;

            X509CertificateStructure[] array = this.mCertificateList;
            for (int i = 0; i < array.Length; i++)
            {
                Asn1Encodable asn1Encodable = array[i];
                byte[]        encoded       = asn1Encodable.GetEncoded("DER");
                list.Add(encoded);
                num += encoded.Length + 3;
            }
            TlsUtilities.CheckUint24(num);
            TlsUtilities.WriteUint24(num, output);
            foreach (byte[] buf in list)
            {
                TlsUtilities.WriteOpaque24(buf, output);
            }
        }
示例#12
0
        /**
         * Encode this {@link Certificate} to a {@link Stream}.
         *
         * @param output the {@link Stream} to encode to.
         * @throws IOException
         */
        public virtual void Encode(Stream output)
        {
            IList derEncodings = Org.BouncyCastle.Utilities.Platform.CreateArrayList(mCertificateList.Length);

            int totalLength = 0;

            foreach (Asn1Encodable asn1Cert in mCertificateList)
            {
                byte[] derEncoding = asn1Cert.GetEncoded(Asn1Encodable.Der);
                derEncodings.Add(derEncoding);
                totalLength += derEncoding.Length + 3;
            }

            TlsUtilities.CheckUint24(totalLength);
            TlsUtilities.WriteUint24(totalLength, output);

            foreach (byte[] derEncoding in derEncodings)
            {
                TlsUtilities.WriteOpaque24(derEncoding, output);
            }
        }
示例#13
0
        internal void SendMessage(byte msg_type, byte[] body)
        {
            TlsUtilities.CheckUint24(body.Length);

            if (mResendTimeout != null)
            {
                CheckInboundFlight();

                mResendMillis  = -1;
                mResendTimeout = null;

                mOutboundFlight.Clear();
            }

            Message message = new Message(mMessageSeq++, msg_type, body);

            mOutboundFlight.Add(message);

            WriteMessage(message);
            UpdateHandshakeMessagesDigest(message);
        }