Fixed
Status Update
Comments
ch...@gmail.com <ch...@gmail.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
li...@gmail.com <li...@gmail.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
mi...@gmail.com <mi...@gmail.com> #4
The same problem here
li...@gmail.com <li...@gmail.com> #5
The same problem here.
ch...@gmail.com <ch...@gmail.com> #6
I ran into the same problem.
I've submitted a change to fix EncryptedSharedPreferences.Editor#remove here:
If that change is accepted, I'll consider submitting a change to fix SharedPreferences.Editor#clear as well.
da...@google.com <da...@google.com> #7
Thanks so much for writing the change with tests! Looks like we forgot to merge this in. Will hopefully merge later today.
we...@sky.uk <we...@sky.uk> #8
There are two issues raised in this ticket clear and remove Alpha 04 appears to fix remove, but will there be a follow up fix for clear as well?
[Deleted User] <[Deleted User]> #9
We're currently on 1.1.0-alpha03, and getting these crashes in very high numbers on a daily basis, seems like remove() has been fixed but clear() has not.
Fatal Exception: java.lang.SecurityException: Could not decrypt key. decryption failed
at androidx.security.crypto.EncryptedSharedPreferences.decryptKey(EncryptedSharedPreferences.java:612)
at androidx.security.crypto.EncryptedSharedPreferences.getAll(EncryptedSharedPreferences.java:402)
at androidx.security.crypto.EncryptedSharedPreferences$Editor.clearKeysIfNeeded(EncryptedSharedPreferences.java:358)
at androidx.security.crypto.EncryptedSharedPreferences$Editor.commit(EncryptedSharedPreferences.java:337)
at com.kisannetwork.local_db.PrefManager.clearAll(PrefManager.java:235)
at com.kisannetwork.authUtils.TokenAuthenticator.authenticate$lambda-3(TokenAuthenticator.java:76)
at com.kisannetwork.authUtils.TokenAuthenticator.lambda$0aBc6DZ4PIivHSPy8l7dz_WGUCE(TokenAuthenticator.java)
at com.kisannetwork.authUtils.-$$Lambda$TokenAuthenticator$0aBc6DZ4PIivHSPy8l7dz_WGUCE.run(-.java:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
Description
Component used: androidx.security:security-crypto-ktx:1.1.0-alpha03 (EncryptedSharedPreferences)
Version used: 1.1.0-alpha03
Devices/Android versions reproduced on: API 31 (likely to be all)
I've created a sample project with minimum code to reproduce:https://github.com/ChristianGarcia/ObserveEncryptedPrefsBug