Showing posts with label php Certificate not accepted. Unable to set private key file. Show all posts
Showing posts with label php Certificate not accepted. Unable to set private key file. Show all posts

Certificate not accepted. Unable to set private key file

Wednesday, November 4, 2015

I try to make a connection true SoapClient. I need a certificate for this. I received a .pfx certificate. I used the following command to create a .pem file.



openssl pkcs12 -in cert.pfx -out cert.pem -nodes



There is a password in the certificate so i need to enter it before i get the cert.pem file. So far so good, i think.



Now i try to connect to the wdsl service.



$url = "https://test.website.com/webservices/transfer.asmx?WSDL";
$cert = '/path/to/cert.pem';
$passphrase = "12345678";

$soapClient = new SoapClient($url, array('local_cert'=> $cert,'passphrase'=>$passphrase));


I get the following error:



(Warning) SoapClient::SoapClient(): Unable to set private key file `/var/www/vhosts/............./cert.pem'



I think te problem is the certificate. Is the way that i convert the .pfx to a .pem the correct way?