Inheritance: SslStreamBase
Exemplo n.º 1
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");
            }

            End = ConnectionEnd.Server;

            // Initialize the server stream
            var server_stream = new SslStreamServer(
                InnerStream,
                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));
        }
Exemplo n.º 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");
			}

			End = ConnectionEnd.Server;
		    
			// Initialize the server stream
			var server_stream = new SslStreamServer(
				                    InnerStream, 
				                    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);
		}