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

◆ GetRemoteCertificatesFromStoreContext() [1/2]

static unsafe X509Certificate2Collection System.Net.UnmanagedCertificateContext.GetRemoteCertificatesFromStoreContext ( IntPtr certContext)
inlinestaticpackage

Definition at line 17 of file UnmanagedCertificateContext.cs.

18 {
19 X509Certificate2Collection x509Certificate2Collection = new X509Certificate2Collection();
20 if (certContext == IntPtr.Zero)
21 {
22 return x509Certificate2Collection;
23 }
24 global::Interop.Crypt32.CERT_CONTEXT cERT_CONTEXT = *(global::Interop.Crypt32.CERT_CONTEXT*)(void*)certContext;
25 if (cERT_CONTEXT.hCertStore != IntPtr.Zero)
26 {
27 global::Interop.Crypt32.CERT_CONTEXT* pPrevCertContext = null;
28 while (true)
29 {
30 global::Interop.Crypt32.CERT_CONTEXT* ptr = global::Interop.Crypt32.CertEnumCertificatesInStore(cERT_CONTEXT.hCertStore, pPrevCertContext);
31 if (ptr == null)
32 {
33 break;
34 }
35 X509Certificate2 x509Certificate = new X509Certificate2(new IntPtr(ptr));
36 if (System.Net.NetEventSource.Log.IsEnabled())
37 {
38 System.Net.NetEventSource.Info(certContext, $"Adding remote certificate:{x509Certificate}", "GetRemoteCertificatesFromStoreContext");
39 }
40 x509Certificate2Collection.Add(x509Certificate);
41 pPrevCertContext = ptr;
42 }
43 }
44 return x509Certificate2Collection;
45 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)

References System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Add(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, and System.IntPtr.Zero.