Ssl – How to convert certificate from CA to .pfx file

certificateopensslssl

I have been struggling since last night to create a .pfx file using OpenSSL. I have been following this document and have been following the instructions under the Get a certificate using OpenSSL header.

I have also tried various things from trawling through posts but my lack of experience in this area is really impeding my efforts.

I am at the step here: openssl pkcs12 -export -out myserver.pfx -inkey myserver.key -in myserver.crt and am using the OpenSSL.exe console.

I get the error: unable to load certificates

I am using IIS 7 and purchased a certificate from Symantec. I think my problem is that my certificate starts like:

----BEGIN PKCS #7 SIGNED DATA----- and not simply -----BEGIN CERTIFICATE----- so the command in my walk-through is not able to deal with it.

Is this a .pb7 certificate?

I have a .key file and a .crt file. How do I create a .pfx files with the above formats?

Best Answer

To extract the certificate from the PKCS#7 container that you appear to have, run

openssl pkcs7 -in cert.p7b -print_certs -out cert.cer

Than you can use the pkcs12 command you already stated in the question to generate the PKCS#12 (pfx) container.