Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AcquireCredentialsHandleSchannelCred()

static unsafe SafeFreeCredentials System.Net.Security.SslStreamPal.AcquireCredentialsHandleSchannelCred ( X509Certificate2 certificate,
SslProtocols protocols,
EncryptionPolicy policy,
bool isServer )
inlinestatic

Definition at line 100 of file SslStreamPal.cs.

101 {
103 global::Interop.SspiCli.CredentialUse credUsage;
104 global::Interop.SspiCli.SCHANNEL_CRED.Flags flags;
105 if (!isServer)
106 {
107 credUsage = global::Interop.SspiCli.CredentialUse.SECPKG_CRED_OUTBOUND;
108 flags = global::Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_CRED_MANUAL_CRED_VALIDATION | global::Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_CRED_NO_DEFAULT_CREDS | global::Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_SEND_AUX_RECORD;
109 if ((protocolFlagsFromSslProtocols == 0 || ((uint)protocolFlagsFromSslProtocols & 0xFFFFFFC3u) != 0) && policy != EncryptionPolicy.AllowNoEncryption && policy != EncryptionPolicy.NoEncryption)
110 {
111 flags |= global::Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_USE_STRONG_CRYPTO;
112 }
113 }
114 else
115 {
116 credUsage = global::Interop.SspiCli.CredentialUse.SECPKG_CRED_INBOUND;
117 flags = global::Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_SEND_AUX_RECORD;
118 }
119 if (System.Net.NetEventSource.Log.IsEnabled())
120 {
121 System.Net.NetEventSource.Info($"flags=({flags}), ProtocolFlags=({protocolFlagsFromSslProtocols}), EncryptionPolicy={policy}", null, "AcquireCredentialsHandleSchannelCred");
122 }
123 global::Interop.SspiCli.SCHANNEL_CRED sCHANNEL_CRED = CreateSecureCredential(flags, protocolFlagsFromSslProtocols, policy);
124 global::Interop.Crypt32.CERT_CONTEXT* ptr = null;
125 if (certificate != null)
126 {
127 sCHANNEL_CRED.cCreds = 1;
128 ptr = (global::Interop.Crypt32.CERT_CONTEXT*)(void*)certificate.Handle;
129 sCHANNEL_CRED.paCred = &ptr;
130 }
132 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static SafeFreeCredentials AcquireCredentialsHandle(SslStreamCertificateContext certificateContext, SslProtocols protocols, EncryptionPolicy policy, bool isServer)
static int GetProtocolFlagsFromSslProtocols(SslProtocols protocols, bool isServer)
static unsafe global::Interop.SspiCli.SCHANNEL_CRED CreateSecureCredential(global::Interop.SspiCli.SCHANNEL_CRED.Flags flags, int protocols, EncryptionPolicy policy)

References System.Net.Security.SslStreamPal.AcquireCredentialsHandle(), System.Net.Security.SslStreamPal.CreateSecureCredential(), System.Net.Security.SslStreamPal.GetProtocolFlagsFromSslProtocols(), System.Net.NetEventSource.Info(), and System.Net.NetEventSource.Log.

Referenced by System.Net.Security.SslStreamPal.AcquireCredentialsHandle().