How to I extract private key/public key in digital signature .pfx
format using PHP?
I want to encrypt data with my private key .pfx
but I got an error when I open it using .pfx format. Another question: is it possible to extract the keys with .pfx
format? or should I use the .pem
format? Or is it possible to encrypt the data using .pfx
format?
PHP has a function to read this certificate:
$data = file_get_contents('/path/to/cert.pfx');
$certPassword = 'your password';
openssl_pkcs12_read($data, $certs, $certPassword);
var_dump($certs);
But to encrypt data with this certificate, you'll need the other PHP openssl functions.