Extract RSA private key from PFX certificate in PHP

Viewed 388

How can I extract RSA PRIVATE KEY from .PFX certificate in PHP? I used this command in terminal and it works

openssl pkcs12 -in cert.pfx -nocerts -nodes -passin pass:1234 | openssl rsa -out privkey.pem

I basically need to do the same as that command but in PHP when user uploads their file, I've tried with openssl_pkcs12_read but it doesn't have RSA PRIVATE KEY.

0 Answers
Related