Reputation: 86
I did two implementations that should do the same thing: sign a XML file with a given X509 certificate.
What happened is that, for exactly the same XML file to be signed, it generates different values for SignatureValue. But all the other properties of the XML are exactly the same:
I tried even for small XML (e.g. only a <x/> tag), but the SignatureValue never matches.
Is there any case that all the data from the <Signature> tag matches, except for the SignatureValue?
Upvotes: 2
Views: 2522
Reputation: 86
I've found the solution. It happened because Apache Santuario adds line break in the signature tag. So that the <SignedInfo> tag have different contents if comparing between the one generated by Apache and the one generated from Java XML signature.
To fix that, I have put the following line of code before signing.
System.setProperty("org.apache.xml.security.ignoreLineBreaks", "true")
Upvotes: 3