also export CA cert in pem format

This commit is contained in:
cs8425
2026-04-29 02:52:48 +08:00
parent b256fe7b01
commit 2fe795d29a

View File

@@ -30,7 +30,8 @@ public sealed class ProxyCertificateAuthority
RootCerPath);
}
public string RootCerPath => Path.Combine(CertificateDirectory, "MikuSB.Proxy.Root.cer");
public string RootCerPath => Path.Join(CertificateDirectory, "MikuSB.Proxy.Root.cer");
public string RootCerPemPath => Path.Join(CertificateDirectory, "MikuSB.Proxy.Root.pem");
private static string CertificateDirectory => Path.Combine(AppContext.BaseDirectory, "proxy-certs");
@@ -55,6 +56,12 @@ public sealed class ProxyCertificateAuthority
if (!File.Exists(RootCerPath))
File.WriteAllBytes(RootCerPath, existing.Export(X509ContentType.Cert));
if (!File.Exists(RootCerPemPath))
{
string pemString = existing.ExportCertificatePem();
File.WriteAllText(RootCerPemPath, pemString);
}
return existing;
}