6
6
7
7
namespace SuperSocket
8
8
{
9
- public class CertificateOptions
9
+ public class ServerAuthenticationOptions : SslServerAuthenticationOptions
10
10
{
11
- public X509Certificate Certificate { get ; set ; }
12
-
13
-
14
11
/// <summary>
15
12
/// Gets the certificate file path (pfx).
16
13
/// </summary>
@@ -44,26 +41,15 @@ public class CertificateOptions
44
41
public StoreLocation StoreLocation { get ; set ; } = StoreLocation . CurrentUser ; //The X.509 certificate store used by the current user.
45
42
46
43
47
- /// <summary>
48
- /// Gets a value indicating whether [client certificate required].
49
- /// </summary>
50
- /// <value>
51
- /// <c>true</c> if [client certificate required]; otherwise, <c>false</c>.
52
- /// </value>
53
- public bool ClientCertificateRequired { get ; set ; }
54
-
55
44
/// <summary>
56
45
/// Gets a value that will be used to instantiate the X509Certificate2 object in the CertificateManager
57
46
/// </summary>
58
47
public X509KeyStorageFlags KeyStorageFlags { get ; set ; }
59
48
60
-
61
- public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get ; set ; }
62
-
63
49
public void EnsureCertificate ( )
64
50
{
65
51
// The certificate is there already
66
- if ( Certificate != null )
52
+ if ( this . ServerCertificate != null )
67
53
return ;
68
54
69
55
// load certificate from pfx file
@@ -76,15 +62,15 @@ public void EnsureCertificate()
76
62
filePath = Path . Combine ( AppContext . BaseDirectory , filePath ) ;
77
63
}
78
64
79
- Certificate = new X509Certificate2 ( filePath , Password , KeyStorageFlags ) ;
65
+ ServerCertificate = new X509Certificate2 ( filePath , Password , KeyStorageFlags ) ;
80
66
}
81
67
else if ( ! string . IsNullOrEmpty ( Thumbprint ) ) // load certificate from certificate store
82
68
{
83
69
var store = new X509Store ( ( StoreName ) Enum . Parse ( typeof ( StoreName ) , StoreName ) , StoreLocation ) ;
84
70
85
71
store . Open ( OpenFlags . ReadOnly ) ;
86
72
87
- Certificate = store . Certificates . OfType < X509Certificate2 > ( )
73
+ ServerCertificate = store . Certificates . OfType < X509Certificate2 > ( )
88
74
. FirstOrDefault ( c => c . Thumbprint . Equals ( Thumbprint , StringComparison . OrdinalIgnoreCase ) ) ;
89
75
90
76
store . Close ( ) ;
@@ -94,5 +80,10 @@ public void EnsureCertificate()
94
80
throw new Exception ( $ "Either { FilePath } or { Thumbprint } is required to load the certificate.") ;
95
81
}
96
82
}
83
+
84
+ public override string ToString ( )
85
+ {
86
+ return this . EnabledSslProtocols . ToString ( ) ;
87
+ }
97
88
}
98
89
}
0 commit comments