System.Net.Security.SslStream.BeginAuthenticateAsClient C# (CSharp) Метод

BeginAuthenticateAsClient() публичный Метод

public BeginAuthenticateAsClient ( string targetHost, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
targetHost string
asyncCallback AsyncCallback
asyncState object
Результат IAsyncResult
        public virtual IAsyncResult BeginAuthenticateAsClient(string targetHost, AsyncCallback asyncCallback, object asyncState)
        {
            return BeginAuthenticateAsClient(targetHost, new X509CertificateCollection(), SecurityProtocol.SystemDefaultSecurityProtocols, false,
                                           asyncCallback, asyncState);
        }

Same methods

SslStream::BeginAuthenticateAsClient ( string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
SslStream::BeginAuthenticateAsClient ( string targetHost, X509CertificateCollection clientCertificates, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
SslStream::BeginAuthenticateAsClient ( string targetHost, System clientCertificates, System enabledSslProtocols, bool checkCertificateRevocation, System asyncCallback, object asyncState ) : System.IAsyncResult
SslStream::BeginAuthenticateAsClient ( string targetHost, System clientCertificates, bool checkCertificateRevocation, System asyncCallback, object asyncState ) : System.IAsyncResult
SslStream::BeginAuthenticateAsClient ( string targetHost, System asyncCallback, object asyncState ) : System.IAsyncResult

Usage Example

Пример #1
0
        public void ReconTest()
        {
            MonoCatConfig config = new MonoCatConfig()
            {
                Name = "monocat",
                Nick = "monocat",//"monocat" + DateTime.Now.Second,
                Server = "kornbluth.freenode.net",
                Port = 6697,
                Cipher = "blowfish",
                ChannelList = new String[] { "#shrew-dev", "#screenage" }
            };

            TcpClient tcpClient = new TcpClient(config.Server, config.Port);
            SslStream stream = new SslStream(tcpClient.GetStream(), false, new RemoteCertificateValidationCallback((a, b, c, d) => { return true; }));

            Boolean visited = false;
            var async = stream.BeginAuthenticateAsClient(config.Server, (result) =>
            {
                var s = (SslStream)result.AsyncState;
                s.EndAuthenticateAsClient(result);
                visited = true;
                Trace.TraceInformation("Auth req finished.");
            }, stream);
            Trace.TraceInformation("Sent auth req.");

            Thread.Sleep(1000);
            Assert.IsTrue(stream.IsAuthenticated);
            Assert.IsTrue(stream.IsEncrypted);
            Assert.IsTrue(visited);
        }
All Usage Examples Of System.Net.Security.SslStream::BeginAuthenticateAsClient