My decryption code is, for some strange reason, cutting off the last few bits:
Why is this happening? Have I forgotten some code, or am I making some naïve mistake?
private static int chunkSize = 1048576;
public void Decrypt(string Input, string passPhrase, string sender)
{
for (long i = 0; i < fsInput.Length; i += chunkSize)
{
byte[] chunkData = new byte[chunkSize];
int bytesRead = 0;
while ((bytesRead = fsInput.Read(chunkData, 0, chunkSize)) > 0)
{
cryptoStream.Write(chunkData, 0, bytesRead);
}
}
}
I was missing cryptoStream.FlushFinalBlock();
from the decrypt method