简体   繁体   中英

Convert a .cer file to .pfx file

My ultimate objective is to sign my exe.

For this i would need a certificate. From my company's pKI i got a .cer file and .p7b (certificate chain) file.

Now to sign an exe i need a .pfx file. So i want to convert a .cer file to .pfx file

For this i donwloaded openssl distribution.

Now issuing this command openssl pkcs12 -export -in certificatename.cer -inkey privateKey.key -out certificatename.pfx -certfile cacert.cer is resulting into unable to load certificates.

Does anyone have any hints on this ?

best Regards, Saurav

So the trick was to perform the following steps if you want to sign an exe after you got a .cer file

  1. Convert .cer to .pem using openssl command
  2. Convert .pem to .pfx using openssl command
  3. Use signtool to sign the .exe with the .pfx file generated in the step 2.

For openssl commands to convert check this

https://www.sslshopper.com/ssl-converter.html

For signtool commands check this

https://msdn.microsoft.com/en-us/library/windows/desktop/aa388170(v=vs.85).aspx

cheers,

Saurav

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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