FlowCrypt / flowcrypt-android

FlowCrypt Android App
https://flowcrypt.com
Other
91 stars 11 forks source link

Unsupported digest > Keystore operation failed #401

Open DenBond7 opened 5 years ago

DenBond7 commented 5 years ago
[SUMMARY]
android.security.KeyStoreException: Unsupported digest
java.security.InvalidKeyException: Keystore operation failed
com.flowcrypt.email.util.exception.ManualHandledException: Handled manually:

[STACK_TRACE]
com.flowcrypt.email.util.exception.ManualHandledException: Handled manually:
        at com.flowcrypt.email.util.exception.ExceptionUtil.handleError(ExceptionUtil.java:117)
        at com.flowcrypt.email.security.SecurityStorageConnector.init(SecurityStorageConnector.java:106)
        at com.flowcrypt.email.security.SecurityStorageConnector.<init>(SecurityStorageConnector.java:36)
        at com.flowcrypt.email.js.JsForUiManager.<init>(JsForUiManager.java:33)
        at com.flowcrypt.email.js.JsForUiManager.getInstance(JsForUiManager.java:53)
        at com.flowcrypt.email.js.JsForUiManager.init(JsForUiManager.java:46)
        at com.flowcrypt.email.FlowCryptApplication.onCreate(FlowCryptApplication.java:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5932)
        at android.app.ActivityThread.access$1100(ActivityThread.java:202)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1658)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6739)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:859)
Caused by: java.security.InvalidKeyException: Keystore operation failed
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:967)
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:992)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getInvalidKeyExceptionForInit(KeyStoreCryptoOperationUtils.java:54)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getExceptionForCipherInit(KeyStoreCryptoOperationUtils.java:89)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:265)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineInit(AndroidKeyStoreCipherSpiBase.java:109)
        at javax.crypto.Cipher.tryTransformWithProvider(Cipher.java:2984)
        at javax.crypto.Cipher.tryCombinations(Cipher.java:2891)
        at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider(Cipher.java:2796)
        at javax.crypto.Cipher.chooseProvider(Cipher.java:773)
        at javax.crypto.Cipher.init(Cipher.java:1143)
        at javax.crypto.Cipher.init(Cipher.java:1084)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.decryptWithRSA(KeyStoreCryptoManager.java:253)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.initAesSecretKeySpec(KeyStoreCryptoManager.java:274)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.<init>(KeyStoreCryptoManager.java:104)
        at com.flowcrypt.email.security.SecurityUtils.getPrivateKeysInfo(SecurityUtils.java:53)
        at com.flowcrypt.email.security.SecurityStorageConnector.init(SecurityStorageConnector.java:99)
        ... 15 more
Caused by: android.security.KeyStoreException: Unsupported digest
        at android.security.KeyStore.getKeyStoreException(KeyStore.java:905)
        ... 31 more
java.security.InvalidKeyException: Keystore operation failed
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:967)
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:992)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getInvalidKeyExceptionForInit(KeyStoreCryptoOperationUtils.java:54)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getExceptionForCipherInit(KeyStoreCryptoOperationUtils.java:89)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:265)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineInit(AndroidKeyStoreCipherSpiBase.java:109)
        at javax.crypto.Cipher.tryTransformWithProvider(Cipher.java:2984)
        at javax.crypto.Cipher.tryCombinations(Cipher.java:2891)
        at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider(Cipher.java:2796)
        at javax.crypto.Cipher.chooseProvider(Cipher.java:773)
        at javax.crypto.Cipher.init(Cipher.java:1143)
        at javax.crypto.Cipher.init(Cipher.java:1084)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.decryptWithRSA(KeyStoreCryptoManager.java:253)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.initAesSecretKeySpec(KeyStoreCryptoManager.java:274)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.<init>(KeyStoreCryptoManager.java:104)
        at com.flowcrypt.email.security.SecurityUtils.getPrivateKeysInfo(SecurityUtils.java:53)
        at com.flowcrypt.email.security.SecurityStorageConnector.init(SecurityStorageConnector.java:99)
        at com.flowcrypt.email.security.SecurityStorageConnector.<init>(SecurityStorageConnector.java:36)
        at com.flowcrypt.email.js.JsForUiManager.<init>(JsForUiManager.java:33)
        at com.flowcrypt.email.js.JsForUiManager.getInstance(JsForUiManager.java:53)
        at com.flowcrypt.email.js.JsForUiManager.init(JsForUiManager.java:46)
        at com.flowcrypt.email.FlowCryptApplication.onCreate(FlowCryptApplication.java:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5932)
        at android.app.ActivityThread.access$1100(ActivityThread.java:202)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1658)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6739)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:859)
Caused by: android.security.KeyStoreException: Unsupported digest
        at android.security.KeyStore.getKeyStoreException(KeyStore.java:905)
        ... 31 more
