AKushWarrior / steel_crypt

A collection of high-level API's exposing PointyCastle to perform hashing and encrypting in popular/secure algorithms.
https://pub.dev/packages/steel_crypt
Mozilla Public License 2.0
40 stars 10 forks source link

Wrong password for decryption raises FormatException (Clarification) #51

Closed TheSeriousProgrammer closed 3 years ago

TheSeriousProgrammer commented 3 years ago

Decryption with corrrect password works flawlessly but wrong password for decryption in AES raises FormatException , is this an expected behaviour?

AKushWarrior commented 3 years ago

Yeah. If you put in the wrong key, the decryption behavior is actually unspecified. It could either return gibberish (unlikely) or throw an error (more likely).

If this is something that happens regularly, I recommend you just wrap decryption in a try-catch that will display a "wrong password" message.

TheSeriousProgrammer commented 3 years ago

Yes that's what I did , thanks for the awesome library!!