cryptomator / android

Cryptomator for Android
https://cryptomator.org
GNU General Public License v3.0
762 stars 126 forks source link

Cryptomator crashes on re-setting up biometric authentication #427

Closed ashjas closed 1 year ago

ashjas commented 2 years ago

Please agree to the following

Summary

Cryptomator crashes on re-setting up biometric authentication

System Setup

- Android: 12.1
- Cryptomator: 1.7.2
- any of the cryptomator vaults show this behaviour(local/pcloud)

Cloud Type

Local storage

Steps to Reproduce

  1. Open cryptomator settings
  2. open biometric authentication activity
  3. try to enable biometric authentication for any of the supported vaults

Expected Behavior

biometric authentication is setup

Actual Behavior

biometric authentication activity crashes

Reproducibility

Always

Relevant Log Output

04-05 18:14:42.774   623  9645 E keystore2: Failed to decrypt blob; ciphertext or tag is likely corrupted
04-05 18:14:42.774   623  9645 E keystore2: keystore2::error: In create_operation. Failed to handle super encryption.
04-05 18:14:42.774   623  9645 E keystore2:
04-05 18:14:42.774   623  9645 E keystore2: Caused by:
04-05 18:14:42.774   623  9645 E keystore2:     0: In unwrap_key: unwrap_key_with_key failed
04-05 18:14:42.774   623  9645 E keystore2:     1: In unwrap_key_with_key: Failed to decrypt the key blob.
04-05 18:14:42.774   623  9645 E keystore2:     2: In aes_gcm_decrypt: decryption failed
04-05 18:14:42.774   623  9645 E keystore2:     3: Failed to decrypt.
04-05 18:14:42.775 13070 13070 D AndroidRuntime: Shutting down VM
04-05 18:14:42.775 13070 13070 E AndroidRuntime: FATAL EXCEPTION: main
04-05 18:14:42.775 13070 13070 E AndroidRuntime: Process: org.cryptomator, PID: 13070
04-05 18:14:42.775 13070 13070 E AndroidRuntime: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:560)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
04-05 18:14:42.775 13070 13070 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:550)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        ... 1 more
04-05 18:14:42.775 13070 13070 E AndroidRuntime: Caused by: java.security.InvalidKeyException: Keystore operation failed
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.keystore2.KeyStoreCryptoOperationUtils.getInvalidKeyException(KeyStoreCryptoOperationUtils.java:130)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.keystore2.KeyStoreCryptoOperationUtils.getExceptionForCipherInit(KeyStoreCryptoOperationUtils.java:154)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.keystore2.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:339)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineInit(AndroidKeyStoreCipherSpiBase.java:171)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at javax.crypto.Cipher.tryTransformWithProvider(Cipher.java:2984)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at javax.crypto.Cipher.tryCombinations(Cipher.java:2891)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider(Cipher.java:2796)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at javax.crypto.Cipher.chooseProvider(Cipher.java:773)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at javax.crypto.Cipher.init(Cipher.java:1143)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at javax.crypto.Cipher.init(Cipher.java:1084)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.util.crypto.CipherImpl.getEncryptCipher(CipherImpl.java:72)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.util.crypto.BiometricAuthCryptor.getEncryptCipher(BiometricAuthCryptor.java:43)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.presentation.util.BiometricAuthentication.startListening(BiometricAuthentication.kt:113)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.presentation.ui.activity.UnlockVaultActivity.getEncryptedPasswordWithBiometricAuthentication(UnlockVaultActivity.kt:56)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.presentation.presenter.UnlockVaultPresenter.setup(UnlockVaultPresenter.kt:76)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.presentation.ui.fragment.UnlockVaultFragment.setupView(UnlockVaultFragment.kt:15)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.presentation.ui.fragment.BaseFragment.onStart(BaseFragment.kt:58)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.Fragment.performStart(Fragment.java:3021)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:589)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:300)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentManager.dispatchStart(FragmentManager.java:3079)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentController.dispatchStart(FragmentController.java:262)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:510)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:246)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at org.cryptomator.presentation.ui.activity.BaseActivity.onStart(BaseActivity.kt:96)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1473)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.Activity.performStart(Activity.java:8079)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3732)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7870)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        ... 3 more
04-05 18:14:42.775 13070 13070 E AndroidRuntime: Caused by: android.security.KeyStoreException: System error
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:334)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.KeyStoreSecurityLevel.createOperation(KeyStoreSecurityLevel.java:120)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        at android.security.keystore2.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:334)
04-05 18:14:42.775 13070 13070 E AndroidRuntime:        ... 40 more

Anything else?

I reported another bug #400(which is fixed, thanks for the support) and this bug's scenarion is similar to it. In a couple of months, i upgrade my ROM, for that i make TWRP backups, after disabling pin lock thats what i did here too. But the difference is that the OS upgrade was from Android 11 to Android 12.1.

After the update, when i opened cryptomator vault the biometric unlocking didnt work, thats valid behaviour as fingerprint data changed between resetting and setting the PIN on the upgraded OS. So i reset the biometric authentication in cryptomator settings so as to re-enable it back. But always face this issue while re-enabling. Note that the unlocking of vault with manual password entry works just fine.

Thanks.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.