XML Signing with ENVELOPING type no longer works in JDK 11 #864
Labels
bug
Issues that are problems in the code as reported by the community
Reported to OpenJDK / JBS
Issues that have been reported upstream to the OpenJDK community
Milestone
Platform: Open JDK 11.02, running on Ubuntu 18.04 or MacOS Mojave 10.14.2
Architecture: 64 bit
Please consider this test case: https://github.com/marianogonzalez/jdk11-xml-crypto-enveloping-issue/blob/master/src/test/java/com/mg/sign/enveloping/EnvelopingTestCase.java.
When run with JDK 1.8, that code works perfectly and outputs the following XML:
When the same code is run with with Open JDK 11.02, the following error is obtained:
By disabling the document's strict checking option, you can see that the problem is that the signed XML looks like this:
The problem is that the generated
<dsig:Signature>
element no longer replaces the original root element, but instead is appended as a sibling of it.This is a behavior change with respect to 1.8 that produces an invalid document.
Workaround: to disable the document's strict checking and manually removing the original root element.
The text was updated successfully, but these errors were encountered: