android / android/security-samples

BiometricLoginKotlin: crash at Emulator API33

Offen
#86 2 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
1k
Forks
450
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I've tried to run the app on Emulator API 33, it crash as below (but it is working on API 32 and below):

2022-09-01 17:46:41.132 21363-21363/com.example.biometricloginsample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.biometricloginsample, PID: 21363
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:558)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 
Caused by: javax.crypto.IllegalBlockSizeException
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:613)
at javax.crypto.Cipher.doFinal(Cipher.java:2056)
at com.example.biometricloginsample.CryptographyManagerImpl.encryptData(CryptographyManager.kt:98)
at com.example.biometricloginsample.EnableBiometricLoginActivity.encryptAndStoreServerToken(EnableBiometricLoginActivity.kt:101)
at com.example.biometricloginsample.EnableBiometricLoginActivity.access$encryptAndStoreServerToken(EnableBiometricLoginActivity.kt:30)
at com.example.biometricloginsample.EnableBiometricLoginActivity$showBiometricPromptForEncryption$biometricPrompt$1.invoke(EnableBiometricLoginActivity.kt:91)
at com.example.biometricloginsample.EnableBiometricLoginActivity$showBiometricPromptForEncryption$biometricPrompt$1.invoke(EnableBiometricLoginActivity.kt:30)
at com.example.biometricloginsample.BiometricPromptUtils$createBiometricPrompt$callback$1.onAuthenticationSucceeded(BiometricPromptUtils.kt:48)
at androidx.biometric.BiometricFragment$2$2.run(BiometricFragment.java:140)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 
Caused by: android.security.KeyStoreException: Key user not authenticated (internal Keystore code: -26 message: In KeystoreOperation::update

Caused by:
0: In update: KeyMint::update failed.
1: Error::Km(ErrorCode(-26))) (public error code: 2 internal Keystore code: -26)
at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:369)
at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
at android.security.KeyStoreOperation.update(KeyStoreOperation.java:115)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.update(KeyStoreCryptoOperationChunkedStreamer.java:222)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:156)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:179)
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:603)
... 16 more

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere den Absturz auf Emulator API 33 und beginne bei CryptographyManager.kt in Zeile 98. Verfolge anschließend den Aufruf von EnableBiometricLoginActivity.kt in Zeile 101 zurück. Vergleiche den biometrischen Verschlüsselungsablauf mit API 32 und älter; abgeschlossen ist die Aufgabe, wenn das Beispiel auf API 33 nicht mehr abstürzt und das funktionierende Verhalten auf älteren APIs erhalten bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, kotlin
Bereich
authentication, mobile-dev, security
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.