Hi, to test the content encryption of XMLCipher I modified the test case of XML encryption. The modifed test case showed some serious problems inside XMLCipher as well as in the Xerces XMLSerializer.
The XML Encryption specification defines Content in the same way as the XML specification. According to these specs the content of an element is a DocumentFragment as it can consist of Text nodes, CDATA sections, comments and so on. Also it is not required to be a valid XML document. With this in mind I modified the relevant code of XMLCipher to treat Content as a DcumentFragment and have the Xerces XMLSerializer serialize it. Unfortunatly the XMLSerializer currently does not deal with DocumentFragment correctly. Please refer to Xerces Bugzilla reference 25853 and the attachement 9767. Its the bug report, a test case, and the patch to fix the problems in XMLSerializer. The modified XMLCipher content encryption can be used only with the fixed Xerces code. The attachement contains the patch to the XMLCipher (that also contains some code cleanup). The relevant code that deals with DocumentFragment is near the end of the patch file. If necessary I can provide the a Xerces jar file that contains the fixed XMLSerializer. The questions is, how do we proceed here? Regards, Werner
XMLCipher-2.zip
Description: Zip compressed data