/// <summary> /// Initializes the object. /// </summary> /// <param name="innerTransport">The inner transport.</param> /// <param name="tlsSettings">The TLS transport settings.</param> public TlsTransport(TransportBase innerTransport, TlsTransportSettings tlsSettings) : base("tls", innerTransport.Identifier) { Fx.Assert((tlsSettings.IsInitiator && tlsSettings.TargetHost != null) || (!tlsSettings.IsInitiator && tlsSettings.Certificate != null), tlsSettings.IsInitiator ? "Must have a target host for the client." : "Must have a certificate for the server."); this.innerTransport = innerTransport; this.tlsSettings = tlsSettings; this.sslStream = tlsSettings.CertificateValidationCallback == null ? new CustomSslStream(new TransportStream(this.innerTransport), false, tlsSettings.IsInitiator) : new CustomSslStream(new TransportStream(this.innerTransport), false, this.ValidateRemoteCertificate, tlsSettings.IsInitiator); }
public TlsTransport(TransportBase innerTransport, TlsTransportSettings tlsSettings) : base("tls", innerTransport.Identifier) { Fx.Assert((tlsSettings.IsInitiator && tlsSettings.TargetHost != null) || (!tlsSettings.IsInitiator && tlsSettings.Certificate != null), tlsSettings.IsInitiator ? "Must have a target host for the client." : "Must have a certificate for the server."); this.innerTransport = innerTransport; this.tlsSettings = tlsSettings; this.sslStream = tlsSettings.CertificateValidationCallback == null ? new CustomSslStream(new TransportStream(this.innerTransport), false, tlsSettings.IsInitiator) : new CustomSslStream(new TransportStream(this.innerTransport), false, tlsSettings.CertificateValidationCallback, tlsSettings.IsInitiator); }