Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 25383a4

Browse files
committed
fix
1 parent fcb8301 commit 25383a4

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/Titanium.Web.Proxy/Network/DefaultCertificateDiskCache.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
namespace Titanium.Web.Proxy.Network
88
{
9-
internal sealed class DefaultCertificateDiskCache : ICertificateCache
9+
public sealed class DefaultCertificateDiskCache : ICertificateCache
1010
{
1111
private const string defaultCertificateDirectoryName = "crts";
1212
private const string defaultCertificateFileExtension = ".pfx";
1313
private const string defaultRootCertificateFileName = "rootCert" + defaultCertificateFileExtension;
1414
private string? rootCertificatePath;
15-
private string? certificatePath;
1615

1716
public X509Certificate2? LoadRootCertificate(string pathOrName, string password, X509KeyStorageFlags storageFlags)
1817
{
@@ -56,8 +55,6 @@ public void Clear()
5655
{
5756
// do nothing
5857
}
59-
60-
certificatePath = null;
6158
}
6259

6360
private X509Certificate2? loadCertificate(string path, string password, X509KeyStorageFlags storageFlags)
@@ -95,20 +92,15 @@ private string getRootCertificatePath(string pathOrName)
9592

9693
private string getCertificatePath(bool create)
9794
{
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();
10796

108-
certificatePath = certPath;
97+
string certPath = Path.Combine(path, defaultCertificateDirectoryName);
98+
if (create && !Directory.Exists(certPath))
99+
{
100+
Directory.CreateDirectory(certPath);
109101
}
110102

111-
return certificatePath;
103+
return certPath;
112104
}
113105

114106
private string getRootCertificateDirectory()

0 commit comments

Comments
 (0)