System.Net.TlsStream.AuthenticateAsClient C# (CSharp) Method

AuthenticateAsClient() public method

public AuthenticateAsClient ( ) : void
return void
        public void AuthenticateAsClient()
        {
            _sslStream.AuthenticateAsClient(
                _host,
                _clientCertificates,
                (SslProtocols)ServicePointManager.SecurityProtocol, // enums use same values
                ServicePointManager.CheckCertificateRevocationList);
        }

Usage Example

Beispiel #1
0
        //    Creates a FtpDataStream object, constructs a TLS stream if needed.
        //    In case SSL and ASYNC we delay sigaling the user stream until the handshake is done.
        private PipelineInstruction QueueOrCreateFtpDataStream(ref Stream stream)
        {
            if (_dataSocket == null)
            {
                throw new InternalException();
            }

            //
            // Re-entered pipeline with completed read on the TlsStream
            //
            if (_tlsStream != null)
            {
                stream     = new FtpDataStream(_tlsStream, (FtpWebRequest)_request, IsFtpDataStreamWriteable());
                _tlsStream = null;
                return(PipelineInstruction.GiveStream);
            }

            NetworkStream networkStream = new NetworkStream(_dataSocket, true);

            if (UsingSecureStream)
            {
                FtpWebRequest request = (FtpWebRequest)_request;

                TlsStream tlsStream = new TlsStream(networkStream, _dataSocket, request.RequestUri.Host, request.ClientCertificates);
                networkStream = tlsStream;

                if (_isAsync)
                {
                    _tlsStream = tlsStream;

                    tlsStream.BeginAuthenticateAsClient(s_SSLHandshakeCallback, this);
                    return(PipelineInstruction.Pause);
                }
                else
                {
                    tlsStream.AuthenticateAsClient();
                }
            }

            stream = new FtpDataStream(networkStream, (FtpWebRequest)_request, IsFtpDataStreamWriteable());
            return(PipelineInstruction.GiveStream);
        }
All Usage Examples Of System.Net.TlsStream::AuthenticateAsClient