|
|
|
@ -34,14 +34,14 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using System.Net.Security;
|
|
|
|
using System.Security.Authentication;
|
|
|
|
using System.Security.Authentication;
|
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WebSocketSharp.Net
|
|
|
|
namespace WebSocketSharp.Net
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Stores the parameters used in configuring <see cref="System.Net.Security.SslStream"/>
|
|
|
|
/// Stores the parameters used to configure a <see cref="SslStream"/> instance as a client.
|
|
|
|
/// as a client.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class ClientSslAuthConfiguration
|
|
|
|
public class ClientSslAuthConfiguration
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -49,39 +49,26 @@ namespace WebSocketSharp.Net
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="ClientSslAuthConfiguration"/> class with
|
|
|
|
/// Initializes a new instance of the <see cref="ClientSslAuthConfiguration"/> class with
|
|
|
|
/// the specified <paramref name="clientCertificates"/>.
|
|
|
|
/// the specified <paramref name="targetHost"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="clientCertificates">
|
|
|
|
/// <param name="targetHost">
|
|
|
|
/// A <see cref="X509CertificateCollection"/> that contains client certificates.
|
|
|
|
/// A <see cref="string"/> that represents the name of the server that shares
|
|
|
|
|
|
|
|
/// a secure connection.
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
public ClientSslAuthConfiguration (X509CertificateCollection clientCertificates)
|
|
|
|
public ClientSslAuthConfiguration (string targetHost)
|
|
|
|
: this (clientCertificates, SslProtocols.Default, false)
|
|
|
|
: this (targetHost, null, SslProtocols.Default, false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="ClientSslAuthConfiguration"/> class with
|
|
|
|
/// Initializes a new instance of the <see cref="ClientSslAuthConfiguration"/> class with
|
|
|
|
/// the specified <paramref name="clientCertificates"/> and
|
|
|
|
/// the specified <paramref name="targetHost"/>, <paramref name="clientCertificates"/>,
|
|
|
|
/// <paramref name="enabledSslProtocols"/>.
|
|
|
|
/// <paramref name="enabledSslProtocols"/>, and <paramref name="checkCertificateRevocation"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="clientCertificates">
|
|
|
|
/// <param name="targetHost">
|
|
|
|
/// A <see cref="X509CertificateCollection"/> that contains client certificates.
|
|
|
|
/// A <see cref="string"/> that represents the name of the server that shares
|
|
|
|
/// </param>
|
|
|
|
/// a secure connection.
|
|
|
|
/// <param name="enabledSslProtocols">
|
|
|
|
|
|
|
|
/// The <see cref="SslProtocols"/> enum value that represents the protocols used for
|
|
|
|
|
|
|
|
/// authentication.
|
|
|
|
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
public ClientSslAuthConfiguration (
|
|
|
|
|
|
|
|
X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols)
|
|
|
|
|
|
|
|
: this (clientCertificates, enabledSslProtocols, false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="ClientSslAuthConfiguration"/> class with
|
|
|
|
|
|
|
|
/// the specified <paramref name="clientCertificates"/>, <paramref name="enabledSslProtocols"/>,
|
|
|
|
|
|
|
|
/// and <paramref name="checkCertificateRevocation"/>.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="clientCertificates">
|
|
|
|
/// <param name="clientCertificates">
|
|
|
|
/// A <see cref="X509CertificateCollection"/> that contains client certificates.
|
|
|
|
/// A <see cref="X509CertificateCollection"/> that contains client certificates.
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
@ -94,10 +81,12 @@ namespace WebSocketSharp.Net
|
|
|
|
/// otherwise, <c>false</c>.
|
|
|
|
/// otherwise, <c>false</c>.
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
public ClientSslAuthConfiguration (
|
|
|
|
public ClientSslAuthConfiguration (
|
|
|
|
|
|
|
|
string targetHost,
|
|
|
|
X509CertificateCollection clientCertificates,
|
|
|
|
X509CertificateCollection clientCertificates,
|
|
|
|
SslProtocols enabledSslProtocols,
|
|
|
|
SslProtocols enabledSslProtocols,
|
|
|
|
bool checkCertificateRevocation)
|
|
|
|
bool checkCertificateRevocation)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TargetHost = targetHost;
|
|
|
|
ClientCertificates = clientCertificates;
|
|
|
|
ClientCertificates = clientCertificates;
|
|
|
|
EnabledSslProtocols = enabledSslProtocols;
|
|
|
|
EnabledSslProtocols = enabledSslProtocols;
|
|
|
|
CheckCertificateRevocation = checkCertificateRevocation;
|
|
|
|
CheckCertificateRevocation = checkCertificateRevocation;
|
|
|
|
@ -133,6 +122,15 @@ namespace WebSocketSharp.Net
|
|
|
|
/// </value>
|
|
|
|
/// </value>
|
|
|
|
public SslProtocols EnabledSslProtocols { get; set; }
|
|
|
|
public SslProtocols EnabledSslProtocols { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets or sets the name of the server that shares a secure connection.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <value>
|
|
|
|
|
|
|
|
/// A <see cref="string"/> that represents the name of the server that shares
|
|
|
|
|
|
|
|
/// a secure connection.
|
|
|
|
|
|
|
|
/// </value>
|
|
|
|
|
|
|
|
public string TargetHost { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|