3

I need to use cURL to access services to a resource using a certificate. I have only .pfx file. For cURL need two .pem file: CURLOPT_SSLKEY and CURLOPT_SSLCERT, like this:

$ch = curl_init();
----------------------------------
curl_setopt($ch, CURLOPT_SSLCERT, './cert.pem');
curl_setopt($ch, CURLOPT_SSLKEY, './key.pem');
----------------------------------
$output = curl_exec($ch);

How do I get key.pem and cert.pem from single .pfx file?

Martin Zvarík
  • 2,120
  • 22
  • 27
S.Ivanov
  • 181
  • 1
  • 5
  • It's not duplicate! **Answer is here:** https://stackoverflow.com/questions/59099201/how-to-convert-pfx-to-crt-and-pem-using-php/ – Martin Zvarík Dec 02 '19 at 18:38

1 Answers1

1

This has already been answered. Here's a link to the answer - it's what I used for my solution (same situation as yours)

Converting PFX to PEM using OpenSSL

Community
  • 1
  • 1
Watts Epherson
  • 692
  • 5
  • 9