XML deserialize and decrypting encoding problem. Please help me
843811Jan 24 2007 — edited Feb 10 2007This is my first topic here, so at first I'd like to say "Hi" everyone and apologise for my bad english ;)
I have just finished my new application about signing/checking and encrypting/decrypting XML files. I use Apache XML Security packages to do this.
Everything works fine, instead of one...
I'm Polish and sometimes I have to encrypt or decrypt XML which includes polish letters like: 'ą' , 'ę', 'ł' and some others... If I encrypt such file, it succeeds. The problem is when I try to decrypt such an encrypted file. I recieve an error like :
"[Fatal Error] :2:7: An invalid XML character (Unicode: 0x19) was found in the element content o
f the document.
gov.mf.common.exceptions.SenderException: E_SENDER_DECRYPTION
at gov.mf.common.xml.encryption.EncryptTool.decrypt(Unknown Source)
at gov.mf.CERBER.TestCBR.main(Unknown Source)
Caused by: org.apache.xml.security.encryption.XMLEncryptionException: An invalid XML character
(Unicode: 0x19) was found in the element content of the document.
Original Exception was org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x19)
was found in the element content of the document.
at org.apache.xml.security.encryption.XMLCipher$Serializer.deserialize(Unknown Source)
at org.apache.xml.security.encryption.XMLCipher.decryptElement(Unknown Source)
at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
... 2 more
"
What's wrong? My XML document is UTF-8 encoded, with or without BOM. I wrote in in Notepad++ or any other editior which has UTF-8 encoding.
I'm parsing my XML with DOM. There is an interesting line in an error above like: " at org.apache.xml.security.encryption.XMLCipher$Serializer.deserialize(Unknown Source)" , do you know that?
Everything is fine when I try to encrypt/decrypt '�' or 'ń', but things go wrong with 'ą', 'ę', 'ł' and others... I also managed to encrypt and decrypt 'ł' but unfortunately, after decryption 'ł' turns into 'B'. It obviously an encoding problem, but how to fix it?
I would be really thankfull if some of You guys would help me.
Looking forward fo any answers.
Matthew
Message was edited by:
matthew_pl