1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-06 04:26:00 +01:00

Wrap MalformedOpenPgpMessageException in BadData

This commit is contained in:
Paul Schaub 2022-10-24 18:32:56 +02:00
parent 160a5fe8ff
commit 08ceee9243
4 changed files with 7 additions and 4 deletions

View file

@ -23,6 +23,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions;
import org.pgpainless.decryption_verification.DecryptionStream; import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.decryption_verification.SignatureVerification; import org.pgpainless.decryption_verification.SignatureVerification;
import org.pgpainless.exception.MalformedOpenPgpMessageException;
import org.pgpainless.exception.MissingDecryptionMethodException; import org.pgpainless.exception.MissingDecryptionMethodException;
import org.pgpainless.exception.WrongPassphraseException; import org.pgpainless.exception.WrongPassphraseException;
import org.pgpainless.util.Passphrase; import org.pgpainless.util.Passphrase;
@ -135,7 +136,7 @@ public class DecryptImpl implements Decrypt {
throw new SOPGPException.CannotDecrypt(); throw new SOPGPException.CannotDecrypt();
} catch (WrongPassphraseException e) { } catch (WrongPassphraseException e) {
throw new SOPGPException.KeyIsProtected(); throw new SOPGPException.KeyIsProtected();
} catch (PGPException | IOException e) { } catch (MalformedOpenPgpMessageException | PGPException | IOException e) {
throw new SOPGPException.BadData(e); throw new SOPGPException.BadData(e);
} finally { } finally {
// Forget passphrases after decryption // Forget passphrases after decryption

View file

@ -18,6 +18,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions;
import org.pgpainless.decryption_verification.DecryptionStream; import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.decryption_verification.SignatureVerification; import org.pgpainless.decryption_verification.SignatureVerification;
import org.pgpainless.exception.MalformedOpenPgpMessageException;
import sop.Verification; import sop.Verification;
import sop.exception.SOPGPException; import sop.exception.SOPGPException;
import sop.operation.DetachedVerify; import sop.operation.DetachedVerify;
@ -85,7 +86,7 @@ public class DetachedVerifyImpl implements DetachedVerify {
} }
return verificationList; return verificationList;
} catch (PGPException e) { } catch (MalformedOpenPgpMessageException | PGPException e) {
throw new SOPGPException.BadData(e); throw new SOPGPException.BadData(e);
} }
} }

View file

@ -19,6 +19,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions;
import org.pgpainless.decryption_verification.DecryptionStream; import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.decryption_verification.SignatureVerification; import org.pgpainless.decryption_verification.SignatureVerification;
import org.pgpainless.exception.MalformedOpenPgpMessageException;
import sop.ReadyWithResult; import sop.ReadyWithResult;
import sop.Verification; import sop.Verification;
import sop.exception.SOPGPException; import sop.exception.SOPGPException;
@ -84,7 +85,7 @@ public class InlineVerifyImpl implements InlineVerify {
} }
return verificationList; return verificationList;
} catch (PGPException e) { } catch (MalformedOpenPgpMessageException | PGPException e) {
throw new SOPGPException.BadData(e); throw new SOPGPException.BadData(e);
} }
} }