Key store exception

We got this error. Could you help us?

V/AutofillManager( 4336): requestHideFillUi(null): anchor = null
W/System.err( 4336): javax.crypto.AEADBadTagException
W/System.err( 4336): at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:611)
W/System.err( 4336): at javax.crypto.Cipher.doFinal(Cipher.java:2114)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decryptInternal(AndroidKeystoreAesGcm.java:118)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:101)
W/System.err( 4336): at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:919)
W/System.err( 4336): at com.google.crypto.tink.KeysetHandle.readWithAssociatedData(KeysetHandle.java:804)
W/System.err( 4336): at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:785)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readMasterkeyDecryptAndParseKeyset(AndroidKeysetManager.java:381)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:297)
W/System.err( 4336): at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:169)
W/System.err( 4336): at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:130)
W/System.err( 4336): at com.web3auth.session_manager_android.keystore.KeyStoreManager.initializePreferences(KeyStoreManager.kt:48)
W/System.err( 4336): at com.web3auth.session_manager_android.SessionManager.(SessionManager.kt:44)
W/System.err( 4336): at com.web3auth.core.Web3Auth.(Web3Auth.kt:23)
W/System.err( 4336): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin.runMethodCall(Web3AuthFlutterPlugin.kt:93)
W/System.err( 4336): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin.access$runMethodCall(Web3AuthFlutterPlugin.kt:25)
W/System.err( 4336): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin$onMethodCall$1.invokeSuspend(Web3AuthFlutterPlugin.kt:71)
W/System.err( 4336): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err( 4336): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
W/System.err( 4336): Caused by: android.security.KeyStoreException: Signature/MAC verification failed
W/System.err( 4336): at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:356)
W/System.err( 4336): at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
W/System.err( 4336): at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:127)
W/System.err( 4336): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
W/System.err( 4336): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
W/System.err( 4336): at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
W/System.err( 4336): at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:603)
W/System.err( 4336): … 22 more
D/com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin( 4336): #init
W/System.err( 4336): javax.crypto.AEADBadTagException
W/System.err( 4336): at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:611)
W/System.err( 4336): at javax.crypto.Cipher.doFinal(Cipher.java:2114)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decryptInternal(AndroidKeystoreAesGcm.java:118)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:101)
W/System.err( 4336): at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:919)
W/System.err( 4336): at com.google.crypto.tink.KeysetHandle.readWithAssociatedData(KeysetHandle.java:804)
W/System.err( 4336): at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:785)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readMasterkeyDecryptAndParseKeyset(AndroidKeysetManager.java:381)
W/System.err( 4336): at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:297)
W/System.err( 4336): at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:169)
W/System.err( 4336): at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:130)
W/System.err( 4336): at com.web3auth.core.keystore.KeyStoreManagerUtils.initializePreferences(KeyStoreManagerUtils.kt:28)
W/System.err( 4336): at com.web3auth.core.Web3Auth.initialize(Web3Auth.kt:118)
W/System.err( 4336): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin.runMethodCall(Web3AuthFlutterPlugin.kt:134)
W/System.err( 4336): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin.access$runMethodCall(Web3AuthFlutterPlugin.kt:25)
W/System.err( 4336): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin$onMethodCall$1.invokeSuspend(Web3AuthFlutterPlugin.kt:71)
W/System.err( 4336): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err( 4336): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
W/System.err( 4336): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
W/System.err( 4336): Caused by: android.security.KeyStoreException: Signature/MAC verification failed
W/System.err( 4336): at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:356)
W/System.err( 4336): at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
W/System.err( 4336): at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:127)
W/System.err( 4336): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
W/System.err( 4336): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
W/System.err( 4336): at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
W/System.err( 4336): at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:603)
W/System.err( 4336): … 21 more

@gabriel.albarosa Thanks for your recent post.

Could you kindly share some code snippets along with the version of the packages you’re currently using?

Yes sure, we are using ^3.1.4 version. You released a patch for us few days ago.
we could resolved just clearing the cache on the android device. (RealMe X3 superzoom) This issues is replicable only with some devices.

For any info, please let me know

Can you share few more details regarding the issue like release config for Android, and what device it’s reproducible along with their OS version. Does this issue happens as soon as you open the app?

Yes sure, android 12. most of the time on launch app.

I believe this is the same issue which we fixed in 4.0.0 release. Lateinit property sharedPreferences has not been initialized · Issue #70 · Web3Auth/web3auth-flutter-sdk · GitHub

I think you are not using 4.0.0 release because of not able to re login after user cancellation or closing browser, right?

We are using a patch. According to your fix and Logout platform exception - #11 by Ayush

We cannot skip to a newer version because of the error we re getting in the linked report.

Yes, I can understand, we have fixed the user cancellation handling, once the PR is approved and new version is released you can upgrade the SDK and it will fix both issues. I’ll keep you posted.

Perfect, thank you…
Regards

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.