Note: this issue was originally reported on at http://forums.asp.net/t/1209796.aspx and has subsequently been confirmed as an issue on VS 2008 by XiaoYong Dai, Microsoft Online Community Support. (see forum thread for details)
After successfully encrypting certain values using the CrypoStream object, subsequent decryption generates an error "Length of the data to decrypt is invalid". This problem is intermitent and only occurs when encrypting / decrypting specific values.
This issue has been confirmed for the "Rijndael" algorithm, but may also be an problem in "DES" as well.
The bug may be related to the encryption key that is used. When unusual characters such as "/", "%", "$" are present in the key, the error seems to occur more often. It has not been possible to reproduce the error when 'regular' characters (a-z, A-Z, 0-9) are used.
This issue was originally uncovered on VS2005.