Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UnmanagedCertificateContext.cs
Go to the documentation of this file.
3
4namespace System.Net;
5
6internal static class UnmanagedCertificateContext
7{
9 {
10 if (certContext.IsInvalid)
11 {
12 return new X509Certificate2Collection();
13 }
15 }
16
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 }
46}
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static X509Certificate2Collection GetRemoteCertificatesFromStoreContext(SafeFreeCertContext certContext)
static unsafe X509Certificate2Collection GetRemoteCertificatesFromStoreContext(IntPtr certContext)
static readonly IntPtr Zero
Definition IntPtr.cs:18