diff --git a/src/Certes/Pkcs/PfxBuilder.cs b/src/Certes/Pkcs/PfxBuilder.cs index b67b59cd..54433b89 100644 --- a/src/Certes/Pkcs/PfxBuilder.cs +++ b/src/Certes/Pkcs/PfxBuilder.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using Certes.Crypto; +using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Pkcs; using Org.BouncyCastle.Pkix; @@ -70,11 +71,14 @@ public PfxBuilder(byte[] certificate, IKey privateKey) /// /// The friendly name. /// The password. + /// The Cert Algorithm /// The PFX data. - public byte[] Build(string friendlyName, string password) + public byte[] Build(string friendlyName, string password, DerObjectIdentifier certAlgorithm = null) { var keyPair = LoadKeyPair(); - var store = new Pkcs12StoreBuilder().Build(); + var builder = new Pkcs12StoreBuilder(); + if(certAlgorithm!=null) builder.SetCertAlgorithm(certAlgorithm); + var store = builder.Build(); var entry = new X509CertificateEntry(certificate); store.SetCertificateEntry(friendlyName, entry);