sjhoeksma / cordova-plugin-keychain-touch-id

Touch ID plugin with saving password in keychain for IOS and android
87 stars 160 forks source link

Handle KeyStoreException in Android 8.0 #31

Open damirarh opened 6 years ago

damirarh commented 6 years ago

This exception is thrown in "verify" on Android 8.0 if new fingerprints were enrolled after "save" has been called. On Android 8.1 KeyPermanentlyInvalidatedException is thrown in the same scenario (but already in "has"), therefore I'm handling it the same - i.e. deleting the key so that it will be recreated on next call.

When the application receives this error (KeyPermanentlyInvalidatedException), it should reinitialize the fingerprint usage - the user will have to reenter the password and agree to store it using the fingerprint.

SleimanB commented 6 years ago

Hello @damirarh, I don't know why your code didn't work for me, when i use .save() method error exception "Failed to encrypt the data with the generated key: IllegalBlockSizeException: null" same issue. any help ?

damirarh commented 6 years ago

@SleimanB Did you check what was the cause in the thrown exception using the code I added to extract it? Is it the same exception/message as I am checking for in my code, i.e. Key user not authenticated?