public AuthenticateAsClientAsync ( string targetHost, |
||
targetHost | string | |
clientCertificates | ||
enabledSslProtocols | SslProtocols | |
checkCertificateRevocation | bool | |
return | Task |
public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Task.Factory.FromAsync((callback, state) => BeginAuthenticateAsClient(targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsClient, null);
}
SslStream::AuthenticateAsClientAsync ( string targetHost ) : System.Threading.Tasks.Task | |
SslStream::AuthenticateAsClientAsync ( string targetHost, System clientCertificates, System enabledSslProtocols, bool checkCertificateRevocation ) : System.Threading.Tasks.Task | |
SslStream::AuthenticateAsClientAsync ( string targetHost, System clientCertificates, bool checkCertificateRevocation ) : System.Threading.Tasks.Task | |
SslStream::AuthenticateAsClientAsync ( string targetHost ) : Task | |
SslStream::AuthenticateAsClientAsync ( string targetHost, |
/// <summary> /// Initializes a client instance of <see cref="DesktopNetworkStream"/>. /// </summary> /// <param name="host">Network host.</param> /// <param name="port">Network port.</param> /// <param name="useTls">Use TLS layer?</param> /// <param name="noDelay">No delay?</param> /// <param name="ignoreSslPolicyErrors">Ignore SSL policy errors?</param> internal DesktopNetworkStream(string host, int port, bool useTls, bool noDelay, bool ignoreSslPolicyErrors) { this.Host = host; this.Port = port; #if NETSTANDARD this.tcpClient = new TcpClient { NoDelay = noDelay }; this.tcpClient.ConnectAsync(host, port).Wait(); #else this.tcpClient = new TcpClient(host, port) { NoDelay = noDelay }; #endif Stream stream = this.tcpClient.GetStream(); if (useTls) { var ssl = new SslStream( stream, false, (sender, certificate, chain, errors) => errors == SslPolicyErrors.None || ignoreSslPolicyErrors); #if NETSTANDARD ssl.AuthenticateAsClientAsync(host).Wait(); #else ssl.AuthenticateAsClient(host); #endif stream = ssl; } this.networkStream = stream; }