authpass / biometric_storage

Flutter plugin to store data behind biometric authentication (ie. fingerprint)
https://pub.dev/packages/biometric_storage
MIT License
171 stars 101 forks source link

IllegalBlockSizeException #69

Open Samin-youki opened 1 year ago

Samin-youki commented 1 year ago

Hey, i'm using this great library for months now, and i wanted to thank the owner for always updating and fixing problems :)

i upgrade to version 4.1.3 and since on, randomly i got this error after authentication:

I/BiometricPrompt(16583): onAuthenticationSucceeded: 2 [log] FINEST: 2022-07-04 14:19:03.009818: Error during plugin operation (details: javax.crypto.IllegalBlockSizeException javax.crypto.IllegalBlockSizeException at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519) at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:531) at javax.crypto.Cipher.doFinal(Cipher.java:2267) at design.codeux.biometric_storage.CryptographyManagerImpl.encryptData(CryptographyManager.kt:120) at design.codeux.biometric_storage.BiometricStorageFile.writeFile(BiometricStorageFile.kt:118) at design.codeux.biometric_storage.BiometricStoragePlugin$onMethodCall$5$1.invoke(BiometricStoragePlugin.kt:266) at design.codeux.biometric_storage.BiometricStoragePlugin$onMethodCall$5$1.invoke(BiometricStoragePlugin.kt:265) at design.codeux.biometric_storage.BiometricStoragePlugin$onMethodCall$withAuth$2.invoke(BiometricStoragePlugin.kt:203) at design.codeux.biometric_storage.BiometricStoragePlugin$onMethodCall$withAuth$2.invoke(BiometricStoragePlugin.kt:202) at design.codeux.biometric_storage.BiometricStoragePlugin$authenticate$prompt$1$onAuthenticationSucceeded$$inlined$worker$1.run(BiometricStoragePlugin.kt:445) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) Caused by: android.security.KeyStoreException: Key user not authenticated at android.security.KeyStore.getKeyStoreException(KeyStore.java:1461) at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:140) at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:169) at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506) ... 14 more )

hpoul commented 1 year ago

when exactly is this happening? Only for existing installations, or also for new installations? What do you mean with randomly 😅

Samin-youki commented 1 year ago

@hpoul thanks for answering, no installation is fine, when its running, some times the auth is not completed(means the figner print is requesting, and i get the success code 2, but auth process face a error) and i see this error on the logs, but sometimes it is working fine.

RafaRuiz commented 1 year ago

I'm facing this with Android 13, with the version 4.1.3

hatch01 commented 10 months ago

I'm facing the issue with android 13 precisely when writing something over 44 char. A 45 char length crash.

Febinjohnson96 commented 7 months ago

I'm facing this issue with the version 5.0.0+4

its working fine when the first run.. i can read or write data.. But once the app is killed and restarts. im getting this exception. Is there any workaround? In my case this is happening on read after the app is killed and restarts

IllegalBlockSizeException