是否可以将证书文件转换为 pfx 文件?我尝试将我的 cerf 文件导入 IE,但它从未显示在“个人”选项卡下,因此我无法在那里导出。
我正在寻找是否有可用的替代方案。
仅供引用,cerf 文件是通过使用“keytool”创建的,然后导出到证书文件。
最佳答案
本文介绍了从 .cer 文件创建 .pfx 文件的两种方法:
Create your public & private Keys (You will be prompt to define the private key’s password):
makecert.exe -sv MyKey.pvk -n "CN=.NET Ready!!!" MyKey.cer
Create your PFX file from the public and private key
pvk2pfx.exe -pvk MyKey.pvk -spc MyKey.cer -pfx MyPFX.pfx -po toto
通过将字节数组直接写入文件,您可以在 C# 中以编程方式执行此操作:
byte[] certificateData = certificate.Export(X509ContentType.Pfx, "YourPassword");
File.WriteAllBytes(@"C:\YourCert.pfx", certificateData);
通常(如果您使用的是 IE 8)您可能想看看关于 SO 的这个答案:
希望对你有帮助。
关于security - 从证书文件到 pfx 文件的转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4795924/