android-password-store / Android-Password-Store

Android application compatible with ZX2C4's Pass command line application
https://passwordstore.app
GNU General Public License v3.0
2.53k stars 251 forks source link

public only keys cause null pointer exception #3143

Closed gregrenda closed 1 month ago

gregrenda commented 1 month ago

Describe the bug

When using multiple keys and one of the keys is a public only key, a null pointer exception occurs when attempting to decrypt a password file.

In my setup, the password files are encrypted with two public keys, allowing either associated private key to decrypt the file. So a user needs their private key for decryption and both their public key and the other public key for encryption. Private key files contain both the private and public keys. A public key file contains only the public key. It looks like the code is assuming that the key files always contain both private and public keys.

Steps to reproduce

  1. Import a private key
  2. Import public only key
  3. Attempt to decrypt a password file using the private key password
  4. The Password dialog will report "Wrong password"
  5. The log file shows a null pointer exception in PGPSecretKeyRingCollection

Expected behavior

A password file should be able to be successfully decrypted when a public only key has been imported in addition to a private/public key.

Screenshots

No response

Device information

Additional context

No response

gregrenda commented 1 month ago

Pull request with fix coming right up.