Closed blmarket closed 4 years ago
Hello,
Is this with the latest release or from git?
OK, I was able to find the issue. It was actually pretty convoluted and relied on being supplied with a buffer that was just the right size (it had to cause the first read to result in an incomplete block being fed to the crypter but the second read to be small enough to be written directly to the output without using the overflow buffer).
Thank you for reporting it and for the good test case!
I've just pushed out v0.3.1 https://github.com/neosmart/cryptostream/releases/tag/0.3.1 and published the crate.
A version of your test code has been included in the tests, with some brief comments linking back here. @blmarket I want to thank you for taking the time to report the issue and share your test code. It's much appreciated!
Hi,
I think this library have some problem as it silently generates incorrect decryption result to the buffer. Even though I'm moving away from using this library due to the lack of my own time to fix, I created some unit tests to reproduce the issue.
My application to decrypt network stream resulted incorrect output, which was not happened when I buffer everything in memory. Following test case shows decryption result gets incorrect if source
Read
yields smaller chunks.My 2 cents: Read in Cryptostream does not check read size properly after reading from encrypted source.