Convert from P7B to PEM via OpenSSL
Try this:
$ openssl pkcs7 -inform der -in a.p7b -out a.cer
If it doesn't work, brings to a Windows machine and export follow this guide.
So to combine the above answers, the command is:openssl pkcs7 -in cert.p7b -inform DER -print_certs -out cert.pem
Verified to be working on Windows, using OpenSSL-Win64
/Thanks Bogdan for spotting the error
I followed this guide that instructs you to change the header/footer lines from
-----BEGIN PKCS #7 SIGNED DATA-----
[data]
-----END PKCS #7 SIGNED DATA-----
to
-----BEGIN CERTIFICATE-----
[data]
-----END CERTIFICATE-----
Then run the command openssl pkcs7 -in foo.modified.crt -print_certs -out foo.certs
(where foo.modified.crt
is the file that you saved the modified version into). This gave me the same results as running through a Windows certificate export as suggested in other answers.
As far as I know, the following should convert a pkcs7 cert to a pem
openssl pkcs7 -in certificate_file.p7b -print_certs -out cert.pem