diff --git a/websocket-sharp/Net/ClientSslConfiguration.cs b/websocket-sharp/Net/ClientSslConfiguration.cs
index 02645e8c..75056413 100644
--- a/websocket-sharp/Net/ClientSslConfiguration.cs
+++ b/websocket-sharp/Net/ClientSslConfiguration.cs
@@ -43,12 +43,16 @@ namespace WebSocketSharp.Net
///
/// Stores the parameters for the used by clients.
///
- public class ClientSslConfiguration : SslConfiguration
+ public class ClientSslConfiguration
{
#region Private Fields
- private X509CertificateCollection _clientCerts;
- private string _targetHost;
+ private bool _checkCertRevocation;
+ private LocalCertificateSelectionCallback _clientCertSelectionCallback;
+ private X509CertificateCollection _clientCerts;
+ private SslProtocols _enabledSslProtocols;
+ private RemoteCertificateValidationCallback _serverCertValidationCallback;
+ private string _targetHost;
#endregion
@@ -95,16 +99,40 @@ namespace WebSocketSharp.Net
SslProtocols enabledSslProtocols,
bool checkCertificateRevocation
)
- : base (enabledSslProtocols, checkCertificateRevocation)
{
_targetHost = targetHost;
_clientCerts = clientCertificates;
+ _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.
+ ///
+ ///
+ /// The default value is false.
+ ///
+ ///
+ public bool CheckCertificateRevocation {
+ get {
+ return _checkCertRevocation;
+ }
+
+ set {
+ _checkCertRevocation = value;
+ }
+ }
+
///
/// Gets or sets the collection that contains client certificates.
///
@@ -141,11 +169,36 @@ namespace WebSocketSharp.Net
///
public LocalCertificateSelectionCallback ClientCertificateSelectionCallback {
get {
- return CertificateSelectionCallback;
+ if (_clientCertSelectionCallback == null)
+ _clientCertSelectionCallback = defaultSelectClientCertificate;
+
+ return _clientCertSelectionCallback;
}
set {
- CertificateSelectionCallback = value;
+ _clientCertSelectionCallback = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the protocols used for authentication.
+ ///
+ ///
+ ///
+ /// The enum values that represent
+ /// the protocols used for authentication.
+ ///
+ ///
+ /// The default value is .
+ ///
+ ///
+ public SslProtocols EnabledSslProtocols {
+ get {
+ return _enabledSslProtocols;
+ }
+
+ set {
+ _enabledSslProtocols = value;
}
}
@@ -168,11 +221,14 @@ namespace WebSocketSharp.Net
///
public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
get {
- return CertificateValidationCallback;
+ if (_serverCertValidationCallback == null)
+ _serverCertValidationCallback = defaultValidateServerCertificate;
+
+ return _serverCertValidationCallback;
}
set {
- CertificateValidationCallback = value;
+ _serverCertValidationCallback = value;
}
}
@@ -194,5 +250,30 @@ namespace WebSocketSharp.Net
}
#endregion
+
+ #region Private Methods
+
+ private static X509Certificate defaultSelectClientCertificate (
+ object sender,
+ string targetHost,
+ X509CertificateCollection clientCertificates,
+ X509Certificate serverCertificate,
+ string[] acceptableIssuers
+ )
+ {
+ return null;
+ }
+
+ private static bool defaultValidateServerCertificate (
+ object sender,
+ X509Certificate certificate,
+ X509Chain chain,
+ SslPolicyErrors sslPolicyErrors
+ )
+ {
+ return true;
+ }
+
+ #endregion
}
}