Skip to content

BiometricLoginKotlin: crash at Emulator API33 #86

Open

Description

@KKChong

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

Activity

  1. hm122 commented on Oct 18, 2022

    @hm122

    Facing the exact same issue, also got this working on API 32, but fails on API 33. This seems to be a major issue, anyone knows a workaround or solution?
    Can anyone confirm if this is a emulator-only issue or also happens on real devices?

  2. KKChong commented on Oct 21, 2022

    @KKChong
    Author

    I'm not sure why google still ignore our issue. This is very huge impact to our existing user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions