robrichards/xmlseclibs

Append data to transform node

Opened this issue · 1 comments

When I sign the xml have this piece of code...

... <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> <dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <dsig:Reference> <dsig:Transforms> <dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"/></dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><dsig:DigestValue> ...

So, How can add data or elements to Transform node?

Like this

... <dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <dsig:Reference URI=""> <dsig:Transforms> <dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"> <dsig:XPath xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ancestor-or-self::soap:Body </dsig:XPath> </dsig:Transform> <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> </dsig:Transforms> <dsig:DigestMethod Algorithm="http:/ ...

If you are looking just to add the namespaces (soap from your example), you can use the namespaces element. It takes an array.
['http://www.w3.org/TR/1999/REC-xpath-19991116']['namespaces'] - array($prefix1 => $namespace1, $prefix2 => $namespace2)