mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-15 16:34:40 +01:00
ignore exception on cert installation
This commit is contained in:
@@ -167,6 +167,8 @@ namespace ServerSelector
|
|||||||
await RevertHostsFile("/etc/hosts");
|
await RevertHostsFile("/etc/hosts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// remove cert
|
// remove cert
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
@@ -175,6 +177,11 @@ namespace ServerSelector
|
|||||||
store.Remove(new X509Certificate2(X509Certificate.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
store.Remove(new X509Certificate2(X509Certificate.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
||||||
store.Close();
|
store.Close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// may not be installed
|
||||||
|
}
|
||||||
|
|
||||||
// restore sodium
|
// restore sodium
|
||||||
if (!File.Exists(sodiumBackup))
|
if (!File.Exists(sodiumBackup))
|
||||||
@@ -281,7 +288,9 @@ namespace ServerSelector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// trust CA
|
// trust CA. TODO is this needed?
|
||||||
|
try
|
||||||
|
{
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
X509Store store = new(StoreName.Root, StoreLocation.LocalMachine);
|
X509Store store = new(StoreName.Root, StoreLocation.LocalMachine);
|
||||||
@@ -289,6 +298,11 @@ namespace ServerSelector
|
|||||||
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
|
||||||
store.Close();
|
store.Close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// update sodium lib
|
// update sodium lib
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user