bseddon / xml-signer

Provides signing and verification of XML documents including support for XAdES
BSD 3-Clause "New" or "Revised" License
18 stars 7 forks source link

Added xmldsig to original document on enveloped signing #10

Closed arraintxo closed 2 years ago

arraintxo commented 2 years ago

Hi,

I think I found a solution, but I'm not sure if it will have some BC breaks or not.

To make this work I have injected the original XMLResource into the XMLSecurityDSig constructor, so the generated Signature element is created inside the document. This change seems to allow a correct digest generation.

Take a look at the generateDomDocument method, as i made a change to generate the DOM from the xml string when InputResourceInfo::isString returns true (I think this case was previously treated as a file, but that treatment gave an error to me)

My editor also made some mess trimming whitespaces, tell me if you prefer me to create another pull request without this changes.