"Cryptography.CryptographicException: Bad Data" Exception Moving from .Net 1.1 to 3.5

We just finished moving a few apps from .Net Framework 1.1 to 3.5. One of the problems we ran into was this exception when using some symmetric encryption code. When we decrypted the value from the DB, this was being thrown.

From what I can tell, it looks like in 1.1 passing null data to the decryption worked (or at least silently failed) and likely returned null back (well, a blank string in our case due to type conversion). However, in 3.5 this exception gets thrown.

An easy fix but one of those little things that took a while to track down so hope this helps someone.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s