mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-26 00:52:07 +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);
|
DecryptionResult result = ready.writeTo(System.out);
|
||||||
writeSessionKeyOut(result);
|
writeSessionKeyOut(result);
|
||||||
writeVerifyOut(result);
|
writeVerifyOut(result);
|
||||||
|
|
||||||
} catch (SOPGPException.BadData badData) {
|
} catch (SOPGPException.BadData badData) {
|
||||||
String errorMsg = getMsg("sop.error.input.stdin_not_a_message");
|
String errorMsg = getMsg("sop.error.input.stdin_not_a_message");
|
||||||
throw new SOPGPException.BadData(errorMsg, badData);
|
throw new SOPGPException.BadData(errorMsg, badData);
|
||||||
|
@ -114,6 +115,11 @@ public class DecryptCmd extends AbstractSopCmd {
|
||||||
|
|
||||||
private void writeVerifyOut(DecryptionResult result) throws IOException {
|
private void writeVerifyOut(DecryptionResult result) throws IOException {
|
||||||
if (verifyOut != null) {
|
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)) {
|
try (OutputStream fileOut = getOutput(verifyOut)) {
|
||||||
PrintWriter writer = new PrintWriter(fileOut);
|
PrintWriter writer = new PrintWriter(fileOut);
|
||||||
for (Verification verification : result.getVerifications()) {
|
for (Verification verification : result.getVerifications()) {
|
||||||
|
|
Loading…
Reference in a new issue