ignore exception on cert installation

This commit is contained in:
Mikhail Tyukin
2025-03-30 22:00:24 -04:00
parent cd15896be1
commit 3769b8ef58

View File

@@ -167,6 +167,8 @@ namespace ServerSelector
await RevertHostsFile("/etc/hosts");
}
try
{
// remove cert
if (OperatingSystem.IsWindows())
{
@@ -175,6 +177,11 @@ namespace ServerSelector
store.Remove(new X509Certificate2(X509Certificate.CreateFromCertFile(AppDomain.CurrentDomain.BaseDirectory + "myCA.pfx")));
store.Close();
}
}
catch
{
// may not be installed
}
// restore sodium
if (!File.Exists(sodiumBackup))
@@ -281,7 +288,9 @@ namespace ServerSelector
}
}
// trust CA
// trust CA. TODO is this needed?
try
{
if (OperatingSystem.IsWindows())
{
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.Close();
}
}
catch
{
}
// update sodium lib