Description
I've been working on getting some code moved off of PHP and into Go, and in testing found different behavior from a known working PHP system. It appears that namespaces aren't getting propagated when taking the subset that is getting signed, as in the example in section 3.7 here https://www.w3.org/TR/2001/REC-xml-c14n-20010315
In our case the (extremely abbreviated) XML is:
<E:Envelope xmlns:E="http://schemas.xmlsoap.org/soap/envelope/">
<E:Body id="Body">
where in the dump I've extracted from inside the PHP library I'm using the body gets converted to
<E:Body xmlns:E="http://schemas.xmlsoap.org/soap/envelope/" id="Body">
and then generates the correct DigestValue.
I believe the canonicalization algorithm requires that when taking a subset, it needs to look up the chain for any namespace declarations, and move them to the highest level tag(s) that first reference that namespace (or something like that, the c14n specs are painful).