android-password-store/Android-Password-Store

public only keys cause null pointer exception

gregrenda opened this issue · 1 comments

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

  • App version: 2.0.0-SNAPSHOT

Additional context

No response

Pull request with fix coming right up.