sharpaescrypt
sharpaescrypt copied to clipboard
SharpAESCrypt.CanRead becomes false after reading to end
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