How to generate a PKCS12 (.p12) from a .SPC (code signing certificate) and .PKCS12 (private key)?

[亡魂溺海] 提交于 2019-12-06 16:26:48

To be honest I can not understand at all what you are trying to do.

You got back the SPC file which is just the #PKCS7 der encoding with your certificate.

You also have your private key.

All you need to do is import the certificate to the pkcs12 keystore to have the signed certificate with your private key.

Here is how I created a .p12 file from GoDaddy's .spc file: 1. Right click myCert.spc, Install Certificate (to install the .spc into Windows) 2. Double click myCert.spc (to open it in certmgr), export to a .cer file. 3. Import that .cer file into Firefox. 4. From with Firefox: backup what you just imported to create a .p12 file.

Then you can use that .p12 file to sign your code.

To create a P12 truststore from a private key and a SPC file do the following steps with OpenSSL:

  1. (Optional): Extract the private key from an old P12 truststore:

openssl pkcs12 -in old.p12 -nocerts -out privateKey.pem

  1. Extract the certificate chain from the SPC file:

openssl pkcs7 -inform DER -outform PEM -in godaddy.spc -print_certs > certificates.pem

  1. Create the new P12 truststore:

openssl pkcs12 -export -out new.p12 -inkey privateKey.pem -in certificates.pem

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