Hi,
I'm using wes-php to sign a specific header (wsa:To). However, I am running into an issue with the structure of the dom document after the security node is inserted into the owning document:
<ds:signature xmlns:ds="
http://www.w3.org/2000/09/xmldsig#">
<ds:signedinfo><ds:canonicalizationmethod algorithm="
http://www.w3.org/2001/10/xml-exc-c14n#">
<ds:signaturemethod algorithm="
http://www.w3.org/2001/04/xmldsig-more#rsa-sha256">
<ds:reference uri="#pfx8f883a8e-c05c-76b3-3ccd-36ee46498445"><ds:transforms><ds:transform algorithm="
http://www.w3.org/2001/10/xml-exc-c14n#"></ds:transform></ds:transforms><ds:digestmethod algorithm="
http://www.w3.org/2000/09/xmldsig#sha1"><ds:digestvalue>+NPCw2mcg9eJjOdVf5r5y95iN/w=</ds:digestvalue></ds:digestmethod></ds:reference></ds:signaturemethod></ds:canonicalizationmethod></ds:signedinfo><ds:signaturevalue>NkIWtDbzED4oVpQVsj0Af7ieRJOiXbv0ZsRBVSaQg17w6/f9QN1lMNCE5XweumZ0akLOCLf2W9WJehoeHqY4MDrq1XGQfV/zPDbhYwCDsVUloXiUfdfecOZrRsUk1VMoubWnSR55ohqysjFRoiviXfIFdSTqVmMJWeyKxJVhISxC9dVXoiKX6jIa6vXyb3YA58sZg1J6Car7Pm7zq9eTOgblgEBCDpWqNXmBYww2MxXQgEYMrngIPKw96woRMLZEtGFaqSO5gDnblz1NdWjkG7YQouiPr4EFJB+yepDd1u5laRTeDj+39PEAM9V/H+qkVVKnb4JgZZ+tqQ7yN/fjYpjm9gpMoOhzURU3ZASeGiBtKMg2qL0W8LwVpoh8T8g8598tU6WY1h+ECqz+QG+8CpdbCJR6/324FryXTqopEWkRfBm/FEB7HHE1Nlk3znCeTClTeUj0FcHwGbgQ7L/BpSVYo00N6MNtY+OlOqwc02UlHPIVsDhesENj52RC8eWo</ds:signaturevalue>
<ds:keyinfo><wsse:securitytokenreference><wsse:reference valuetype="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" uri="#pfxc76cc54f-3deb-1dee-4ed8-d179d50e57f8"></wsse:reference></wsse:securitytokenreference></ds:keyinfo></ds:signature>
I'm not sure why, but the CanonicalizationMethod has become a parent to SignatureMethod.
My calling class extends SoapClient and my __doRequest method is as follows:
public function __doRequest($request, $location, $saction, $version)
{
$dom = new \DOMDocument();
$dom->loadXML($request);
$objWSA = new WSASoap($dom);
$objWSA->addAction($saction);
$objWSA->addTo($location);
$dom = $objWSA->getDoc();
$objWSSE = new WSSESoap($dom);
$objWSSE->signBody = false;
$objWSSE->signAllHeaders = false;
$objWSSE->addTimestamp();
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type' => 'private'));
$objKey->loadKey($this->privateKey, true);
$objWSSE->signSoapDoc($objKey,['signSpecificHeaders' => ["
http://schemas.xmlsoap.org/ws/2004/08/addressing" => ["To" => $location] ]]);
$token = $objWSSE->addBinaryToken(file_get_contents($this->pPublicKey));
$objWSSE->attachTokentoSig($token);
$request = $objWSSE->saveXML();
return parent::__doRequest($request, $location, $saction, $version);
}
Any idea why this might be the case?
Best,
Grace