[Modify] Not inherit it

This commit is contained in:
sta 2017-05-06 14:47:10 +09:00
parent 5bd0914bb6
commit 132d31cd12

View File

@ -44,12 +44,15 @@ namespace WebSocketSharp.Net
/// Stores the parameters used to configure the underlying <see cref="SslStream"/> /// Stores the parameters used to configure the underlying <see cref="SslStream"/>
/// for servers. /// for servers.
/// </summary> /// </summary>
public class ServerSslConfiguration : SslConfiguration public class ServerSslConfiguration
{ {
#region Private Fields #region Private Fields
private X509Certificate2 _serverCert; private bool _checkCertRevocation;
private bool _clientCertRequired; private bool _clientCertRequired;
private RemoteCertificateValidationCallback _clientCertValidationCallback;
private SslProtocols _enabledSslProtocols;
private X509Certificate2 _serverCert;
#endregion #endregion
@ -97,16 +100,35 @@ namespace WebSocketSharp.Net
SslProtocols enabledSslProtocols, SslProtocols enabledSslProtocols,
bool checkCertificateRevocation bool checkCertificateRevocation
) )
: base (enabledSslProtocols, checkCertificateRevocation)
{ {
_serverCert = serverCertificate; _serverCert = serverCertificate;
_clientCertRequired = clientCertificateRequired; _clientCertRequired = clientCertificateRequired;
_enabledSslProtocols = enabledSslProtocols;
_checkCertRevocation = checkCertificateRevocation;
} }
#endregion #endregion
#region Public Properties #region Public Properties
/// <summary>
/// Gets or sets a value indicating whether the certificate revocation
/// list is checked during authentication.
/// </summary>
/// <value>
/// <c>true</c> if the certificate revocation list is checked during
/// authentication; otherwise, <c>false</c>.
/// </value>
public bool CheckCertificateRevocation {
get {
return _checkCertRevocation;
}
set {
_checkCertRevocation = value;
}
}
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the client is asked for /// Gets or sets a value indicating whether the client is asked for
/// a certificate for authentication. /// a certificate for authentication.
@ -144,11 +166,31 @@ namespace WebSocketSharp.Net
/// </value> /// </value>
public RemoteCertificateValidationCallback ClientCertificateValidationCallback { public RemoteCertificateValidationCallback ClientCertificateValidationCallback {
get { get {
return CertificateValidationCallback; if (_clientCertValidationCallback == null)
_clientCertValidationCallback = defaultValidateClientCertificate;
return _clientCertValidationCallback;
} }
set { set {
CertificateValidationCallback = value; _clientCertValidationCallback = value;
}
}
/// <summary>
/// Gets or sets the protocols used for authentication.
/// </summary>
/// <value>
/// The <see cref="SslProtocols"/> enum values that represent the protocols
/// used for authentication.
/// </value>
public SslProtocols EnabledSslProtocols {
get {
return _enabledSslProtocols;
}
set {
_enabledSslProtocols = value;
} }
} }
@ -170,5 +212,19 @@ namespace WebSocketSharp.Net
} }
#endregion #endregion
#region Private Methods
private static bool defaultValidateClientCertificate (
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors
)
{
return true;
}
#endregion
} }
} }