// PSK authentication public virtual IAsyncResult BeginAuthenticateAsClientUsingPsk( string targetHost, string pskCiphers, string pskIdentity, byte[] pskPsk, AsyncCallback asyncCallback, Object asyncState) { if (IsAuthenticated) { throw new InvalidOperationException("SslStream is already authenticated"); } // Create the stream SslStreamClient client_stream = new SslStreamClient(InnerStream, false, targetHost, pskCiphers, pskIdentity, pskPsk); // set the internal stream sslStream = client_stream; // start the write operation return(BeginWrite(new byte[0], 0, 0, asyncCallback, asyncState)); }
/// <summary> /// /// </summary> /// <param name="targetHost"></param> /// <param name="clientCertificates"></param> /// <param name="caCertificates"></param> /// <param name="enabledSslProtocols"></param> /// <param name="sslStrength"></param> /// <param name="checkCertificateRevocation"></param> /// <param name="asyncCallback"></param> /// <param name="asyncState"></param> /// <returns></returns> public virtual IAsyncResult BeginAuthenticateAsClient( string targetHost, X509List clientCertificates, X509Chain caCertificates, SslProtocols enabledSslProtocols, SslStrength sslStrength, bool checkCertificateRevocation, AsyncCallback asyncCallback, Object asyncState) { if (IsAuthenticated) { throw new InvalidOperationException("SslStream is already authenticated"); } // Create the stream SslStreamClient client_stream = new SslStreamClient(InnerStream, false, targetHost, clientCertificates, caCertificates, enabledSslProtocols, sslStrength, checkCertificateRevocation, remoteCertificateValidationCallback, localCertificateSelectionCallback); // set the internal stream sslStream = client_stream; // start the write operation return(BeginWrite(new byte[0], 0, 0, asyncCallback, asyncState)); }
/// <summary> /// /// </summary> /// <param name="targetHost"></param> /// <param name="clientCertificates"></param> /// <param name="caCertificates"></param> /// <param name="enabledSslProtocols"></param> /// <param name="sslStrength"></param> /// <param name="checkCertificateRevocation"></param> /// <param name="asyncCallback"></param> /// <param name="asyncState"></param> /// <returns></returns> public virtual IAsyncResult BeginAuthenticateAsClient( string targetHost, X509List clientCertificates, X509Chain caCertificates, SslProtocols enabledSslProtocols, SslStrength sslStrength, bool checkCertificateRevocation, AsyncCallback asyncCallback, Object asyncState) { if (IsAuthenticated) { throw new InvalidOperationException("SslStream is already authenticated"); } // Create the stream SslStreamClient client_stream = new SslStreamClient(InnerStream, false, targetHost, clientCertificates, caCertificates, enabledSslProtocols, sslStrength, checkCertificateRevocation, remoteCertificateValidationCallback, localCertificateSelectionCallback); // set the internal stream sslStream = client_stream; // start the write operation return BeginWrite(new byte[0], 0, 0, asyncCallback, asyncState); }
// PSK authentication public virtual IAsyncResult BeginAuthenticateAsClientUsingPsk( string targetHost, string pskCiphers, string pskIdentity, byte[] pskPsk, AsyncCallback asyncCallback, Object asyncState) { if (IsAuthenticated) { throw new InvalidOperationException("SslStream is already authenticated"); } // Create the stream SslStreamClient client_stream = new SslStreamClient(InnerStream, false, targetHost, pskCiphers, pskIdentity, pskPsk); // set the internal stream sslStream = client_stream; // start the write operation return BeginWrite(new byte[0], 0, 0, asyncCallback, asyncState); }