|
6 | 6 |
|
7 | 7 | namespace Titanium.Web.Proxy.Network |
8 | 8 | { |
9 | | - internal sealed class DefaultCertificateDiskCache : ICertificateCache |
| 9 | + public sealed class DefaultCertificateDiskCache : ICertificateCache |
10 | 10 | { |
11 | 11 | private const string defaultCertificateDirectoryName = "crts"; |
12 | 12 | private const string defaultCertificateFileExtension = ".pfx"; |
13 | 13 | private const string defaultRootCertificateFileName = "rootCert" + defaultCertificateFileExtension; |
14 | 14 | private string? rootCertificatePath; |
15 | | - private string? certificatePath; |
16 | 15 |
|
17 | 16 | public X509Certificate2? LoadRootCertificate(string pathOrName, string password, X509KeyStorageFlags storageFlags) |
18 | 17 | { |
@@ -56,8 +55,6 @@ public void Clear() |
56 | 55 | { |
57 | 56 | // do nothing |
58 | 57 | } |
59 | | - |
60 | | - certificatePath = null; |
61 | 58 | } |
62 | 59 |
|
63 | 60 | private X509Certificate2? loadCertificate(string path, string password, X509KeyStorageFlags storageFlags) |
@@ -95,20 +92,15 @@ private string getRootCertificatePath(string pathOrName) |
95 | 92 |
|
96 | 93 | private string getCertificatePath(bool create) |
97 | 94 | { |
98 | | - if (certificatePath == null) |
99 | | - { |
100 | | - string path = getRootCertificateDirectory(); |
101 | | - |
102 | | - string certPath = Path.Combine(path, defaultCertificateDirectoryName); |
103 | | - if (create && !Directory.Exists(certPath)) |
104 | | - { |
105 | | - Directory.CreateDirectory(certPath); |
106 | | - } |
| 95 | + string path = getRootCertificateDirectory(); |
107 | 96 |
|
108 | | - certificatePath = certPath; |
| 97 | + string certPath = Path.Combine(path, defaultCertificateDirectoryName); |
| 98 | + if (create && !Directory.Exists(certPath)) |
| 99 | + { |
| 100 | + Directory.CreateDirectory(certPath); |
109 | 101 | } |
110 | 102 |
|
111 | | - return certificatePath; |
| 103 | + return certPath; |
112 | 104 | } |
113 | 105 |
|
114 | 106 | private string getRootCertificateDirectory() |
|
0 commit comments