mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-12-22 12:57:57 +01:00
sop decrypt: Throw NoSignature if no verifiable signature found
This commit is contained in:
parent
14c665565e
commit
ff5f98e8ee
1 changed files with 6 additions and 0 deletions
|
@ -101,6 +101,7 @@ public class DecryptCmd extends AbstractSopCmd {
|
|||
DecryptionResult result = ready.writeTo(System.out);
|
||||
writeSessionKeyOut(result);
|
||||
writeVerifyOut(result);
|
||||
|
||||
} catch (SOPGPException.BadData badData) {
|
||||
String errorMsg = getMsg("sop.error.input.stdin_not_a_message");
|
||||
throw new SOPGPException.BadData(errorMsg, badData);
|
||||
|
@ -114,6 +115,11 @@ public class DecryptCmd extends AbstractSopCmd {
|
|||
|
||||
private void writeVerifyOut(DecryptionResult result) throws IOException {
|
||||
if (verifyOut != null) {
|
||||
if (result.getVerifications().isEmpty()) {
|
||||
String errorMsg = getMsg("sop.error.runtime.no_verifiable_signature_found");
|
||||
throw new SOPGPException.NoSignature(errorMsg);
|
||||
}
|
||||
|
||||
try (OutputStream fileOut = getOutput(verifyOut)) {
|
||||
PrintWriter writer = new PrintWriter(fileOut);
|
||||
for (Verification verification : result.getVerifications()) {
|
||||
|
|
Loading…
Reference in a new issue