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

[Bug Report] Crash after restoring HomeApp from backup #94

Open
cweiske opened this issue Nov 25, 2024 · 1 comment
Open

[Bug Report] Crash after restoring HomeApp from backup #94

cweiske opened this issue Nov 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cweiske
Copy link
Collaborator

cweiske commented Nov 25, 2024

Description

I broke my phone's partitions and had to reinstall the system. After reinstalling, I used SeedVault to restore the apps and settings.

Since then, HomeApp starts and lists the devices, but crashes as soon as I click on a device.

I don't think the error is recoverable, but HomeApp should detect the problem and handle it by e.g. re-requesting the device passwords.

(Clearing the app data let me re-add the devices, and I could control them again.)

Logs
E KeymasterUtils: rsp_header->status: -30
E keystore2: system/security/keystore2/src/error.rs:200 - system/security/keystore2/src/operation.rs:852: KeystoreOperation::finish
E keystore2: 
E keystore2: Caused by:
E keystore2:     0: system/security/keystore2/src/operation.rs:428: Finish failed.
E keystore2:     1: Error::Km(r#VERIFICATION_FAILED)
W AndroidKeystoreAesGcm: encountered a potentially transient KeyStore error, will wait and retry
W AndroidKeystoreAesGcm: javax.crypto.AEADBadTagException
W AndroidKeystoreAesGcm: 	at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:634)
W AndroidKeystoreAesGcm: 	at javax.crypto.Cipher.doFinal(Cipher.java:2132)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decryptInternal(AndroidKeystoreAesGcm.java:115)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:97)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:206)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:107)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
W AndroidKeystoreAesGcm: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
W AndroidKeystoreAesGcm: 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
W AndroidKeystoreAesGcm: 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.helpers.DeviceSecrets.<init>(DeviceSecrets.kt:19)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.api.ShellyAPI.<init>(ShellyAPI.kt:21)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.helpers.Global.getCorrectAPI(Global.kt:44)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.activities.MainActivity.selectDevice$app_release(MainActivity.kt:396)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.activities.MainActivity$mainHelperInterface$1.onItemClicked(MainActivity.kt:208)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.adapters.MainListAdapter.onBindViewHolder$lambda-1(MainListAdapter.kt:64)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.adapters.MainListAdapter.$r8$lambda$-UgfsLHSJCh9o2eBE0deixMYq3E(Unknown Source:0)
W AndroidKeystoreAesGcm: 	at io.github.domi04151309.home.adapters.MainListAdapter$$ExternalSyntheticLambda0.onClick(Unknown Source:6)
W AndroidKeystoreAesGcm: 	at android.view.View.performClick(View.java:7931)
W AndroidKeystoreAesGcm: 	at android.view.View.performClickInternal(View.java:7908)
W AndroidKeystoreAesGcm: 	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
W AndroidKeystoreAesGcm: 	at android.view.View$PerformClick.run(View.java:30990)
W AndroidKeystoreAesGcm: 	at android.os.Handler.handleCallback(Handler.java:959)
W AndroidKeystoreAesGcm: 	at android.os.Handler.dispatchMessage(Handler.java:100)
W AndroidKeystoreAesGcm: 	at android.os.Looper.loopOnce(Looper.java:232)
W AndroidKeystoreAesGcm: 	at android.os.Looper.loop(Looper.java:317)
W AndroidKeystoreAesGcm: 	at android.app.ActivityThread.main(ActivityThread.java:8592)
W AndroidKeystoreAesGcm: 	at java.lang.reflect.Method.invoke(Native Method)
W AndroidKeystoreAesGcm: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
W AndroidKeystoreAesGcm: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
W AndroidKeystoreAesGcm: Caused by: android.security.KeyStoreException: Signature/MAC verification failed (internal Keystore code: -30 message: system/security/keystore2/src/operation.rs:852: KeystoreOperation::finish
W AndroidKeystoreAesGcm: 
W AndroidKeystoreAesGcm: Caused by:
W AndroidKeystoreAesGcm:     0: system/security/keystore2/src/operation.rs:428: Finish failed.
W AndroidKeystoreAesGcm:     1: Error::Km(r#VERIFICATION_FAILED)) (public error code: 10 internal Keystore code: -30)
W AndroidKeystoreAesGcm: 	at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:416)
W AndroidKeystoreAesGcm: 	at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:79)
W AndroidKeystoreAesGcm: 	at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:132)
W AndroidKeystoreAesGcm: 	at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
W AndroidKeystoreAesGcm: 	at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
W AndroidKeystoreAesGcm: 	at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
W AndroidKeystoreAesGcm: 	at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:626)
W AndroidKeystoreAesGcm: 	... 30 more

