Inheritance: System.Net.Security.SslStream
コード例 #1
0
ファイル: TlsTransport.cs プロジェクト: xinchen10/azure-amqp
 /// <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);
 }
コード例 #2
0
ファイル: TlsTransport.cs プロジェクト: Azure/azure-amqp
 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);
 }