Status Update
Comments
da...@google.com <da...@google.com> #2
Did the device either:
- Have its lock screen disabled after the app got installed and ran?
- Get restored from a backup?
We're going to release a new version with much better error reporting for these kinds of things. But in the meantime I'm aware that both of the above conditions will cause decryption to fail because you will no longer have the keys used to originally encrypt your EncryptedSharedPreferences. Sadly the API for this library makes it very easy to accidentally create a new key when you were expecting to just retrieve an old one (with the MasterKey.getOrCreate
factory method).
I would recommend either of the following:
- Keep a record of the key's fingerprint and compare against that whenever you think you're retrieving a key. If the key changes you will need to delete the old EncryptedSharedPreferences and create it again with the new key.
- Stop using this library. You may not need it at all. Android guarantees that apps can not read each others' files and mandates that all phones use full disk encryption. There is actually very little, if anything, to gain from using EncryptedSharedPreferences.
is...@google.com <is...@google.com>
ak...@iterable.com <ak...@iterable.com> #3
Any thoughts?
la...@gmail.com <la...@gmail.com> #4
I'm still experiencing this crash. I'm using androidx.security:security-crypto:1.1.0-alpha06
.
-
How would I figure out what the key's fingerprint is and potentially keep track of it?
-
I'm a bit surprised to read a Google engineer saying that the library is pointless. A third-party company's audit led to them being able to view my app's shared preferences data :/ That's what I'm trying to figure out how to have Hilt and
EncryptedSharedPreferences
play well together. I feel that I do still need thisEncryptedSharedPreferences
library.
Description
Version used: 1.1.0-alpha05
Devices/Android versions reproduced on: Android 9 - 13
I got error message from play console, i dont know how to fix this
Exception java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:581)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
Caused by java.lang.reflect.InvocationTargetException:
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
Caused by com.google.crypto.tink.shaded.protobuf.z: Protocol message contained an invalid tag (zero).
at com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException.invalidTag (InvalidProtocolBufferException.java:39)
at com.google.crypto.tink.shaded.protobuf.ArrayDecoders.decodeUnknownField (ArrayDecoders.java:39)
at com.google.crypto.tink.shaded.protobuf.MessageSchema.parseProto3Message (MessageSchema.java:756)
at com.google.crypto.tink.shaded.protobuf.MessageSchema.mergeFrom (MessageSchema.java)
at com.google.crypto.tink.shaded.protobuf.ArrayDecoders.decodeMessageField (ArrayDecoders.java)
at com.google.crypto.tink.shaded.protobuf.ArrayDecoders.decodeMessageList (ArrayDecoders.java)
at com.google.crypto.tink.shaded.protobuf.MessageSchema.parseProto3Message (MessageSchema.java:554)
at com.google.crypto.tink.shaded.protobuf.MessageSchema.mergeFrom (MessageSchema.java)
at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite.parsePartialFrom (GeneratedMessageLite.java:34)
at com.google.crypto.tink.proto.Keyset.parseFrom (Keyset.java)
at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.read (SharedPrefKeysetReader.java:61)
at com.google.crypto.tink.CleartextKeysetHandle.read (CleartextKeysetHandle.java:61)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read (AndroidKeysetManager.java:61)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset (AndroidKeysetManager.java:61)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build (AndroidKeysetManager.java:77)
at androidx.security.crypto.EncryptedSharedPreferences.create (EncryptedSharedPreferences.java:77)
at com.rmf.jadwalmotogp.data.SessionManager.<init> (SessionManager.java:77)
at com.rmf.jadwalmotogp.DaggerApp_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get (DaggerApp_HiltComponents_SingletonC.java:186)
at dagger.internal.DoubleCheck.get (DoubleCheck.java:14)
at com.rmf.jadwalmotogp.DaggerApp_HiltComponents_SingletonC$ViewModelCImpl$SwitchingProvider.get (DaggerApp_HiltComponents_SingletonC.java:233)
at dagger.hilt.android.internal.lifecycle.HiltViewModelFactory$1.create (HiltViewModelFactory.java)
at androidx.lifecycle.AbstractSavedStateViewModelFactory.create (AbstractSavedStateViewModelFactory.java:47)
at dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.create (HiltViewModelFactory.java)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.java:63)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.java)
at androidx.lifecycle.viewmodel.compose.ViewModelKt.get (ViewModelKt.java:91)
at androidx.lifecycle.viewmodel.compose.ViewModelKt.get$default (ViewModelKt.java:22)
at com.rmf.jadwalmotogp.ComposableSingletons$MainActivityKt$lambda-3$1.invoke (ComposableSingletons.java:44)
at com.google.accompanist.systemuicontroller.SystemUiControllerKt.rememberSystemUiController (SystemUiControllerKt.java)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke (ComposableLambdaImpl.java:4)
at androidx.compose.ui.platform.ComposeView.a (ComposeView.java:26)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke (AbstractComposeView.java:31)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke (ComposableLambdaImpl.java:4)
at androidx.compose.runtime.CompositionLocalKt.a (CompositionLocalKt.java:31)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals (CompositionLocalsKt.java:332)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke (AndroidCompositionLocals_androidKt.java:41)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke (ComposableLambdaImpl.java:4)
at androidx.compose.runtime.CompositionLocalKt.a (CompositionLocalKt.java:31)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals (AndroidCompositionLocals_androidKt.java:554)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke (WrappedComposition.java:35)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke (ComposableLambdaImpl.java:4)
at androidx.compose.runtime.CompositionLocalKt.a (CompositionLocalKt.java:31)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke (WrappedComposition.java:154)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke (ComposableLambdaImpl.java:4)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable (ActualJvm_jvmKt.java:58)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke (ComposerImpl.java:58)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke (ComposerImpl.java:58)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations (SnapshotStateKt__DerivedStateKt.java:43)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations (SnapshotStateKt.java:43)
at androidx.compose.runtime.ComposerImpl.doCompose (ComposerImpl.java:128)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release (ComposerImpl.java)
at androidx.compose.runtime.CompositionImpl.composeContent (CompositionImpl.java:18)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release (Recomposer.java:45)
at androidx.compose.runtime.CompositionImpl.setContent (CompositionImpl.java)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke (WrappedComposition.java:66)
at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable (AndroidComposeView.java)
at androidx.compose.ui.platform.WrappedComposition.setContent (WrappedComposition.java)
at androidx.compose.ui.platform.WrappedComposition.onStateChanged (WrappedComposition.java)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent (LifecycleRegistry.java:23)
at androidx.lifecycle.LifecycleRegistry.addObserver (LifecycleRegistry.java:107)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke (WrappedComposition.java:30)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow (AndroidComposeView.java:114)
at android.view.View.dispatchAttachedToWindow (View.java:21976)
at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4293)
at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
at android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:3474)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2924)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:10513)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1108)
at android.view.Choreographer.doCallbacks (Choreographer.java:866)
at android.view.Choreographer.doFrame (Choreographer.java:797)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1092)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8751)