E KeymasterUtils: rsp_header->status: -30
E keystore2: system/security/keystore2/src/error.rs:200 - system/security/keystore2/src/operation.rs:852: KeystoreOperation::finish
E keystore2: 
E keystore2: Caused by:
E keystore2:     0: system/security/keystore2/src/operation.rs:428: Finish failed.
E keystore2:     1: Error::Km(r#VERIFICATION_FAILED)
W AndroidKeysetManager: cannot decrypt keyset: 
W AndroidKeysetManager: javax.crypto.AEADBadTagException
W AndroidKeysetManager: 	at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:634)
W AndroidKeysetManager: 	at javax.crypto.Cipher.doFinal(Cipher.java:2132)
W AndroidKeysetManager: 	at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decryptInternal(AndroidKeystoreAesGcm.java:115)
W AndroidKeysetManager: 	at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:101)
W AndroidKeysetManager: 	at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:206)
W AndroidKeysetManager: 	at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:107)
W AndroidKeysetManager: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
W AndroidKeysetManager: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
W AndroidKeysetManager: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
W AndroidKeysetManager: 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
W AndroidKeysetManager: 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
W AndroidKeysetManager: 	at io.github.domi04151309.home.helpers.DeviceSecrets.<init>(DeviceSecrets.kt:19)
W AndroidKeysetManager: 	at io.github.domi04151309.home.api.ShellyAPI.<init>(ShellyAPI.kt:21)
W AndroidKeysetManager: 	at io.github.domi04151309.home.helpers.Global.getCorrectAPI(Global.kt:44)
W AndroidKeysetManager: 	at io.github.domi04151309.home.activities.MainActivity.selectDevice$app_release(MainActivity.kt:396)
W AndroidKeysetManager: 	at io.github.domi04151309.home.activities.MainActivity$mainHelperInterface$1.onItemClicked(MainActivity.kt:208)
W AndroidKeysetManager: 	at io.github.domi04151309.home.adapters.MainListAdapter.onBindViewHolder$lambda-1(MainListAdapter.kt:64)
W AndroidKeysetManager: 	at io.github.domi04151309.home.adapters.MainListAdapter.$r8$lambda$-UgfsLHSJCh9o2eBE0deixMYq3E(Unknown Source:0)
W AndroidKeysetManager: 	at io.github.domi04151309.home.adapters.MainListAdapter$$ExternalSyntheticLambda0.onClick(Unknown Source:6)
W AndroidKeysetManager: 	at android.view.View.performClick(View.java:7931)
W AndroidKeysetManager: 	at android.view.View.performClickInternal(View.java:7908)
W AndroidKeysetManager: 	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
W AndroidKeysetManager: 	at android.view.View$PerformClick.run(View.java:30990)
W AndroidKeysetManager: 	at android.os.Handler.handleCallback(Handler.java:959)
W AndroidKeysetManager: 	at android.os.Handler.dispatchMessage(Handler.java:100)
W AndroidKeysetManager: 	at android.os.Looper.loopOnce(Looper.java:232)
W AndroidKeysetManager: 	at android.os.Looper.loop(Looper.java:317)
W AndroidKeysetManager: 	at android.app.ActivityThread.main(ActivityThread.java:8592)
W AndroidKeysetManager: 	at java.lang.reflect.Method.invoke(Native Method)
W AndroidKeysetManager: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
W AndroidKeysetManager: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
W AndroidKeysetManager: Caused by: android.security.KeyStoreException: Signature/MAC verification failed (internal Keystore code: -30 message: system/security/keystore2/src/operation.rs:852: KeystoreOperation::finish
W AndroidKeysetManager: 
W AndroidKeysetManager: Caused by:
W AndroidKeysetManager:     0: system/security/keystore2/src/operation.rs:428: Finish failed.
W AndroidKeysetManager:     1: Error::Km(r#VERIFICATION_FAILED)) (public error code: 10 internal Keystore code: -30)
W AndroidKeysetManager: 	at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:416)
W AndroidKeysetManager: 	at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:79)
W AndroidKeysetManager: 	at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:132)
W AndroidKeysetManager: 	at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
W AndroidKeysetManager: 	at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
W AndroidKeysetManager: 	at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
W AndroidKeysetManager: 	at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:626)
W AndroidKeysetManager: 	... 30 more

