From 2fe795d29a28d7c4cba24af3aed88dd4da2e081a Mon Sep 17 00:00:00 2001 From: cs8425 Date: Wed, 29 Apr 2026 02:52:48 +0800 Subject: [PATCH] also export CA cert in pem format --- Proxy/ProxyCertificateAuthority.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Proxy/ProxyCertificateAuthority.cs b/Proxy/ProxyCertificateAuthority.cs index 1c92295..cf8df7a 100644 --- a/Proxy/ProxyCertificateAuthority.cs +++ b/Proxy/ProxyCertificateAuthority.cs @@ -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; }