CaptainQuint
CaptainQuint

Reputation: 342

Using openssl_pkcs12_export_to_file()

So I have read the PHP manual (HERE) but I'm not sure if it's does exactly what I think it is supposed to do. I need to convert a PFX certificate to a PEM. My question is, does either the above mentioned method or the openssl_pkcs12_export() method do what I need, or does it simply just export the information of the pkcs12 file?

To complete what I need to do, would I need to use the exec() method and use the appropriate openssl command, such as the one listed below:

openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

Upvotes: 2

Views: 525

Answers (1)

Zak
Zak

Reputation: 7515

Unless I am mistaken in your needs... You are just slightly off...

pkcs12 -in certificate.pfx -out certificate.pem -clcerts

You may also need to

pkcs12 -in certificate.pfx -out ca-certificate.pem -cacerts

-clcerts is only for client certificates

-cacerts is for non-client

Upvotes: 2

Related Questions