D AndroidRuntime: Shutting down VM
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: io.github.domi04151309.home, PID: 16886
E AndroidRuntime: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:590)
E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E AndroidRuntime: 	... 1 more
E AndroidRuntime: Caused by: com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
E AndroidRuntime: 	at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:1566)
E AndroidRuntime: 	at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:1664)
E AndroidRuntime: 	at com.google.crypto.tink.proto.Keyset.parseFrom(Keyset.java:957)
E AndroidRuntime: 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.read(SharedPrefKeysetReader.java:84)
E AndroidRuntime: 	at com.google.crypto.tink.CleartextKeysetHandle.read(CleartextKeysetHandle.java:58)
E AndroidRuntime: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:328)
E AndroidRuntime: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
E AndroidRuntime: 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
E AndroidRuntime: 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
E AndroidRuntime: 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
E AndroidRuntime: 	at io.github.domi04151309.home.helpers.DeviceSecrets.<init>(DeviceSecrets.kt:19)
E AndroidRuntime: 	at io.github.domi04151309.home.api.ShellyAPI.<init>(ShellyAPI.kt:21)
E AndroidRuntime: 	at io.github.domi04151309.home.helpers.Global.getCorrectAPI(Global.kt:44)
E AndroidRuntime: 	at io.github.domi04151309.home.activities.MainActivity.selectDevice$app_release(MainActivity.kt:396)
E AndroidRuntime: 	at io.github.domi04151309.home.activities.MainActivity$mainHelperInterface$1.onItemClicked(MainActivity.kt:208)
E AndroidRuntime: 	at io.github.domi04151309.home.adapters.MainListAdapter.onBindViewHolder$lambda-1(MainListAdapter.kt:64)
E AndroidRuntime: 	at io.github.domi04151309.home.adapters.MainListAdapter.$r8$lambda$-UgfsLHSJCh9o2eBE0deixMYq3E(Unknown Source:0)
E AndroidRuntime: 	at io.github.domi04151309.home.adapters.MainListAdapter$$ExternalSyntheticLambda0.onClick(Unknown Source:6)
E AndroidRuntime: 	at android.view.View.performClick(View.java:7931)
E AndroidRuntime: 	at android.view.View.performClickInternal(View.java:7908)
E AndroidRuntime: 	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
E AndroidRuntime: 	at android.view.View$PerformClick.run(View.java:30990)
E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:959)
E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:100)
E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:232)
E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:317)
E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8592)
E AndroidRuntime: 	... 3 more
W ActivityTaskManager:   Force finishing activity io.github.domi04151309.home/.activities.MainActivity

Additional information

  • Android version: 14
  • Home App version: 1.10.0 (1100)
  • Installation source: F-Droid
@cweiske cweiske added the bug Something isn't working label Nov 25, 2024
@Domi04151309
Copy link
Owner

Thanks for your report. This is an issue with the device secrets. A workaround is to copy the JSON in the "Advanced editing"-Setting, delete the app storage and paste the copied JSON into the "Advanced editing"-Setting. This will keep the devices and their settings except the secrets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants