mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-13 07:24:52 +01:00
ignore exception on cert installation
This commit is contained in:
@@ -167,13 +167,20 @@ namespace ServerSelector
|
|||||||
await RevertHostsFile("/etc/hosts");
|
await RevertHostsFile("/etc/hosts");
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove cert
|
try
|
||||||
if (OperatingSystem.IsWindows())
|
|
||||||
{
|
{
|
||||||
X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
|
// remove cert
|
||||||
store.Open(OpenFlags.ReadWrite);
|
if (OperatingSystem.IsWindows())
|
||||||
store.Remove(new X509Certificate2(X509Certificate.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
{
|
||||||
store.Close();
|
X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
|
||||||
|
store.Open(OpenFlags.ReadWrite);
|
||||||
|
store.Remove(new X509Certificate2(X509Certificate.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
||||||
|
store.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// may not be installed
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore sodium
|
// restore sodium
|
||||||
@@ -281,13 +288,20 @@ namespace ServerSelector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// trust CA
|
// trust CA. TODO is this needed?
|
||||||
if (OperatingSystem.IsWindows())
|
try
|
||||||
{
|
{
|
||||||
X509Store store = new(StoreName.Root, StoreLocation.LocalMachine);
|
if (OperatingSystem.IsWindows())
|
||||||
store.Open(OpenFlags.ReadWrite);
|
{
|
||||||
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
X509Store store = new(StoreName.Root, StoreLocation.LocalMachine);
|
||||||
store.Close();
|
store.Open(OpenFlags.ReadWrite);
|
||||||
|
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
||||||
|
store.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update sodium lib
|
// update sodium lib
|
||||||
|
|||||||
Reference in New Issue
Block a user