CheckUint8() 공개 정적인 메소드

public static CheckUint8 ( int i ) : void
i int
리턴 void
예제 #1
0
        private static ProtocolVersion GetUnknownVersion(int major, int minor, string prefix)
        {
            TlsUtilities.CheckUint8(major);
            TlsUtilities.CheckUint8(minor);
            int    num = major << 8 | minor;
            string str = Platform.ToUpperInvariant(Convert.ToString(65536 | num, 16).Substring(1));

            return(new ProtocolVersion(num, prefix + " 0x" + str));
        }
예제 #2
0
        private static ProtocolVersion GetUnknownVersion(int major, int minor, string prefix)
        {
            TlsUtilities.CheckUint8(major);
            TlsUtilities.CheckUint8(minor);
            int    v   = (major << 8) | minor;
            string str = Platform.ToUpperInvariant(Convert.ToString((int)(0x10000 | v), 0x10).Substring(1));

            return(new ProtocolVersion(v, prefix + " 0x" + str));
        }
예제 #3
0
        private static ProtocolVersion GetUnknownVersion(int major, int minor, string prefix)
        {
            TlsUtilities.CheckUint8(major);
            TlsUtilities.CheckUint8(minor);

            int    v   = (major << 8) | minor;
            String hex = Org.BouncyCastle.Utilities.Platform.ToUpperInvariant(Convert.ToString(0x10000 | v, 16).Substring(1));

            return(new ProtocolVersion(v, prefix + " 0x" + hex));
        }
예제 #4
0
        protected static byte[] PatchClientHelloWithCookie(byte[] clientHelloBody, byte[] cookie)
        {
            int num  = 34;
            int num2 = (int)TlsUtilities.ReadUint8(clientHelloBody, num);
            int num3 = num + 1 + num2;
            int num4 = num3 + 1;

            byte[] array = new byte[clientHelloBody.Length + cookie.Length];
            Array.Copy(clientHelloBody, 0, array, 0, num3);
            TlsUtilities.CheckUint8(cookie.Length);
            TlsUtilities.WriteUint8((byte)cookie.Length, array, num3);
            Array.Copy(cookie, 0, array, num4, cookie.Length);
            Array.Copy(clientHelloBody, num4, array, num4 + cookie.Length, clientHelloBody.Length - num4);
            return(array);
        }
예제 #5
0
        protected static byte[] PatchClientHelloWithCookie(byte[] clientHelloBody, byte[] cookie)
        {
            int sessionIDPos    = 34;
            int sessionIDLength = TlsUtilities.ReadUint8(clientHelloBody, sessionIDPos);

            int cookieLengthPos = sessionIDPos + 1 + sessionIDLength;
            int cookiePos       = cookieLengthPos + 1;

            byte[] patched = new byte[clientHelloBody.Length + cookie.Length];
            Array.Copy(clientHelloBody, 0, patched, 0, cookieLengthPos);
            TlsUtilities.CheckUint8(cookie.Length);
            TlsUtilities.WriteUint8((byte)cookie.Length, patched, cookieLengthPos);
            Array.Copy(cookie, 0, patched, cookiePos, cookie.Length);
            Array.Copy(clientHelloBody, cookiePos, patched, cookiePos + cookie.Length, clientHelloBody.Length - cookiePos);

            return(patched);
        }