Commit 25383a4f authored by Honfika's avatar Honfika

fix

parent fcb8301f
...@@ -6,13 +6,12 @@ using Titanium.Web.Proxy.Helpers; ...@@ -6,13 +6,12 @@ using Titanium.Web.Proxy.Helpers;
namespace Titanium.Web.Proxy.Network namespace Titanium.Web.Proxy.Network
{ {
internal sealed class DefaultCertificateDiskCache : ICertificateCache public sealed class DefaultCertificateDiskCache : ICertificateCache
{ {
private const string defaultCertificateDirectoryName = "crts"; private const string defaultCertificateDirectoryName = "crts";
private const string defaultCertificateFileExtension = ".pfx"; private const string defaultCertificateFileExtension = ".pfx";
private const string defaultRootCertificateFileName = "rootCert" + defaultCertificateFileExtension; private const string defaultRootCertificateFileName = "rootCert" + defaultCertificateFileExtension;
private string? rootCertificatePath; private string? rootCertificatePath;
private string? certificatePath;
public X509Certificate2? LoadRootCertificate(string pathOrName, string password, X509KeyStorageFlags storageFlags) public X509Certificate2? LoadRootCertificate(string pathOrName, string password, X509KeyStorageFlags storageFlags)
{ {
...@@ -56,8 +55,6 @@ namespace Titanium.Web.Proxy.Network ...@@ -56,8 +55,6 @@ namespace Titanium.Web.Proxy.Network
{ {
// do nothing // do nothing
} }
certificatePath = null;
} }
private X509Certificate2? loadCertificate(string path, string password, X509KeyStorageFlags storageFlags) private X509Certificate2? loadCertificate(string path, string password, X509KeyStorageFlags storageFlags)
...@@ -95,20 +92,15 @@ namespace Titanium.Web.Proxy.Network ...@@ -95,20 +92,15 @@ namespace Titanium.Web.Proxy.Network
private string getCertificatePath(bool create) private string getCertificatePath(bool create)
{ {
if (certificatePath == null) string path = getRootCertificateDirectory();
{
string path = getRootCertificateDirectory();
string certPath = Path.Combine(path, defaultCertificateDirectoryName);
if (create && !Directory.Exists(certPath))
{
Directory.CreateDirectory(certPath);
}
certificatePath = certPath; string certPath = Path.Combine(path, defaultCertificateDirectoryName);
if (create && !Directory.Exists(certPath))
{
Directory.CreateDirectory(certPath);
} }
return certificatePath; return certPath;
} }
private string getRootCertificateDirectory() private string getRootCertificateDirectory()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment