mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-05 20:15:59 +01:00
Wrap MalformedOpenPgpMessageException in BadData
This commit is contained in:
parent
160a5fe8ff
commit
08ceee9243
4 changed files with 7 additions and 4 deletions
|
@ -656,7 +656,7 @@ public class OpenPgpMessageInputStream extends DecryptionStream {
|
|||
if (decryptionKey == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
KeyRingInfo info = new KeyRingInfo(secretKeys, policy, new Date());
|
||||
List<PGPPublicKey> encryptionKeys = info.getEncryptionSubkeys(EncryptionPurpose.ANY);
|
||||
for (PGPPublicKey key : encryptionKeys) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions;
|
|||
import org.pgpainless.decryption_verification.DecryptionStream;
|
||||
import org.pgpainless.decryption_verification.OpenPgpMetadata;
|
||||
import org.pgpainless.decryption_verification.SignatureVerification;
|
||||
import org.pgpainless.exception.MalformedOpenPgpMessageException;
|
||||
import org.pgpainless.exception.MissingDecryptionMethodException;
|
||||
import org.pgpainless.exception.WrongPassphraseException;
|
||||
import org.pgpainless.util.Passphrase;
|
||||
|
@ -135,7 +136,7 @@ public class DecryptImpl implements Decrypt {
|
|||
throw new SOPGPException.CannotDecrypt();
|
||||
} catch (WrongPassphraseException e) {
|
||||
throw new SOPGPException.KeyIsProtected();
|
||||
} catch (PGPException | IOException e) {
|
||||
} catch (MalformedOpenPgpMessageException | PGPException | IOException e) {
|
||||
throw new SOPGPException.BadData(e);
|
||||
} finally {
|
||||
// Forget passphrases after decryption
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions;
|
|||
import org.pgpainless.decryption_verification.DecryptionStream;
|
||||
import org.pgpainless.decryption_verification.OpenPgpMetadata;
|
||||
import org.pgpainless.decryption_verification.SignatureVerification;
|
||||
import org.pgpainless.exception.MalformedOpenPgpMessageException;
|
||||
import sop.Verification;
|
||||
import sop.exception.SOPGPException;
|
||||
import sop.operation.DetachedVerify;
|
||||
|
@ -85,7 +86,7 @@ public class DetachedVerifyImpl implements DetachedVerify {
|
|||
}
|
||||
|
||||
return verificationList;
|
||||
} catch (PGPException e) {
|
||||
} catch (MalformedOpenPgpMessageException | PGPException e) {
|
||||
throw new SOPGPException.BadData(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.pgpainless.decryption_verification.ConsumerOptions;
|
|||
import org.pgpainless.decryption_verification.DecryptionStream;
|
||||
import org.pgpainless.decryption_verification.OpenPgpMetadata;
|
||||
import org.pgpainless.decryption_verification.SignatureVerification;
|
||||
import org.pgpainless.exception.MalformedOpenPgpMessageException;
|
||||
import sop.ReadyWithResult;
|
||||
import sop.Verification;
|
||||
import sop.exception.SOPGPException;
|
||||
|
@ -84,7 +85,7 @@ public class InlineVerifyImpl implements InlineVerify {
|
|||
}
|
||||
|
||||
return verificationList;
|
||||
} catch (PGPException e) {
|
||||
} catch (MalformedOpenPgpMessageException | PGPException e) {
|
||||
throw new SOPGPException.BadData(e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue