Convert a CERT/PEM certificate to a PFX certificate

匿名 (未验证) 提交于 2019-12-03 02:08:02

问题:

I've seen a couple questions about how to convert a PFX to a cert file, but I need to go the other way.

I have two files:

bob_cert.cert

bob_key.pem

I'd like to convert them to a single .pfx file. Is there a tool that does this?

回答1:

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


回答2:

Here is how to do this on Windows without third-party tools:

  1. 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".

  2. 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.

  3. 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.



回答3:

I created .pfx file from .key and .pem files.

Like this openssl pkcs12 -inkey rootCA.key -in rootCA.pem -export -out rootCA.pfx

That's not the direct answer but still maybe it helps out someone else.



回答4:

If you have a self-signed certificate generated by makecert on a Windows machine, you will get two files: cert.pvk and cert.cer. These can be converted to a pfx using pvk2pfx

pvk2pfx is found in the same location as makecert (e.g. C:\Program Files (x86)\Windows Kits\10\bin\x86 (or similar))

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


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!