santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mathew_pl <>
Subject Apache XML Security Encoding problem in encrypting/decrypting XML
Date Tue, 30 Jan 2007 10:43:48 GMT

Hi everyone!

I've been spending hours on my problem and I cannot find any solution, so if
anyone could help me I'll be very thankfull.

Well... The problem is with Apache XML Security library. I have just written
small application to sign/encrypt/decrypt XML documents. Everything works
perfectly but one. When my XML document contains Polish characters like 'ś',
'ł', 'ę' and others there is a folowing exception thrown by jvm:

"[Fatal Error] :2:7: An invalid XML character (Unicode: 0x19) was found in
the element content o
f the document. E_SENDER_DECRYPTION
at Source)
at Source)
Caused by: 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 Source)
... 2 more"

What's wrong? In my opinion, my XML file is UTF-8 encoded (written in XML
Spy, ultraedit32, notepad++ and many others editors). But maybe I'm wrong
and something is wrong with my file encoding?

What's the most interesting: I've downloaded some examples like two classes
( and from XML apache Security website. For
example, in Encrypter class author does an example document on the fly,
making some nodes etc.. When I changed one textnode from: "Some simple text"
to "ąłęśóź" and tried to encrypt and decrypt it - I recieved the same error
:(  (of course source file was UTF-8 encoded). That would mean that
something is going wrong with encrypting Document, not parsing a file.

What's more interesting - encrypting and decrypting XML file which contains
only 'ł' character(s) success, but after decryption I have 'B' instead of
'ł'. That's the proof of encoding problem. For the other example, 'ó' is
successfully  encrypted and stays 'ó' after decryption. Ufortunately others
characters fails...  

I've posted similar message at Java Forum but noone could help me...
I've put some code there so please take a look, maybe it would help.
Here is this thread: 

XML Security topic becomes more and more popular nowadays so maybe some of
you had the same or similar problem and know the answer? Maybe something is
wrong with xmlsec-1.4.0.jar package? Please, help me if you can!

Oh, I would have forgotten...
Platform: Windows XP
IDE: Eclipse 3.2
Libraries: Apache XML Security - 1.4.0 RELEASE -->
Java: 1.5.0_05   (java 1.5 update 5)

Thanks in advance for any advice.
Sorry for my bad English - I'm Polish :)

View this message in context:
Sent from the Apache XML - Security - Dev mailing list archive at

View raw message