sharpaescrypt icon indicating copy to clipboard operation
sharpaescrypt copied to clipboard

SharpAESCrypt.CanRead becomes false after reading to end

Open abcjjy opened this issue 4 years ago • 0 comments

I'm trying to make it work with GZipStream, which requires CanRead be true while reading.

I looked through the code. m_cryptDataStream is closed in Read() when reading to the end. And then, m_cryptDataStream.CanRead becomes false and SharpAESCrypt.CanRead returns false. If Crypto.Closed() is not called, CanRead will stay true.

As far as I know, Streams are usually disposed in Dispose(). Why do you close it in Read()? Is there any other consideration? I tried to commented out the Close() line. It seems work fine as well. But I'm not sure if it is safe or not.

https://github.com/kenkendk/sharpaescrypt/blob/3ec03435509ff745102d31b396c3722a4e84a69e/Source/SharpAESCrypt.cs#L1795

abcjjy avatar Jan 29 '21 01:01 abcjjy