Hi,

I'm trying to create a PHP client that can communicate with a WCF server using certificate security. I am having a problem with the signature; the server is logging this error: "The signature verification failed. Please see inner exception for fault details." and the inner exception: "Digest verification failed for Reference '#SigID-666305ce-e4a3-4fe3'."

Here's my code:

--- START CODE

//create message
$wsdl = "https://localhost:4792/HelloWorld.svc";
$payload = "<ns1:MyOperation1 xmlns:ns1=\"https://schemas.microsoft.com/2003/10/Serialization/\"><ns1:myValue1 xmlns:ns1=\"https://schemas.microsoft.com/2003/10/Serialization/\">Dan</ns1:myValue1></ns1:MyOperation1>";
$reqMessage = new WSMessage($payload, array("to"=>$wsdl,
"action"=>"https://tempuri.org/IHelloWorld/MyOperation1"));

//load certificate
$server_cert = ws_get_cert_from_file("server_cert.cert");
$client_cert = ws_get_cert_from_file("client_cert.cert");
$client_pk = ws_get_key_from_file("client_cert.pem");

$sec_token = new WSSecurityToken(array("privateKey" => $client_pk,
"certificate" => $client_cert,
"receiverCertificate" => $server_cert,
"ttl" => 300));

//load policy
$policy_xml = file_get_contents("policy.xml");
$policy_array = array("inpolicy"=>$policy_xml,
"outpolicy"=>$policy_xml);
$policy = new WSPolicy(array("security" => $policy_array));

//create client
$client = new WSClient(array("useWSA" => TRUE,
"useMTOM" => FALSE,
"useSOAP" => "1.1",
//"wsdl" => $wsdl . "?wsdl",
"securityToken"=>$sec_token,
"policy"=>$policy));
$resMessage = $client->request($reqMessage);

 

--- END CODE

The policy I'm using is the one returned by the WSDL file (attached).

 

Did anyone ever get an error like this? or managed to make this work?

Any help is greatly appreciated

Dan