Convert blocking operations in HttpWebRequest and SslClientStream to non-blocking...
[mono.git] / mcs / class / Mono.Security / Mono.Security.Protocol.Tls / SslServerStream.cs
index cc36ee83b74164a2e8235496372e4e8037777482..b0d8bba6ffc99cc8b92675f31d8318bc32d43ef7 100644 (file)
@@ -34,7 +34,12 @@ using Mono.Security.Protocol.Tls.Handshake;
 
 namespace Mono.Security.Protocol.Tls
 {
-       public class SslServerStream : SslStreamBase
+#if INSIDE_SYSTEM
+       internal
+#else
+       public
+#endif
+       class SslServerStream : SslStreamBase
        {
                #region Internal Events
                
@@ -191,7 +196,7 @@ namespace Mono.Security.Protocol.Tls
                                        Fig. 1 - Message flow for a full handshake              
                */
 
-               internal override IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state)
+               internal override IAsyncResult BeginNegotiateHandshake(AsyncCallback callback, object state)
                {
                        // Reset the context if needed
                        if (this.context.HandshakeState != HandshakeState.None)
@@ -210,7 +215,7 @@ namespace Mono.Security.Protocol.Tls
 
                }
 
-               internal override void OnNegotiateHandshakeCallback(IAsyncResult asyncResult)
+               internal override void EndNegotiateHandshake(IAsyncResult asyncResult)
                {
                        // Receive Client Hello message and ignore it
                        this.protocol.EndReceiveRecord(asyncResult);
@@ -234,8 +239,6 @@ namespace Mono.Security.Protocol.Tls
                                this.protocol.SendRecord(HandshakeType.ServerKeyExchange);
                        }
 
-                       bool certRequested = false;
-
                        // If the negotiated cipher is a KeyEx cipher or
                        // the client certificate is required send the CertificateRequest message
                        if (this.context.Negotiating.Cipher.IsExportable ||
@@ -243,7 +246,6 @@ namespace Mono.Security.Protocol.Tls
                                ((ServerContext)this.context).RequestClientCertificate)
                        {
                                this.protocol.SendRecord(HandshakeType.CertificateRequest);
-                               certRequested = true;
                        }
 
                        // Send ServerHelloDone message
@@ -263,15 +265,6 @@ namespace Mono.Security.Protocol.Tls
                                }
                        }
 
-                       if (certRequested) {
-                               X509Certificate client_cert = this.context.ClientSettings.ClientCertificate;
-                               if (client_cert == null && ((ServerContext)this.context).ClientCertificateRequired)
-                                       throw new TlsException (AlertDescription.BadCertificate, "No certificate received from client.");
-
-                               if (!RaiseClientCertificateValidation (client_cert, new int[0]))
-                                       throw new TlsException (AlertDescription.BadCertificate, "Client certificate not accepted.");
-                       }
-
                        // Send ChangeCipherSpec and ServerFinished messages
                        this.protocol.SendChangeCipherSpec();
                        this.protocol.SendRecord (HandshakeType.Finished);