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

◆ GetRequestCertificateAuthorities()

static unsafe string[] System.Net.CertificateValidationPal.GetRequestCertificateAuthorities ( SafeDeleteContext securityContext)
inlinestaticpackage

Definition at line 119 of file CertificateValidationPal.cs.

120 {
121 global::Interop.SspiCli.SecPkgContext_IssuerListInfoEx ctx = default(global::Interop.SspiCli.SecPkgContext_IssuerListInfoEx);
122 SafeHandle sspiHandle;
123 bool flag = SSPIWrapper.QueryContextAttributes_SECPKG_ATTR_ISSUER_LIST_EX(GlobalSSPI.SSPISecureChannel, securityContext, ref ctx, out sspiHandle);
124 string[] array = Array.Empty<string>();
125 try
126 {
127 if (flag && ctx.cIssuers != 0)
128 {
129 array = new string[ctx.cIssuers];
130 Span<global::Interop.SspiCli.CERT_CHAIN_ELEMENT> span = new Span<global::Interop.SspiCli.CERT_CHAIN_ELEMENT>((void*)sspiHandle.DangerousGetHandle(), array.Length);
131 for (int i = 0; i < span.Length; i++)
132 {
133 if (span[i].cbSize != 0)
134 {
135 byte[] encodedDistinguishedName = new Span<byte>((void*)span[i].pCertContext, checked((int)span[i].cbSize)).ToArray();
136 X500DistinguishedName x500DistinguishedName = new X500DistinguishedName(encodedDistinguishedName);
137 array[i] = x500DistinguishedName.Name;
138 if (System.Net.NetEventSource.Log.IsEnabled())
139 {
140 System.Net.NetEventSource.Info(securityContext, $"IssuerListEx[{array[i]}]", "GetRequestCertificateAuthorities");
141 }
142 }
143 }
144 }
145 }
146 finally
147 {
148 sspiHandle?.Dispose();
149 }
150 return array;
151 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)

References System.array, System.Runtime.InteropServices.SafeHandle.DangerousGetHandle(), System.Runtime.InteropServices.SafeHandle.Dispose(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, System.Security.Cryptography.X509Certificates.X500DistinguishedName.Name, System.Net.SSPIWrapper.QueryContextAttributes_SECPKG_ATTR_ISSUER_LIST_EX(), System.Net.GlobalSSPI.SSPISecureChannel, and System.Span< T >.ToArray().

Referenced by System.Net.Security.SecureChannel.GetRequestCertificateAuthorities().