public static byte[] CreateHeartbeatExtension(HeartbeatExtension heartbeatExtension)
        {
            if (heartbeatExtension == null)
            {
                throw new TlsFatalAlert(80);
            }
            MemoryStream memoryStream = new MemoryStream();

            heartbeatExtension.Encode(memoryStream);
            return(memoryStream.ToArray());
        }
        public static HeartbeatExtension ReadHeartbeatExtension(byte[] extensionData)
        {
            if (extensionData == null)
            {
                throw new ArgumentNullException("extensionData");
            }
            MemoryStream       memoryStream = new MemoryStream(extensionData, writable: false);
            HeartbeatExtension result       = HeartbeatExtension.Parse(memoryStream);

            TlsProtocol.AssertEmpty(memoryStream);
            return(result);
        }
        public static HeartbeatExtension ReadHeartbeatExtension(byte[] extensionData)
        {
            if (extensionData == null)
            {
                throw new ArgumentNullException("extensionData");
            }
            MemoryStream       input     = new MemoryStream(extensionData, false);
            HeartbeatExtension extension = HeartbeatExtension.Parse(input);

            TlsProtocol.AssertEmpty(input);
            return(extension);
        }
示例#4
0
        /// <exception cref="IOException"></exception>
        public static byte[] CreateHeartbeatExtension(HeartbeatExtension heartbeatExtension)
        {
            if (heartbeatExtension == null)
            {
                throw new TlsFatalAlert(AlertDescription.internal_error);
            }

            MemoryStream buf = new MemoryStream();

            heartbeatExtension.Encode(buf);

            return(buf.ToArray());
        }
示例#5
0
        public static byte[] CreateHeartbeatExtension(HeartbeatExtension heartbeatExtension)
        {
            //IL_000b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0011: Expected O, but got Unknown
            if (heartbeatExtension == null)
            {
                throw new TlsFatalAlert(80);
            }
            MemoryStream val = new MemoryStream();

            heartbeatExtension.Encode((Stream)(object)val);
            return(val.ToArray());
        }
示例#6
0
        public static HeartbeatExtension ReadHeartbeatExtension(byte[] extensionData)
        {
            //IL_0008: Unknown result type (might be due to invalid IL or missing references)
            //IL_0010: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Expected O, but got Unknown
            if (extensionData == null)
            {
                throw new ArgumentNullException("extensionData");
            }
            MemoryStream       val    = new MemoryStream(extensionData, false);
            HeartbeatExtension result = HeartbeatExtension.Parse((Stream)(object)val);

            TlsProtocol.AssertEmpty(val);
            return(result);
        }
示例#7
0
 /// <exception cref="IOException"></exception>
 public static void AddHeartbeatExtension(IDictionary extensions, HeartbeatExtension heartbeatExtension)
 {
     extensions[ExtensionType.heartbeat] = CreateHeartbeatExtension(heartbeatExtension);
 }
示例#8
0
 public static void AddHeartbeatExtension(IDictionary extensions, HeartbeatExtension heartbeatExtension)
 {
     extensions.set_Item((object)15, (object)CreateHeartbeatExtension(heartbeatExtension));
 }
 /// <exception cref="IOException"></exception>
 public static void AddHeartbeatExtension(IDictionary extensions, HeartbeatExtension heartbeatExtension)
 {
     extensions[ExtensionType.heartbeat] = CreateHeartbeatExtension(heartbeatExtension);
 }
示例#10
0
        /// <exception cref="IOException"></exception>
        public static byte[] CreateHeartbeatExtension(HeartbeatExtension heartbeatExtension)
        {
            if (heartbeatExtension == null)
                throw new TlsFatalAlert(AlertDescription.internal_error);

            MemoryStream buf = new MemoryStream();

            heartbeatExtension.Encode(buf);

            return buf.ToArray();
        }
 public static void AddHeartbeatExtension(IDictionary extensions, HeartbeatExtension heartbeatExtension)
 {
     extensions[15] = TlsExtensionsUtilities.CreateHeartbeatExtension(heartbeatExtension);
 }