From c967cbb9f0b58ac446cd7b5a146f379b23b02578 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 16 Jun 2022 11:05:28 +0200 Subject: [PATCH] SOP: Properly throw CannotDecrypt --- .../src/main/java/org/pgpainless/sop/DecryptImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pgpainless-sop/src/main/java/org/pgpainless/sop/DecryptImpl.java b/pgpainless-sop/src/main/java/org/pgpainless/sop/DecryptImpl.java index 38656c9b..413136da 100644 --- a/pgpainless-sop/src/main/java/org/pgpainless/sop/DecryptImpl.java +++ b/pgpainless-sop/src/main/java/org/pgpainless/sop/DecryptImpl.java @@ -22,6 +22,7 @@ import org.pgpainless.algorithm.SymmetricKeyAlgorithm; import org.pgpainless.decryption_verification.ConsumerOptions; import org.pgpainless.decryption_verification.DecryptionStream; import org.pgpainless.decryption_verification.OpenPgpMetadata; +import org.pgpainless.exception.MissingDecryptionMethodException; import org.pgpainless.key.SubkeyIdentifier; import org.pgpainless.key.info.KeyRingInfo; import org.pgpainless.key.protection.SecretKeyRingProtector; @@ -128,6 +129,8 @@ public class DecryptImpl implements Decrypt { decryptionStream = PGPainless.decryptAndOrVerify() .onInputStream(ciphertext) .withOptions(consumerOptions); + } catch (MissingDecryptionMethodException e) { + throw new SOPGPException.CannotDecrypt(); } catch (PGPException | IOException e) { throw new SOPGPException.BadData(e); }