BadPaddingException with Encryption Library

pavan

New Member
Licensed User
Longtime User
I am trying to learn about encrypting fields in databases and studied this example
http://www.b4x.com/forum/attachments/basic4android-updates-questions/8535d1314381646-encrypt-database-encrypteddatabaseexample.zip


I then tried to show a dialog to request the password

It works fine if i give the actual password that was used for encryption

But if any other password is given, i am facing this error
"java - BadPaddingException: pad block corrupted"

Any help?

I am presuming that i may get a different output with different password and only the right password word would get the right output..am I right?

Thanks a lot
 

agraham

Expert
Licensed User
Longtime User
I am presuming that i may get a different output with different password and only the right password word would get the right output..am I right?t
Probably! A bad password will give garbage output so an algorithm that expects certain padding values will choke on the garbage and complain. Just treat it as a wrong password error.
 
Upvote 0
Top