robrichards / wse-php

Libraries for adding WS-* support to ext/soap in PHP
130 stars 92 forks source link

Error Hash values do not match #59

Open vivianaZuluaga opened 4 years ago

vivianaZuluaga commented 4 years ago

Currently I generate the security headers for a request as follows: $doc = new DOMDocument('1.0'); $doc->formatOutput = true; $doc->preserveWhiteSpace = false; $doc->loadXML($request); $objWSSE = new WSSESoap($doc, false); / Sign all headers to include signing the WS-Addressing headers / $objWSSE->signAllHeaders = true; $objWSSE->signBody = true; $objWSSE->addTimestamp(); $objWSSE->addUserToken($this->_username, $this->_password, false); / create new XMLSec Key using RSA SHA-1 and type is private key / $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private')); / load the private key from file - last arg is bool if key in file (true) or is string (FALSE) / $objKey->loadKey(PRIVATE_KEY, true); / Sign the message - also signs appropraite WS-Security items / $objWSSE->signSoapDoc($objKey); / Add certificate (BinarySecurityToken) to the message and attach pointer to Signature / $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE)); $objWSSE->attachTokentoSig($token); $request = $objWSSE->saveXML();

When I make the request to the service I get the error message Hash values ​​do not match

robrichards commented 3 years ago

What versions are of the libraries, especially xmseclibs, are you using? Make sure to pull the latest. Also do you know what the soap server you are running against? I have seen some older versions of Microsoft soap not properly support namespace prefixes.