public static byte[] CreateServerNameExtension(ServerNameList serverNameList)
    {
        if (serverNameList == null)
        {
            throw new TlsFatalAlert(80);
        }
        MemoryStream memoryStream = new MemoryStream();

        serverNameList.Encode(memoryStream);
        return(memoryStream.ToArray());
    }
示例#2
0
        public override System.Collections.IDictionary GetClientExtensions()
        {
            IList serverNames = new ArrayList();

            serverNames.Add(new ServerName(NameType.host_name, hostName));
            ServerNameList serverNameList = new ServerNameList(serverNames);
            IDictionary    extensions     = base.GetClientExtensions();

            TlsExtensionsUtilities.AddServerNameExtension(extensions, serverNameList);
            return(extensions);
        }
    public static ServerNameList ReadServerNameExtension(byte[] extensionData)
    {
        if (extensionData == null)
        {
            throw new ArgumentNullException("extensionData");
        }
        MemoryStream   memoryStream = new MemoryStream(extensionData, writable: false);
        ServerNameList result       = ServerNameList.Parse(memoryStream);

        TlsProtocol.AssertEmpty(memoryStream);
        return(result);
    }
示例#4
0
        /// <summary>
        /// Creates instance of the <see cref="FastWindowGridModel&lt;T&gt;"/>
        /// </summary>
        public FastWindowGridModel(int rowCount)
        {
            RowCount = rowCount;

            //Store the column names via reflection
            ColumnPropertyInfoList = typeof(T).GetProperties().ToList();
            for (var i = 0; i < ColumnPropertyInfoList.Count; i++)
            {
                //Store the display and server column name
                var attribs = ColumnPropertyInfoList[i].GetCustomAttributes(typeof(ColumnNameAttribute)).ToList();
                if (attribs.Any())
                {
                    var attrib = (ColumnNameAttribute)attribs.First();
                    ColumnNameList.Add(attrib.DisplayName);
                    ServerNameList.Add(attrib.ServerName);
                }
                else
                {
                    var name = ColumnPropertyInfoList[i].Name;
                    ColumnNameList.Add(name);
                    ServerNameList.Add(name);
                }

                //See if there is a width override
                attribs = ColumnPropertyInfoList[i].GetCustomAttributes(typeof(ColumnWidthAttribute)).ToList();
                if (attribs.Any())
                {
                    var attrib = (ColumnWidthAttribute)attribs.First();
                    ColumnWidthOverrides[i] = attrib.Width;
                }
            }

            ColumnCount = ColumnPropertyInfoList.Count;

            //Fill the default filter strings
            for (var i = 0; i < ColumnCount; i++)
            {
                ColumnFilters.Add(string.Empty);
            }

            //Fill the grid with blank rows
            ClearGridRows(0, true);
        }
 public static void AddServerNameExtension(IDictionary extensions, ServerNameList serverNameList)
 {
     extensions[0] = CreateServerNameExtension(serverNameList);
 }