You are deliberately adding garbage to the end of the stream and then wondering why the stream chokes on the garbage.
You are deliberately adding garbage to the end of the stream and then wondering why the stream chokes on the garbage. In cryptography everything has to be checked very carefully to ensure that an attacker is not trying something sneaky. If you specify PKCS7 padding then the stream is right to check for PKCS7 padding at the end and right to throw an exception if it does not find the correct padding at the end of the stream.
The stream has no way of knowing that the actual cyphertext ends in the middle of the stream, rather than at the end. How would you expect it to know? In crypto the rule is to flag any and all anomalies, and faulty padding at the (apparent) end of the stream is something the documentation will tell you causes an exception.
It's choking on garbage that I never asked it to read. Is there a way to tell it that the remainder of the underlying stream is not ciphertext and should be ignored?(I actually want to have some unencrypted data there, not garbage.) – Wyzard Sep 14 at 15:46 @Wyzard: All it knows is that you didn't read everything you put into it. I suggest that you set up an ordinary stream, holding both the cyphertext and your unencrypted data.
Read in the cyphertext and pipe it through a CryptoStream. Read the non-encrypted data direct from the ordinary stream. – rossum Sep 14 at 16:52.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.