[Mono-devel-list] reading stream bug..
spouliot at videotron.ca
Sat Dec 20 15:07:51 EST 2003
A quick patch to your problem would be to change the line
while((len = CryptStream.Read(Buffer,0,1023)) != 0)
while((len = CryptStream.Read(Buffer,0,1024)) != 0)
because (a) your buffer is 1024 bytes and (b) more important it's a multiple
of the block size.
This will work with both MS.NET and Mono (Linux and Windows).
The bug is probably due to the fact that CryptoStream don't return the good
value - which mix up the calculations.
>> > in windows using framework 1.4 it works fine..
framework 1.4 ? are you sending this from the future ? ;-)
If you find anything else please report it into bugzilla
so the issue is not lost (e.g. during xmas vacations). It's also easier (for
the reporter) to be notified when the issue is fixed.
BTW the image is beautiful but a little big to send to a mailing list.
Security Architect, Motus Technologies, http://www.motus.com
work: spouliot at motus.com
home: spouliot at videotron.ca
From: mono-devel-list-admin at lists.ximian.com
[mailto:mono-devel-list-admin at lists.ximian.com]On Behalf Of Subba Rao
Sent: 19 décembre 2003 08:03
To: mono-devel-list at lists.ximian.com
Subject: [Mono-devel-list] reading stream bug..
> > this is a problem i encountered
> > my system spec is as follows
> > redhat 7.3 mono 0.29 -->installed from source
> > i created a program that can encrypt or decrypt a file
> > the file must be in the same directory as the program.
> > the problem is when i decrypt i get the following error
> > System.Byte FinalDecrypt(System.Byte, Int32, Int32)
> > mscorlib
> > Array index is out of range
problem is that, when reading from the crypt stream to the buffer it reads
> as 1023-1008 while in windows its consistatnt 1023
this is in relative to the IV, it gets padded..
can you please tell me how to solve this problem by reading correctly from
> > in windows using framework 1.4 it works fine..
> > i attach the source code for my program..
> > btw, just comment/or uncomment accordingly in the main for encrypt or
> > decrypt
> > make sure the file is in the same directory..
> > hope u can give me some pointers..
> > appreciate ur help
> > regards,
> > Subba Rao Thirumoorthy
> > Network Research Group
> > University of Malaysia
More information about the Mono-devel-list