I have x509Certificate2 protected with a password in the FPX file. I would like to create a function that will remove password from it.
Stream CreatePFXWithoutPassword(string filenamePfx, string password)
{
...return new file
}
Is that even possible?
Sure, just import it, and export it again with "no" password (which really means the empty password).
X509Certificate2Collection coll = new X509Certificate2Collection();
coll.Import(filename, password);
byte[] nopw = coll.Export(X509ContentType.Pfx);
// Optional: Clean up unnecessary resources.
foreach (X509Certificate2 cert in coll)
{
cert.Dispose();
}
return nopw;