I have an application which encrypts a file with AES in CBC mode,
using a password entered by user to generate a key. I'm using
FileSource with StreamTransformationFilter to do the job.
The problem is that if the user enters wrong password and decrypts the
file, FileSource bombs out (after the whole file is decrypted) with
exception: "StreamTransformationFilter: invalid PKCS #7 block padding
found".

What's the correct method to detect that a file to decrypt was
encrypted with a different key? Is it safe to catch that exception for
this purpose? I need to notify the user that the password entered is
wrong.
Ideally, this would have to be done without first having to decrypt
the entire file, which may take a long time when the file is large.

This question must already have been asked many times but i can't find
the answer...

-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to