Ejemplo n.º 1
0
        /// <exception cref="IOException"></exception>
        public static byte[] CreateServerNameExtension(ServerNameList serverNameList)
        {
            if (serverNameList == null)
            {
                throw new TlsFatalAlert(AlertDescription.internal_error);
            }

            MemoryStream buf = new MemoryStream();

            serverNameList.Encode(buf);

            return(buf.ToArray());
        }
Ejemplo n.º 2
0
        /// <exception cref="IOException"></exception>
        public static ServerNameList ReadServerNameExtension(byte[] extensionData)
        {
            if (extensionData == null)
            {
                throw new ArgumentNullException("extensionData");
            }

            MemoryStream buf = new MemoryStream(extensionData, false);

            ServerNameList serverNameList = ServerNameList.Parse(buf);

            TlsProtocol.AssertEmpty(buf);

            return(serverNameList);
        }
Ejemplo n.º 3
0
 /// <exception cref="IOException"></exception>
 public static void AddServerNameExtension(IDictionary extensions, ServerNameList serverNameList)
 {
     extensions[ExtensionType.server_name] = CreateServerNameExtension(serverNameList);
 }