[Modify] Not inherit it
This commit is contained in:
parent
f7b2ee6501
commit
e22acbd240
@ -43,11 +43,15 @@ namespace WebSocketSharp.Net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the parameters for the <see cref="SslStream"/> used by clients.
|
/// Stores the parameters for the <see cref="SslStream"/> used by clients.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClientSslConfiguration : SslConfiguration
|
public class ClientSslConfiguration
|
||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
private bool _checkCertRevocation;
|
||||||
|
private LocalCertificateSelectionCallback _clientCertSelectionCallback;
|
||||||
private X509CertificateCollection _clientCerts;
|
private X509CertificateCollection _clientCerts;
|
||||||
|
private SslProtocols _enabledSslProtocols;
|
||||||
|
private RemoteCertificateValidationCallback _serverCertValidationCallback;
|
||||||
private string _targetHost;
|
private string _targetHost;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -95,16 +99,40 @@ namespace WebSocketSharp.Net
|
|||||||
SslProtocols enabledSslProtocols,
|
SslProtocols enabledSslProtocols,
|
||||||
bool checkCertificateRevocation
|
bool checkCertificateRevocation
|
||||||
)
|
)
|
||||||
: base (enabledSslProtocols, checkCertificateRevocation)
|
|
||||||
{
|
{
|
||||||
_targetHost = targetHost;
|
_targetHost = targetHost;
|
||||||
_clientCerts = clientCertificates;
|
_clientCerts = clientCertificates;
|
||||||
|
_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>
|
||||||
|
/// <para>
|
||||||
|
/// <c>true</c> if the certificate revocation list is checked during
|
||||||
|
/// authentication; otherwise, <c>false</c>.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// The default value is <c>false</c>.
|
||||||
|
/// </para>
|
||||||
|
/// </value>
|
||||||
|
public bool CheckCertificateRevocation {
|
||||||
|
get {
|
||||||
|
return _checkCertRevocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
set {
|
||||||
|
_checkCertRevocation = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the collection that contains client certificates.
|
/// Gets or sets the collection that contains client certificates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -141,11 +169,36 @@ namespace WebSocketSharp.Net
|
|||||||
/// </value>
|
/// </value>
|
||||||
public LocalCertificateSelectionCallback ClientCertificateSelectionCallback {
|
public LocalCertificateSelectionCallback ClientCertificateSelectionCallback {
|
||||||
get {
|
get {
|
||||||
return CertificateSelectionCallback;
|
if (_clientCertSelectionCallback == null)
|
||||||
|
_clientCertSelectionCallback = defaultSelectClientCertificate;
|
||||||
|
|
||||||
|
return _clientCertSelectionCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
set {
|
set {
|
||||||
CertificateSelectionCallback = value;
|
_clientCertSelectionCallback = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the protocols used for authentication.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// <para>
|
||||||
|
/// The <see cref="SslProtocols"/> enum values that represent
|
||||||
|
/// the protocols used for authentication.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// The default value is <see cref="SslProtocols.Default"/>.
|
||||||
|
/// </para>
|
||||||
|
/// </value>
|
||||||
|
public SslProtocols EnabledSslProtocols {
|
||||||
|
get {
|
||||||
|
return _enabledSslProtocols;
|
||||||
|
}
|
||||||
|
|
||||||
|
set {
|
||||||
|
_enabledSslProtocols = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,11 +221,14 @@ namespace WebSocketSharp.Net
|
|||||||
/// </value>
|
/// </value>
|
||||||
public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
|
public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
|
||||||
get {
|
get {
|
||||||
return CertificateValidationCallback;
|
if (_serverCertValidationCallback == null)
|
||||||
|
_serverCertValidationCallback = defaultValidateServerCertificate;
|
||||||
|
|
||||||
|
return _serverCertValidationCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
set {
|
set {
|
||||||
CertificateValidationCallback = value;
|
_serverCertValidationCallback = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,5 +250,30 @@ namespace WebSocketSharp.Net
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user