Android-Password-Store
Android-Password-Store copied to clipboard
[BUG] Passphrase caching forever loops and errors
Describe the bug
I am unable to decrypt any entry with passphrase caching.
Steps to reproduce
Steps to reproduce the behavior:
- Enable passphrase caching
- Try to open a password entry
- Observe as theres nothing given (empty screen, like it didn't get a password), and logcat is forever looped.
Expected behavior
I am able to get the password entry.
Screenshots
No response
Device information
- Device: Google Pixel 7a
- OS: Android 14
- App version: 2.0.0-SNAPSHOT
Additional context
Logs
03-10 17:31:54.410 13012 13034 D TrafficStats: tagSocket(73) with statsTag=0xffffffff, statsUid=-1
03-10 17:31:54.843 13012 13034 D TrafficStats: tagSocket(73) with statsTag=0xffffffff, statsUid=-1
03-10 17:31:57.377 13012 13034 D TrafficStats: tagSocket(73) with statsTag=0xffffffff, statsUid=-1
03-10 17:31:59.278 13012 13084 D ProfileInstaller: Installing profile for app.passwordstore
03-10 17:32:13.159 13012 13021 W p.passwordstore: Cleared Reference was only reachable from finalizer (only reported once)
03-10 17:32:16.870 13012 13012 W RecyclerView: No adapter attached; skipping layout
03-10 17:32:18.770 13012 13012 W WindowOnBackDispatcher: OnBackInvokedCallback is not enabled for the application.
03-10 17:32:18.770 13012 13012 W WindowOnBackDispatcher: Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
03-10 17:32:18.770 13012 13012 D BiometricAuthenticator: onAuthenticationSucceeded()
03-10 17:32:19.169 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Data Packet at depth 0 encountered
03-10 17:32:19.169 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Integrity-Protected Data has 0 SKESK(s) and 1 PKESK(s) from which 0 PKESK(s) have an anonymous recipient
03-10 17:32:19.169 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Encountered PKESK for recipient 6A0F611345E0E07D
03-10 17:32:19.208 13012 13073 D org.pgpainless.key.info.KeyRingInfo: (Sub?)-Key XXXXXXXXXXXXXXXXX is not encryption-capable.
03-10 17:32:19.208 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Attempt decryption using secret key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
03-10 17:32:19.210 13012 13012 E DecryptActivity: app.passwordstore.crypto.errors.UnknownError
03-10 17:32:19.210 13012 13012 E DecryptActivity: at app.passwordstore.data.crypto.CryptoRepository.access$decryptPgp(Unknown Source:561)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at app.passwordstore.data.crypto.CryptoRepository$decrypt$2.invokeSuspend(Unknown Source:38)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at kotlinx.coroutines.DispatchedTask.run(Unknown Source:114)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at com.google.android.gms.tasks.zzi.run(Unknown Source:76)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:95)
03-10 17:32:19.210 13012 13012 E DecryptActivity: Caused by: org.pgpainless.exception.WrongPassphraseException: Wrong passphrase provided for key 6a0f611345e0e07d
03-10 17:32:19.210 13012 13012 E DecryptActivity: at kotlin.UnsignedKt.unlockSecretKey(Unknown Source:1343)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at org.pgpainless.decryption_verification.OpenPgpMessageInputStream.consumePackets(Unknown Source:1813)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at org.pgpainless.decryption_verification.OpenPgpMessageInputStream.<init>(SourceFile:55)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at io.sentry.metrics.MetricsApi.withOptions(Unknown Source:55)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at app.passwordstore.data.crypto.CryptoRepository.access$decryptPgp(Unknown Source:421)
03-10 17:32:19.210 13012 13012 E DecryptActivity: ... 6 more
03-10 17:32:19.210 13012 13012 E DecryptActivity: Caused by: org.bouncycastle.openpgp.PGPException: Exception decrypting key
03-10 17:32:19.210 13012 13012 E DecryptActivity: at org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(Unknown Source:323)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey(Unknown Source:15)
03-10 17:32:19.210 13012 13012 E DecryptActivity: at kotlin.UnsignedKt.unlockSecretKey(Unknown Source:75)
03-10 17:32:19.210 13012 13012 E DecryptActivity: ... 10 more
03-10 17:32:19.210 13012 13012 E DecryptActivity: Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.Object org.eclipse.jgit.revwalk.RevWalk$2.val$lItr' on a null object reference in method 'byte[] org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(org.eclipse.jgit.revwalk.RevWalk$2)'
03-10 17:32:19.210 13012 13012 E DecryptActivity: at org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(Unknown Source:25)
03-10 17:32:19.210 13012 13012 E DecryptActivity: ... 12 more
03-10 17:32:19.467 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Data Packet at depth 0 encountered
03-10 17:32:19.468 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Symmetrically Encrypted Integrity-Protected Data has 0 SKESK(s) and 1 PKESK(s) from which 0 PKESK(s) have an anonymous recipient
03-10 17:32:19.469 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Encountered PKESK for recipient 6A0F611345E0E07D
03-10 17:32:19.545 13012 13073 D org.pgpainless.key.info.KeyRingInfo: (Sub?)-Key XXXXXXXXXXXXXXXXX is not encryption-capable.
03-10 17:32:19.546 13012 13073 D org.pgpainless.decryption_verification.OpenPgpMessageInputStream: Attempt decryption using secret key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.. And it loops forever, attempting to decrypt
Re-importing the key does not change anything.
The issue at hand here is the passphrase is not being re-prompted when there is no cached passphrase. That is why it fails.
Please check if the cached passphrase is valid and cache it, in this case it doesn't seem to work. Uninstalling completely fixed the problem for me.
I've also noticed the issue today where the passphrase cache wasn't working but the logic to re-prompt for the password worked as expected. I'll investigate both issues in a while.
I was temporarily able to reproduce this while working on a minor overhaul of the passphrase caching code, unfortunately I can't do so anymore. I'll continue looking later and see if I can get a consistent reproduction.
In the mean time the latest snapshot should allow you to purge your passphrase cache by disabling and re-enabling it from settings, so if the problem is a poisoned cache entry that should resolve it.
I haven't been able to repro this in the past few months, please verify if you still hit this problem with the latest snapshot.
Thanks for your work