Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash - KeyStoreCrypto.ensureKey - java.security.InvalidKeyException #6768

Closed
ouchadam opened this issue Aug 8, 2022 · 0 comments · Fixed by #6784
Closed

Crash - KeyStoreCrypto.ensureKey - java.security.InvalidKeyException #6768

ouchadam opened this issue Aug 8, 2022 · 0 comments · Fixed by #6784
Assignees
Labels
A-Pin code O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems Z-Crash

Comments

@ouchadam
Copy link
Contributor

ouchadam commented Aug 8, 2022

Exception java.security.InvalidKeyException
Exception java.security.InvalidKeyException: Keystore operation failed
  at android.security.keystore2.KeyStoreCryptoOperationUtils.getInvalidKeyException (KeyStoreCryptoOperationUtils.java:130)
  at android.security.keystore2.KeyStoreCryptoOperationUtils.getExceptionForCipherInit (KeyStoreCryptoOperationUtils.java:154)
  at android.security.keystore2.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized (AndroidKeyStoreCipherSpiBase.java:339)
  at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineInit (AndroidKeyStoreCipherSpiBase.java:171)
  at javax.crypto.Cipher.tryTransformWithProvider (Cipher.java:2985)
  at javax.crypto.Cipher.tryCombinations (Cipher.java:2892)
  at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider (Cipher.java:2797)
  at javax.crypto.Cipher.chooseProvider (Cipher.java:774)
  at javax.crypto.Cipher.init (Cipher.java:1144)
  at javax.crypto.Cipher.init (Cipher.java:1085)
  at org.matrix.android.sdk.api.securestorage.SecretStoringUtils.getEncryptCipher (SecretStoringUtils.kt:6)
  at im.vector.app.features.pin.lockscreen.crypto.KeyStoreCrypto.ensureKey (KeyStoreCrypto.kt:2)
  at im.vector.app.features.pin.lockscreen.crypto.KeyStoreCrypto.hasValidKey (KeyStoreCrypto.kt:3)
  at im.vector.app.features.pin.lockscreen.crypto.LockScreenKeyRepository.isSystemKeyValid (LockScreenKeyRepository.kt:1)
  at im.vector.app.features.pin.lockscreen.biometrics.BiometricHelper.isSystemKeyValid (BiometricHelper.kt:1)
  at im.vector.app.features.pin.lockscreen.biometrics.BiometricHelper.isSystemAuthEnabledAndValid (BiometricHelper.kt:1)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel.updateStateWithBiometricInfo (LockScreenViewModel.kt:4)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel.updateConfiguration (LockScreenViewModel.kt:2)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel.access$updateConfiguration (LockScreenViewModel.kt:1)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel$2.invokeSuspend (LockScreenViewModel.kt:1)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel$2.invoke
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel$2.invoke
  at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:6)
  at kotlinx.coroutines.flow.StateFlowImpl.collect (StateFlow.kt:12)
  at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect (SafeCollector.common.kt:1)
  at kotlinx.coroutines.flow.FlowKt.collect
  at kotlinx.coroutines.flow.FlowKt__CollectKt$launchIn$1.invokeSuspend (Collect.kt:5)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:3)
  at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith (DispatchedContinuation.kt:24)
  at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable (Cancellable.kt:3)
  at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default (Cancellable.kt:1)
  at kotlinx.coroutines.CoroutineStart.invoke (CoroutineStart.kt:28)
  at kotlinx.coroutines.BuildersKt.launch
  at kotlinx.coroutines.BuildersKt.launch$default
  at kotlinx.coroutines.flow.FlowKt.launchIn
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel.<init> (LockScreenViewModel.kt:12)
  at im.vector.app.DaggerVectorApplication_HiltComponents_SingletonC$MavericksViewModelCImpl$SwitchingProvider$1.create (DaggerVectorApplication_HiltComponents_SingletonC.java:14)
  at im.vector.app.core.di.HiltMavericksViewModelFactory.create (HiltMavericksViewModelFactory.kt:6)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel$Companion.create
  at im.vector.app.features.pin.lockscreen.ui.LockScreenViewModel$Companion.create (LockScreenViewModel.kt:1)
  at java.lang.reflect.Method.invoke
  at com.airbnb.mvrx.MavericksFactory.create (MavericksFactory.kt:12)
  at androidx.lifecycle.ViewModelProvider$Factory$-CC.$default$create (ViewModelProvider.kt:2)
  at com.airbnb.mvrx.MavericksViewModelProvider.get$default (MavericksViewModelProvider.kt:39)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenFragment$special$$inlined$fragmentViewModel$default$1.invoke (MavericksExtensions.kt:10)
  at im.vector.app.features.pin.lockscreen.ui.LockScreenFragment$special$$inlined$fragmentViewModel$default$1.invoke (MavericksExtensions.kt:1)
  at com.airbnb.mvrx.DefaultViewModelDelegateFactory$createLazyViewModel$1.invoke (ViewModelDelegateProvider.kt:2)
  at com.airbnb.mvrx.DefaultViewModelDelegateFactory$createLazyViewModel$1.invoke (ViewModelDelegateProvider.kt:1)
  at com.airbnb.mvrx.lifecycleAwareLazy.getValue (lifecycleAwareLazy.kt:5)
  at com.airbnb.mvrx.lifecycleAwareLazy$initializeWhenCreated$1.onCreate (lifecycleAwareLazy.kt:1)
  at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged (FullLifecycleObserverAdapter.java:8)
  at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent (LifecycleRegistry.java:3)
  at androidx.lifecycle.LifecycleRegistry.sync (LifecycleRegistry.java:45)
  at androidx.lifecycle.LifecycleRegistry.moveToState (LifecycleRegistry.java:7)
  at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent (LifecycleRegistry.java:2)
  at androidx.fragment.app.Fragment.performCreate (Fragment.java:9)
  at androidx.fragment.app.FragmentStateManager.create (FragmentStateManager.java:5)
  at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:28)
  at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:122)
  at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:9)
  at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:14)
  at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:10)
  at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:12)
  at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:1)
  at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1467)
  at android.app.Activity.performStart (Activity.java:8082)
  at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3732)
  at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221)
  at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2253)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7870)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
Caused by android.security.KeyStoreException: Device locked
  at android.security.KeyStore2.getKeyStoreException (KeyStore2.java:356)
  at android.security.KeyStoreSecurityLevel.createOperation (KeyStoreSecurityLevel.java:120)
  at android.security.keystore2.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized (AndroidKeyStoreCipherSpiBase.java:334)
Occurrences (30 days) Total Occurrences Impacted users (lifetime)
34 34 10

https://play.google.com/console/u/0/developers/{redacted}//app/{redacted}/vitals/crashes/3eeeb4f81a3d0463339b15915efd8df7/details?installedFrom=PLAY_STORE&days=30&clustering=NEW&versionCode=40104312%2C40104311

@ouchadam ouchadam added T-Defect Something isn't working: bugs, crashes, hangs and other reported problems Z-Crash A-Pin code S-Major Severely degrades major functionality or product features, with no satisfactory workaround O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Aug 8, 2022
@jmartinesp jmartinesp self-assigned this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Pin code O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems Z-Crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants