繁体   English   中英

从PFX证书中删除密码

[英]Remove password from PFX certificate

我用FPX文件中的密码保护了x509Certificate2。 我想创建一个将从中删除密码的功能。

Stream CreatePFXWithoutPassword(string filenamePfx, string password)
{
...return new file
}

那有可能吗?

当然,只需导入它,然后使用“ no”密码(这实际上意味着空密码)再次将其导出。

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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM