custom filter error behavior

Hello- I have implemented a custom AES encryption filter. When it fails-for example, because of a bad Key or IV-the code doesn't actually know that it fails to return a 0. It will simply return bytes that are scrambled/nonsensical.

As a result, somewhere in the HD5.Read() function it just blows up. I was expecting a more friendly error code out of the Read function; should I, or is that normal behavior?

The only workaround I can think of is to checksum the unencrypted data and writing that so I can re-check it on the decryption, but I was hoping to skip that little bit of overhead.

Thoughts/experience welcome.

Warm Regards,
Jim