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

◆ EnsureStoreOpened()

static X509Store System.Net.CertificateValidationPal.EnsureStoreOpened ( bool isMachineStore)
inlinestaticpackage

Definition at line 19 of file CertificateValidationPal.cs.

20 {
21 X509Store x509Store = (isMachineStore ? s_myMachineCertStoreEx : s_myCertStoreEx);
22 if (x509Store == null)
23 {
24 StoreLocation storeLocation = ((!isMachineStore) ? StoreLocation.CurrentUser : StoreLocation.LocalMachine);
25 if (1 == 0)
26 {
27 return null;
28 }
29 lock (s_syncObject)
30 {
31 x509Store = (isMachineStore ? s_myMachineCertStoreEx : s_myCertStoreEx);
32 if (x509Store == null)
33 {
34 try
35 {
36 x509Store = OpenStore(storeLocation);
37 if (System.Net.NetEventSource.Log.IsEnabled())
38 {
39 System.Net.NetEventSource.Info(null, $"storeLocation: {storeLocation} returned store {x509Store}", "EnsureStoreOpened");
40 }
41 if (isMachineStore)
42 {
43 s_myMachineCertStoreEx = x509Store;
44 }
45 else
46 {
47 s_myCertStoreEx = x509Store;
48 }
49 }
50 catch (Exception ex)
51 {
53 {
54 return null;
55 }
56 if (System.Net.NetEventSource.Log.IsEnabled())
57 {
58 System.Net.NetEventSource.Error(null, System.SR.Format(System.SR.net_log_open_store_failed, storeLocation, ex), "EnsureStoreOpened");
59 }
60 throw;
61 }
62 }
63 }
64 }
65 return x509Store;
66 }
static X509Store OpenStore(StoreLocation storeLocation)
static volatile X509Store s_myMachineCertStoreEx
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_log_open_store_failed
Definition SR.cs:92
Definition SR.cs:7

References System.Net.NetEventSource.Error(), System.SR.Format(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, System.SR.net_log_open_store_failed, System.Net.CertificateValidationPal.OpenStore(), System.Net.CertificateValidationPal.s_myCertStoreEx, System.Net.CertificateValidationPal.s_myMachineCertStoreEx, and System.Net.CertificateValidationPal.s_syncObject.

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