1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-10 22:31:09 +01:00

Make sop decrypt throw for unencrypted data

This commit is contained in:
Paul Schaub 2022-06-23 11:47:48 +02:00
parent efc0cb357b
commit 14531f0050
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 22 additions and 0 deletions

View file

@ -149,6 +149,10 @@ public class DecryptImpl implements Decrypt {
decryptionStream.close();
OpenPgpMetadata metadata = decryptionStream.getResult();
if (!metadata.isEncrypted()) {
throw new SOPGPException.BadData("Data is not encrypted.");
}
List<Verification> verificationList = new ArrayList<>();
for (SignatureVerification signatureVerification : metadata.getVerifiedInbandSignatures()) {
verificationList.add(map(signatureVerification));