Пример #1
0
        // PSK authentication
        public virtual IAsyncResult BeginAuthenticateAsServerUsingPsk(
            string pskCiphers,
            byte[] pskPsk,
            AsyncCallback asyncCallback,
            Object asyncState)
        {
            if (IsAuthenticated)
            {
                throw new InvalidOperationException("SslStream is already authenticated");
            }
            // Initialize the server stream
            SslStreamServer server_stream = new SslStreamServer(InnerStream, false, pskCiphers, pskPsk);

            // Set the internal sslStream
            sslStream = server_stream;
            // Start the read operation
            return(BeginRead(new byte[0], 0, 0, asyncCallback, asyncState));
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverCertificate"></param>
        /// <param name="clientCertificateRequired"></param>
        /// <param name="caCerts"></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 BeginAuthenticateAsServer(
            X509Certificate serverCertificate,
            bool clientCertificateRequired,
            X509Chain caCerts,
            SslProtocols enabledSslProtocols,
            SslStrength sslStrength,
            bool checkCertificateRevocation,
            AsyncCallback asyncCallback,
            Object asyncState)
        {
            if (IsAuthenticated)
            {
                throw new InvalidOperationException("SslStream is already authenticated");
            }
            // Initialize the server stream
            SslStreamServer server_stream = new SslStreamServer(InnerStream, false, serverCertificate, clientCertificateRequired, caCerts, enabledSslProtocols, sslStrength, checkCertificateRevocation, remoteCertificateValidationCallback);

            // Set the internal sslStream
            sslStream = server_stream;
            // Start the read operation
            return(BeginRead(new byte[0], 0, 0, asyncCallback, asyncState));
        }
Пример #3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="serverCertificate"></param>
		/// <param name="clientCertificateRequired"></param>
		/// <param name="caCerts"></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 BeginAuthenticateAsServer(
			X509Certificate serverCertificate,
			bool clientCertificateRequired,
			X509Chain caCerts,
			SslProtocols enabledSslProtocols,
			SslStrength sslStrength,
			bool checkCertificateRevocation,
			AsyncCallback asyncCallback,
			Object asyncState)
		{
			if (IsAuthenticated)
			{
				throw new InvalidOperationException("SslStream is already authenticated");
			}
			// Initialize the server stream
			SslStreamServer server_stream = new SslStreamServer(InnerStream, false, serverCertificate, clientCertificateRequired, caCerts, enabledSslProtocols, sslStrength, checkCertificateRevocation, remoteCertificateValidationCallback);
			// Set the internal sslStream
			sslStream = server_stream;
			// Start the read operation
			return BeginRead(new byte[0], 0, 0, asyncCallback, asyncState);
		}
Пример #4
0
        // PSK authentication
        public virtual IAsyncResult BeginAuthenticateAsServerUsingPsk(
            string pskCiphers,
            byte[] pskPsk,
            AsyncCallback asyncCallback,
            Object asyncState)
        {
            if (IsAuthenticated)
            {
                throw new InvalidOperationException("SslStream is already authenticated");
            }
            // Initialize the server stream
            SslStreamServer server_stream = new SslStreamServer(InnerStream, false, pskCiphers, pskPsk);
            // Set the internal sslStream
            sslStream = server_stream;
            // Start the read operation
			return BeginRead(new byte[0], 0, 0, asyncCallback, asyncState);
		}