I have a certificate that is a PKCS#7 certificate (.spc), and also have a .pem file, how can I convert this to .pfx file on OpenSSL app?
Thanks.
I have a certificate that is a PKCS#7 certificate (.spc), and also have a .pem file, how can I convert this to .pfx file on OpenSSL app?
Thanks.
First, file extensions have no power; they are usually used to indicate the format of the file contents but nothing enforces this. Thus a file named 'something.pem' usually should contain PEM-format data, but it is entirely possible to use that extension for a file that isn't PEM, and to use a different extension for a file that is PEM.
Second, PEM is not a single format, it is a family of dozens of formats, including about one dozen used for private keys.
If you have a .pem file which is actually a private key in one of the PEM formats supported by OpenSSL, and the PKCS7 (.spc) file contains the cert or chain for the public key which matches that private key, and you have or get OpenSSL (since you tagged it I assume you do), then:
openssl pkcs7 -in whatever.spc -inform der -print_certs \
| openssl pkcs12 -export -inkey keyfile.pem -out newfile.pfx
If you have a .pem file which is anything other than a PEM-format private key matching the public key in the cert/chain in the PKCS7, you do not have the the data necessary to create a PKCS12/PFX file.