问题
I have an xml document. When I print the document using java libs I get the proper xml output. Then I sign the xml document using xmlsignatures. After signing, I try to print the document again. But this time the document is printed in such a way that all the Elements are JUMBLED . So I want to know whether xml signature modifies xml document? If yes then why?
回答1:
Signature may modify your structure by canonicalizing it. This is necessary because your xml can have different valid representations. In order to verify the signature all parties must agree on one canonicalized representation.
回答2:
Like @Mat, I would like to have more details about what you mean by JUMBLED. Nonetheless, your original document should not be altered in its structure if you have chosen the ENVELOPED (or obviously DETACHED) signature method. Conversely, choosing an ENVELOPING method does change your original document by wrapping it in a container that also includes the signature.
来源:https://stackoverflow.com/questions/10152350/error-due-to-xml-signature