android.security.KeyStoreException: Unsupported digest
        at android.security.KeyStore.getKeyStoreException(KeyStore.java:905)
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:992)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getInvalidKeyExceptionForInit(KeyStoreCryptoOperationUtils.java:54)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getExceptionForCipherInit(KeyStoreCryptoOperationUtils.java:89)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:265)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineInit(AndroidKeyStoreCipherSpiBase.java:109)
        at javax.crypto.Cipher.tryTransformWithProvider(Cipher.java:2984)
        at javax.crypto.Cipher.tryCombinations(Cipher.java:2891)
        at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider(Cipher.java:2796)
        at javax.crypto.Cipher.chooseProvider(Cipher.java:773)
        at javax.crypto.Cipher.init(Cipher.java:1143)
        at javax.crypto.Cipher.init(Cipher.java:1084)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.decryptWithRSA(KeyStoreCryptoManager.java:253)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.initAesSecretKeySpec(KeyStoreCryptoManager.java:274)
        at com.flowcrypt.email.security.KeyStoreCryptoManager.<init>(KeyStoreCryptoManager.java:104)
        at com.flowcrypt.email.security.SecurityUtils.getPrivateKeysInfo(SecurityUtils.java:53)
        at com.flowcrypt.email.security.SecurityStorageConnector.init(SecurityStorageConnector.java:99)
        at com.flowcrypt.email.security.SecurityStorageConnector.<init>(SecurityStorageConnector.java:36)
        at com.flowcrypt.email.js.JsForUiManager.<init>(JsForUiManager.java:33)
        at com.flowcrypt.email.js.JsForUiManager.getInstance(JsForUiManager.java:53)
        at com.flowcrypt.email.js.JsForUiManager.init(JsForUiManager.java:46)
        at com.flowcrypt.email.FlowCryptApplication.onCreate(FlowCryptApplication.java:76)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5932)
        at android.app.ActivityThread.access$1100(ActivityThread.java:202)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1658)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6739)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:859)

ref https://mail.google.com/mail/u/0/#label/Work%2FFlowCrypt%2FCrashes/FMfcgxwBTjtFqcQtFlTJNPfRXkCzfrXw

DenBond7 commented 5 years ago

It's a platform bug.

https://www.xda-developers.com/xiaomi-redmi-note-3-android-pie-pixel-experience/

Know Issues:

tomholub commented 5 years ago

@DenBond7 does it keep failing / never works on such device, or is this an intermittent bug?

DenBond7 commented 5 years ago

Xiaomi Redmi Note 3 doesn't have an official support of Android Pie(9) (It's an old device). So it's a custom ROM (like LineagOs, CyanogenMod and etc) which can have a lot of bugs. We can't support it.

tomholub commented 5 years ago

I was asking because if it fails consistently, we could use a similar screen to the corrupted storage, except no fix button. That way users would know what's going on.

DenBond7 commented 5 years ago

does it keep failing / never works on such device, or is this an intermittent bug?

It never works on such devices on Android Pie (Custom ROM).

we could use a similar screen to the corrupted storage, except no fix button.

Yes, we can do that. Then I propose to add this issue to "even later". If it will be happening quite often we will add an explanation for that devices.

It's a firts example of such bug.

tomholub commented 5 years ago

ok done

tomholub commented 5 years ago

I've made a milestone called "rare bugs" for this

DenBond7 commented 5 years ago

The same situation with Xiaomi Redmi 5 Plus (Android Pie (Custom ROM))

ref https://mail.google.com/mail/u/0/#search/label%3Awork-flowcrypt-crashes+label%3Aunread/FMfcgxwBVMdxNPtxPVJxDSqNZsmmpgjw

DenBond7 commented 5 years ago

The same situation with Xiaomi Redmi Note 4 (Android Pie (Custom ROM))

ref https://mail.google.com/mail/u/0/#label/Work%2FFlowCrypt%2FCrashes/FMfcgxwBVWLmvzKhlpxklCPkqmJMwbrR

DenBond7 commented 5 years ago

Moto Z Play (Android Pie (Custom ROM)) ref https://mail.google.com/mail/u/0/#label/Work%2FFlowCrypt%2FCrashes/FMfcgxwBVWJSKfMJMwKLkLwgsMpMhmJF

DenBond7 commented 5 years ago

we could use a similar screen to the corrupted storage, except no fix button.

Need to show it and exclude such errors from the ACRA reports.

DenBond7 commented 5 years ago

Moto G5 Plus https://mail.google.com/mail/u/0/#search/label%3Awork-flowcrypt-crashes+label%3Aunread+Moto/FMfcgxwBVqPzwMgsmTsQnmLhPjRDDjGV

DenBond7 commented 5 years ago

LEX722 - Lineage Os ref https://mail.google.com/mail/u/0/#search/label%3Awork-flowcrypt-crashes+label%3Aunread+Unsupported+digest/FMfcgxwBVznkbjqqghrRNqVgRzcdVmhQ

DenBond7 commented 5 years ago

I've already added some changes. Currently, I'm moving it to later.