Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SslAuthenticationOptions.cs
Go to the documentation of this file.
5
6namespace System.Net.Security;
7
8internal sealed class SslAuthenticationOptions
9{
12
13 internal bool AllowRenegotiation { get; set; }
14
15 internal string TargetHost { get; set; }
16
18
20
21 internal bool IsServer { get; set; }
22
24
25 internal SslProtocols EnabledSslProtocols { get; set; }
26
28
29 internal EncryptionPolicy EncryptionPolicy { get; set; }
30
31 internal bool RemoteCertRequired { get; set; }
32
33 internal bool CheckCertName { get; set; }
34
35 internal RemoteCertificateValidationCallback CertValidationDelegate { get; set; }
36
37 internal LocalCertSelectionCallback CertSelectionDelegate { get; set; }
38
40
49
50 internal object UserState { get; }
51
53
70
72 {
75 CheckCertName = false;
78 IsServer = true;
79 RemoteCertRequired = sslServerAuthenticationOptions.ClientCertificateRequired;
80 if (System.Net.NetEventSource.Log.IsEnabled())
81 {
82 System.Net.NetEventSource.Info(this, $"Server RemoteCertRequired: {RemoteCertRequired}.", ".ctor");
83 }
84 TargetHost = string.Empty;
87 if (sslServerAuthenticationOptions.ServerCertificateContext != null)
88 {
89 CertificateContext = sslServerAuthenticationOptions.ServerCertificateContext;
90 }
91 else if (sslServerAuthenticationOptions.ServerCertificate != null)
92 {
93 if (sslServerAuthenticationOptions.ServerCertificate is X509Certificate2 { HasPrivateKey: not false } x509Certificate)
94 {
96 }
97 else
98 {
100 if (x509Certificate2 == null)
101 {
103 }
105 }
106 }
107 if (sslServerAuthenticationOptions.RemoteCertificateValidationCallback != null)
108 {
109 CertValidationDelegate = sslServerAuthenticationOptions.RemoteCertificateValidationCallback;
110 }
111 }
112
114 {
115 CheckCertName = false;
116 TargetHost = string.Empty;
117 IsServer = true;
121 }
122
124 {
129 RemoteCertRequired = sslServerAuthenticationOptions.ClientCertificateRequired;
131 CertificateRevocationCheckMode = sslServerAuthenticationOptions.CertificateRevocationCheckMode;
132 if (sslServerAuthenticationOptions.ServerCertificateContext != null)
133 {
134 CertificateContext = sslServerAuthenticationOptions.ServerCertificateContext;
135 }
136 else if (sslServerAuthenticationOptions.ServerCertificate is X509Certificate2 { HasPrivateKey: not false } x509Certificate)
137 {
139 }
140 if (sslServerAuthenticationOptions.RemoteCertificateValidationCallback != null)
141 {
142 CertValidationDelegate = sslServerAuthenticationOptions.RemoteCertificateValidationCallback;
143 }
144 }
145
147 {
148 if (protocols.HasFlag(SslProtocols.Tls12) || protocols.HasFlag(SslProtocols.Tls13))
149 {
150 protocols &= ~SslProtocols.Ssl2;
151 }
152 return protocols;
153 }
154}
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static X509Certificate2 FindCertificateWithPrivateKey(object instance, bool isServer, X509Certificate certificate)
RemoteCertificateValidationCallback CertValidationDelegate
SslAuthenticationOptions(ServerOptionsSelectionCallback optionCallback, object state, RemoteCertificateValidationCallback remoteCallback)
SslAuthenticationOptions(SslServerAuthenticationOptions sslServerAuthenticationOptions)
void UpdateOptions(SslServerAuthenticationOptions sslServerAuthenticationOptions)
SslAuthenticationOptions(SslClientAuthenticationOptions sslClientAuthenticationOptions, RemoteCertificateValidationCallback remoteCallback, LocalCertSelectionCallback localCallback)
static SslProtocols FilterOutIncompatibleSslProtocols(SslProtocols protocols)
static SslStreamCertificateContext Create(X509Certificate2 target, X509Certificate2Collection? additionalCertificates, bool offline)
static string net_ssl_io_no_server_cert
Definition SR.cs:52
Definition SR.cs:7
delegate ValueTask< SslServerAuthenticationOptions > ServerOptionsSelectionCallback(SslStream stream, SslClientHelloInfo clientHelloInfo, object? state, CancellationToken cancellationToken)
delegate X509Certificate ServerCertSelectionCallback(string hostName)