Wrong digest value for xml signatures using Java XML Digital Signature API Wrong digest value for xml signatures using Java XML Digital Signature API xml xml

Wrong digest value for xml signatures using Java XML Digital Signature API


If it is not too late to answer:

You create 2 Transforms in code (envelopedTransform and c14NTransform), but do not use them.

You create the reference with a single new Transform.ENVELOPED.http://www.w3.org/TR/2001/REC-xml-c14n-20010315 (C14N) transform is not applied.

Now, I do not know for sure what the XML security standard says the behaviour should be in this case. Maybe other tools automatically apply C14N transform as well.

I know for sure if you do NOT specify any transform JDK will apply at least C14N transform.

Basically change that fac.newReference("", ...) and pass transformList into it instead of Collections.singletonList().


Ideally the DigestValue element contains the actual base64-encoded digest value in Java XML signature API. Could you please verify your digest value created from XMLSec is also base64-encoded.