我已经看到了几个关于如何将PFX转换为证书文件的问题,但我需要走另一种方式。

我有两个文件:

bob_cert.cert bob_key.pem

我想把它们转换成一个。pfx文件。有没有工具可以做到这一点?


当前回答

下面是如何在没有第三方工具的情况下在Windows上做到这一点:

Import certificate to the certificate store. In Windows Explorer select "Install Certificate" in context menu. Follow the wizard and accept default options "Local User" and "Automatically". Find your certificate in certificate store. On Windows 10 run the "Manage User Certificates" MMC. On Windows 2013 the MMC is called "Certificates". On Windows 10 by default your certificate should be under "Personal"->"Certificates" node. Export Certificate. In context menu select "Export..." menu: Select "Yes, export the private key": You will see that .PFX option is enabled in this case: Specify password for private key.

其他回答

下面是如何在没有第三方工具的情况下在Windows上做到这一点:

Import certificate to the certificate store. In Windows Explorer select "Install Certificate" in context menu. Follow the wizard and accept default options "Local User" and "Automatically". Find your certificate in certificate store. On Windows 10 run the "Manage User Certificates" MMC. On Windows 2013 the MMC is called "Certificates". On Windows 10 by default your certificate should be under "Personal"->"Certificates" node. Export Certificate. In context menu select "Export..." menu: Select "Yes, export the private key": You will see that .PFX option is enabled in this case: Specify password for private key.

我从.key和.pem文件创建了.pfx文件。

比如这个openssl pkcs12 -inkey rootCA。输入rootCA。-export -out rootCA.pfx . pem

这不是直接的答案,但它仍然可能帮助其他人。

openssl pkcs12 -inkey bob_key.pem -in bob_cert.cert -export -out bob_pfx.pfx

如果您在Windows机器上有一个由makecert.exe生成的自签名证书,您将得到两个文件:cert.pvk和cert.cer。这些可以使用pvk2pfx转换为pfx

pvk2pfx与makecert位于相同的位置(例如C:\Program Files (x86)\Windows Kits\10\bin\x86或类似的位置)

pvk2pfx -pvk cert.pvk -spc cert.cer -pfx cert.pfx