From 132d31cd12faea7e7c291866f9aec0f1634c2304 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 6 May 2017 14:47:10 +0900 Subject: [PATCH] [Modify] Not inherit it --- websocket-sharp/Net/ServerSslConfiguration.cs | 68 +++++++++++++++++-- 1 file changed, 62 insertions(+), 6 deletions(-) diff --git a/websocket-sharp/Net/ServerSslConfiguration.cs b/websocket-sharp/Net/ServerSslConfiguration.cs index b1086988..9920b8c0 100644 --- a/websocket-sharp/Net/ServerSslConfiguration.cs +++ b/websocket-sharp/Net/ServerSslConfiguration.cs @@ -44,12 +44,15 @@ namespace WebSocketSharp.Net /// Stores the parameters used to configure the underlying /// for servers. /// - public class ServerSslConfiguration : SslConfiguration + public class ServerSslConfiguration { #region Private Fields - private X509Certificate2 _serverCert; - private bool _clientCertRequired; + private bool _checkCertRevocation; + private bool _clientCertRequired; + private RemoteCertificateValidationCallback _clientCertValidationCallback; + private SslProtocols _enabledSslProtocols; + private X509Certificate2 _serverCert; #endregion @@ -97,16 +100,35 @@ namespace WebSocketSharp.Net SslProtocols enabledSslProtocols, bool checkCertificateRevocation ) - : base (enabledSslProtocols, checkCertificateRevocation) { _serverCert = serverCertificate; _clientCertRequired = clientCertificateRequired; + _enabledSslProtocols = enabledSslProtocols; + _checkCertRevocation = checkCertificateRevocation; } #endregion #region Public Properties + /// + /// Gets or sets a value indicating whether the certificate revocation + /// list is checked during authentication. + /// + /// + /// true if the certificate revocation list is checked during + /// authentication; otherwise, false. + /// + public bool CheckCertificateRevocation { + get { + return _checkCertRevocation; + } + + set { + _checkCertRevocation = value; + } + } + /// /// Gets or sets a value indicating whether the client is asked for /// a certificate for authentication. @@ -144,11 +166,31 @@ namespace WebSocketSharp.Net /// public RemoteCertificateValidationCallback ClientCertificateValidationCallback { get { - return CertificateValidationCallback; + if (_clientCertValidationCallback == null) + _clientCertValidationCallback = defaultValidateClientCertificate; + + return _clientCertValidationCallback; } set { - CertificateValidationCallback = value; + _clientCertValidationCallback = value; + } + } + + /// + /// Gets or sets the protocols used for authentication. + /// + /// + /// The enum values that represent the protocols + /// used for authentication. + /// + public SslProtocols EnabledSslProtocols { + get { + return _enabledSslProtocols; + } + + set { + _enabledSslProtocols = value; } } @@ -170,5 +212,19 @@ namespace WebSocketSharp.Net } #endregion + + #region Private Methods + + private static bool defaultValidateClientCertificate ( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors + ) + { + return true; + } + + #endregion } }