You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Jack Zhang <jh...@hotmail.com> on 2004/10/03 13:22:55 UTC

Can't decrypt the xml file whihc is about 9K

Hi,

I have a xml file which is about 9K, I can encrypt it success with 3DES. But when use the same key to decrypt the file, it crashed, then I try I decrease the file size to 2k, this time it work normally.

I have stepped into the source, seems it was crashed at t->transcodeFrom in XSECDOMUtils.cpp:

  int toEat = (bytesToEat > 2048 ? 2048 : bytesToEat);

  t->transcodeFrom(&src[totalBytesEaten], 
      toEat, 
      outputBuf, 
      2048, 
      bytesEaten, 
      charSizes);

  outputBuf[bytesEaten] = chNull;
  fullDest.sbXMLChCat(outputBuf);
  totalBytesEaten += bytesEaten;
 }

Where is the problem, thanks for your help.

Regards
Jack

Re: Can't decrypt the xml file whihc is about 9K

Posted by Jack Zhang <jh...@hotmail.com>.
Thanks Berin, it works now.

----- Original Message ----- 
From: "Berin Lautenbach" <be...@wingsofhermes.org>
To: <se...@xml.apache.org>
Sent: Monday, October 04, 2004 6:55 PM
Subject: Re: Can't decrypt the xml file whihc is about 9K


> Jack,
> 
> Try the following patch (I have also checked into CVS so you can get the 
> file directly if you so desire)
> 
> cvs -z3 diff XSECDOMUtils.cpp (in directory 
> C:\prog\SRC\xml-security\c\src\utils)
> Index: XSECDOMUtils.cpp
> ===================================================================
> RCS file: /home/cvs/xml-security/c/src/utils/XSECDOMUtils.cpp,v
> retrieving revision 1.22
> diff -r1.22 XSECDOMUtils.cpp
> 354c354,357
> < int toEat = (bytesToEat > 2048 ? 2048 : bytesToEat);
> ---
>  > int toEat = bytesToEat - totalBytesEaten;
>  >
>  > if (toEat > 2048)
>  > toEat = 2048;
> 
> *****CVS exited normally with code 1*****
> 
> Cheers,
> Berin
> 
> 
> Berin Lautenbach wrote:
> 
> > Jack,
> > 
> > Could you send me a file (and associated key) that has the problem?
> > 
> > (or post into a bug in bugzilla - http://nagoya.apache.org )
> > 
> > Thanks!
> > 
> > Cheers,
> >     Berin
> > 
> > Jack Zhang wrote:
> > 
> >> Hi,
> >>  
> >> I have a xml file which is about 9K, I can encrypt it success with 
> >> 3DES. But when use the same key to decrypt the file, it crashed, then 
> >> I try I decrease the file size to 2k, this time it work normally.
> >>  
> >> I have stepped into the source, seems it was crashed at 
> >> *t->transcodeFrom *in XSECDOMUtils.cpp:
> >>
> >>   int toEat = (bytesToEat > 2048 ? 2048 : bytesToEat);
> >>  
> >>   t->transcodeFrom(&src[totalBytesEaten],
> >>       toEat,
> >>       outputBuf,
> >>       2048,
> >>       bytesEaten,
> >>       charSizes);
> >>  
> >>   outputBuf[bytesEaten] = chNull;
> >>   fullDest.sbXMLChCat(outputBuf);
> >>   totalBytesEaten += bytesEaten;
> >>  }
> >>  
> >> Where is the problem, thanks for your help.
> >>  
> >> Regards
> >> Jack
> > 
> > 
> > 
> 

Re: Can't decrypt the xml file whihc is about 9K

Posted by Berin Lautenbach <be...@wingsofhermes.org>.
Jack,

Try the following patch (I have also checked into CVS so you can get the 
file directly if you so desire)

cvs -z3 diff XSECDOMUtils.cpp (in directory 
C:\prog\SRC\xml-security\c\src\utils)
Index: XSECDOMUtils.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECDOMUtils.cpp,v
retrieving revision 1.22
diff -r1.22 XSECDOMUtils.cpp
354c354,357
< 		int toEat = (bytesToEat > 2048 ? 2048 : bytesToEat);
---
 > 		int toEat = bytesToEat - totalBytesEaten;
 >
 > 		if (toEat > 2048)
 > 			toEat = 2048;

*****CVS exited normally with code 1*****

Cheers,
	Berin


Berin Lautenbach wrote:

> Jack,
> 
> Could you send me a file (and associated key) that has the problem?
> 
> (or post into a bug in bugzilla - http://nagoya.apache.org )
> 
> Thanks!
> 
> Cheers,
>     Berin
> 
> Jack Zhang wrote:
> 
>> Hi,
>>  
>> I have a xml file which is about 9K, I can encrypt it success with 
>> 3DES. But when use the same key to decrypt the file, it crashed, then 
>> I try I decrease the file size to 2k, this time it work normally.
>>  
>> I have stepped into the source, seems it was crashed at 
>> *t->transcodeFrom *in XSECDOMUtils.cpp:
>>
>>   int toEat = (bytesToEat > 2048 ? 2048 : bytesToEat);
>>  
>>   t->transcodeFrom(&src[totalBytesEaten],
>>       toEat,
>>       outputBuf,
>>       2048,
>>       bytesEaten,
>>       charSizes);
>>  
>>   outputBuf[bytesEaten] = chNull;
>>   fullDest.sbXMLChCat(outputBuf);
>>   totalBytesEaten += bytesEaten;
>>  }
>>  
>> Where is the problem, thanks for your help.
>>  
>> Regards
>> Jack
> 
> 
> 

Re: Can't decrypt the xml file whihc is about 9K

Posted by Berin Lautenbach <be...@wingsofhermes.org>.
Jack,

Could you send me a file (and associated key) that has the problem?

(or post into a bug in bugzilla - http://nagoya.apache.org )

Thanks!

Cheers,
	Berin

Jack Zhang wrote:

> Hi,
>  
> I have a xml file which is about 9K, I can encrypt it success with 3DES. 
> But when use the same key to decrypt the file, it crashed, then I try I 
> decrease the file size to 2k, this time it work normally.
>  
> I have stepped into the source, seems it was crashed at 
> *t->transcodeFrom *in XSECDOMUtils.cpp:
> 
>   int toEat = (bytesToEat > 2048 ? 2048 : bytesToEat);
>  
>   t->transcodeFrom(&src[totalBytesEaten],
>       toEat,
>       outputBuf,
>       2048,
>       bytesEaten,
>       charSizes);
>  
>   outputBuf[bytesEaten] = chNull;
>   fullDest.sbXMLChCat(outputBuf);
>   totalBytesEaten += bytesEaten;
>  }
>  
> Where is the problem, thanks for your help.
>  
> Regards
> Jack