From 287abcdc5e662239b3e55ae31d807ae1b8cfd46f Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Sat, 14 Mar 2026 14:01:39 +0100 Subject: [PATCH] Fixed an issue with loading certificate bundles on Windows --- Duplicati/Library/Certificates/CertificateGenerator.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Duplicati/Library/Certificates/CertificateGenerator.cs b/Duplicati/Library/Certificates/CertificateGenerator.cs index dc3dfcd34..4252350df 100644 --- a/Duplicati/Library/Certificates/CertificateGenerator.cs +++ b/Duplicati/Library/Certificates/CertificateGenerator.cs @@ -106,7 +106,10 @@ public static class CertificateGenerator // Use a temporary password to avoid unprotected key material in memory var tempPassword = CertificateStorageHelper.GeneratePfxPassword(); var export = certificate.Export(X509ContentType.Pfx, tempPassword); - var certWithKey = X509CertificateLoader.LoadPkcs12(export, tempPassword); + var certWithKey = X509CertificateLoader.LoadPkcs12( + export, + tempPassword, + X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); CryptographicOperations.ZeroMemory(export); // Create a new ECDsa instance with the same key parameters for the return value @@ -224,7 +227,10 @@ public static class CertificateGenerator // Use a temporary password to avoid unprotected key material in memory var tempPassword = CertificateStorageHelper.GeneratePfxPassword(); var export = certWithKey.Export(X509ContentType.Pfx, tempPassword); - var finalCert = X509CertificateLoader.LoadPkcs12(export, tempPassword); + var finalCert = X509CertificateLoader.LoadPkcs12( + export, + tempPassword, + X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); CryptographicOperations.ZeroMemory(export); // Create a new ECDsa instance with the same key parameters