My application signs the file (enveloped, full document is signed), but in the signed document every element now gets an extra namespace reference, e.g. <Study OID="123-456-789"> is transformed into: <Study OID="123-456-789" xmlns="http://www.cdisc.org/ns/odm/v1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
The library cascades *all* namespaces down the document prior to canonicalisation, so that they are all visible to the canonicalisation algorithm. So this sounds correct.
Also when veryfying the signed document, the signature is found to be invalid (due to the extra namespace references?).
That doesn't sound correct! Are you verifying a document produced with the code below, or an old document that's had the schema attributes added?
Cheers,
Berin