6 Oct 2008 14:28
unable to set private key file
Justin Finkelstein <justin <at> redwiredesign.com>
2008-10-06 12:28:41 GMT
2008-10-06 12:28:41 GMT
Hi guys I am using cURL to connect to a secure web service via HTTPS and, from the command-line, this works fine but from within PHP it doesn't. I've spent almost a whole day trying to resolve this and can't see a solution so I thought someone else might know. I originally have a PKCS#12 combined multicertificate which I split into its components: openssl pkcs12 -in MULTICERT.p12 -out ca.pem -cacerts -nokeys openssl pkcs12 -in MULTICERT.p12 -out client.pem -clcerts -nokeys openssl pkcs12 -in MULTICERT.p12 -out key.pem -nocerts I set the PEM passphrase for the key to 'password' for testing, and test that this all works via command-line: curl -v --key ./key.pem --cacert ./ca.pem --cert ./client.pem:password https://www.mbnet.pt/pvtn I get a response back, which means that the keys are understood by cURL. Translated into PHP, the code for the above line is: $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_SSLKEY, 'key.pem'); curl_setopt($ch, CURLOPT_CAINFO, getcwd().'/ca.pem'); curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/client.pem');(Continue reading)
RSS Feed