pgpainless: Catch KEY MISMATCH exception

Let’s imagine that we have the following case:

  1. create an encrypted text for key A and key B.
  2. we have key C
  3. we try to decrypt the encrypted text with key C
  4. after 3. we will receive the following exception org.bouncycastle.openpgp.PGPException: Decryption failed - No suitable decryption key or passphrase found that relates to the following code

https://github.com/pgpainless/pgpainless/blob/b1deb75969ba9966da2abe2dbcd5dddd9623fc83/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/DecryptionStreamFactory.java#L275

  1. On the user side it can mean that the user uses the wrong key for decryption (didn’t import the right key)

it would be great to have for example KeyMismatchException that cover the following

image

@vanitasvitae What do you think about that?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

got it. in that case, for our sense, the callback here would not be used, since we always provide all keys anyway

On Saturday, May 29, 2021, Paul Schaub @.***> wrote:

Secret key passphrases are handled elsewhere, namely in the SecretKeyRingProtector. The CachingSecretKeyRingProtector has support for asking for missing key passphrases : https://github.com/pgpainless/pgpainless/blob/master/ pgpainless-core/src/main/java/org/pgpainless/key/protection/ CachingSecretKeyRingProtector.java)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pgpainless/pgpainless/issues/127#issuecomment-850857479, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQDZEJH4XWSNPZLOA426YLTQEGRXANCNFSM45UQ7TDQ .

Tom James Holub http://holub.me/