Trouble connecting to SSL-encrypted web service with PHP

angelinadepth

New Member
I got two certificate files from the provider, one in a .cer-format and one in a .p7b-format. I then converted the p7b-certificate to a p12-certificate. With this certificate I'm able to connect to the wsdl from my browser.Then I proceeded to convert that certificate to .pem-format, using some instructions I found on this site.\[code\]openssl pkcs12 -clcerts -nokeys -out test.pem -in mycert.p12openssl pkcs12 -nocerts -out key.pem -in mycert.p12\[/code\]then combing the cert with the key using the following command:\[code\]cat test.pem key.pem > cert.pem\[/code\]Heres my construct for the web service class:\[code\]public function __construct() { $wsdl_url = 'https://url.to/web_service?wsdl'; $pass = 'passphrase'; $cert = 'cert.pem'; try { $this->client = new SoapClient($wsdl_url, array('local_cert' => $cert, 'passphrase' => $pass)); } catch(SoapFault $e) { print_r($e); }}\[/code\]And here is the error:\[code\]SSL operation failed with code 1. OpenSSL Error messages: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca in /var/www/html/..\[/code\]Trying to verify the certificate using:\[code\]openssl verify cert.pem\[/code\]gives me the following error:\[code\]error 20 at 0 depth lookup:unable to get local issuer certificate\[/code\]I've also tried creating the .pem-certificate using the following openssl command:\[code\]openssl pkcs12 -in mycert.p12 -out mycert.pem\[/code\]Verifying this gives me OK, but PHP gives me the following error:\[code\]Unable to set local cert chain file `mycert.pem'; Check that your cafile/capath settings include details of your certificate and its issuer\[/code\]I'm assuming it should be possible to make it work somehow, as I am able to access the wsdl through my browser, by using the .p12-certificate. But I'm not able to locate a solution as to how I should proceed.Thanks in advance.
 
Back
Top