Beispiel #1
0
        public static ServerNameList Parse(Stream input)
        {
            int num = TlsUtilities.ReadUint16(input);

            if (num < 1)
            {
                throw new TlsFatalAlert(50);
            }
            byte[]       buffer       = TlsUtilities.ReadFully(num, input);
            MemoryStream memoryStream = new MemoryStream(buffer, writable: false);
            IList        list         = Platform.CreateArrayList();

            while (memoryStream.Position < memoryStream.Length)
            {
                ServerName value = ServerName.Parse(memoryStream);
                list.Add(value);
            }
            return(new ServerNameList(list));
        }
Beispiel #2
0
        public static ServerNameList Parse(Stream input)
        {
            //IL_001d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0023: Expected O, but got Unknown
            int num = TlsUtilities.ReadUint16(input);

            if (num < 1)
            {
                throw new TlsFatalAlert(50);
            }
            byte[]       array = TlsUtilities.ReadFully(num, input);
            MemoryStream val   = new MemoryStream(array, false);

            global::System.Collections.IList list = Platform.CreateArrayList();
            while (((Stream)val).get_Position() < ((Stream)val).get_Length())
            {
                ServerName serverName = ServerName.Parse((Stream)(object)val);
                list.Add((object)serverName);
            }
            return(new ServerNameList(list));
        }
        /**
         * Parse a {@link ServerNameList} from a {@link Stream}.
         *
         * @param input
         *            the {@link Stream} to parse from.
         * @return a {@link ServerNameList} object.
         * @throws IOException
         */
        public static ServerNameList Parse(Stream input)
        {
            int length = TlsUtilities.ReadUint16(input);

            if (length < 1)
            {
                throw new TlsFatalAlert(AlertDescription.decode_error);
            }

            byte[] data = TlsUtilities.ReadFully(length, input);

            MemoryStream buf = new MemoryStream(data, false);

            IList server_name_list = Platform.CreateArrayList();

            while (buf.Position < buf.Length)
            {
                ServerName entry = ServerName.Parse(buf);
                server_name_list.Add(entry);
            }

            return(new ServerNameList(server_name_list));
        }