Ok, that's all. I finally solved that problem so a few words below...

Generally there are two ways to fix this issue:

1) Just use xmlsec-1.3.0.jar instead of xmlsec-1.4.0.jar. It seems to me
that everything works fine with v.1.3.0 and no further changes are required.

2) If someone has to use xmlsec-1.4.0.jar, you have to download sources
(here: http://xml.apache.org/security/dist/java-library/), and open
CanonicalizerBase.java and UtfHelpper.java in
org.apache.xml.security.c14n.implementations package

You have to change lines:

=> CanonicalizerBase.java <=
^^^^^^^^^^^^^^^^^^

line 696: if( (c & 0x80) ==0) {    into    if(c < 0x80) {
line 731: if( (c & 0x80) ==0) {    into    if(c < 0x80) {
line 783: if( (c & 0x80) ==0) {    into    if(c < 0x80) {

=> UtfHelpper.java <=
^^^^^^^^^^^^^^

line 21: if ( (c & 0x80) ==0) {    into    if(c < 0x80) {
line 56: if ((c & 0x80) == 0) {    into    if(c < 0x80) {
line 96:  if ((c & 0x80) == 0) {   into    if(c < 0x80) {

Be aware of some extra spaces between "(" so don't use Find function in your
editor, and change every line manually.

After making changes in those two files you compile them by:

javac  CanonicalizerBase.java UtfHelpper.java

Now you should get xmlsec-1.4.0.jar end extract it using following command
from your command line:

jar -xvf xmlsec-1.4.0.jar

You should recieve three folders: org, jawax and META-INF. 
Get two compiled files (CanonicalizerBase.class UtfHelpper.class) and put
them in org/apache/xml/security/c14n/implementations.

Finally, let's build fixed xmlsec-1.4.0.jar library by putting in a cmd:

jar -cvf xmlsec-1.4.0-utf_bug_fixed.jar META-INF\MANIFEST.MF *.class org/
javax/

That's all folks. Everything you have to do is to remove xmlsec-1.4.0.jar
and replace it with xmlsec-1.4.0-utf_bug_fixed.jar (Remember about new
filename of your .jar )

Thanks guys for your help!

Matthew
-- 
View this message in context: 
http://www.nabble.com/Apache-XML-Security-Encoding-problem-in-encrypting-decrypting-XML-tf3141650.html#a8804681
Sent from the Apache XML - Security - Dev mailing list archive at Nabble.com.

Reply via email to