diff --git a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java index f28af58..0b309bc 100644 --- a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java +++ b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/DecryptCmd.java @@ -106,6 +106,9 @@ public class DecryptCmd extends AbstractSopCmd { } catch (SOPGPException.BadData badData) { String errorMsg = getMsg("sop.error.input.stdin_not_a_message"); throw new SOPGPException.BadData(errorMsg, badData); + } catch (SOPGPException.CannotDecrypt e) { + String errorMsg = getMsg("sop.error.runtime.cannot_decrypt_message"); + throw new SOPGPException.CannotDecrypt(errorMsg, e); } catch (IOException ioException) { throw new RuntimeException(ioException); } diff --git a/sop-java-picocli/src/main/resources/msg_sop.properties b/sop-java-picocli/src/main/resources/msg_sop.properties index d01e67f..fce60c5 100644 --- a/sop-java-picocli/src/main/resources/msg_sop.properties +++ b/sop-java-picocli/src/main/resources/msg_sop.properties @@ -64,6 +64,7 @@ sop.error.runtime.key_cannot_sign=Secret key from input '%s' cannot sign. sop.error.runtime.cert_cannot_encrypt=Certificate from input '%s' cannot encrypt. sop.error.runtime.no_session_key_extracted=Session key not extracted. Feature potentially not supported. sop.error.runtime.no_verifiable_signature_found=No verifiable signature found. +sop.error.runtime.cannot_decrypt_message=Message could not be decrypted. ## Usage errors sop.error.usage.password_or_cert_required=At least one password file or cert file required for encryption. sop.error.usage.argument_required=Argument '%s' is required. diff --git a/sop-java-picocli/src/main/resources/msg_sop_de.properties b/sop-java-picocli/src/main/resources/msg_sop_de.properties index a54fa7e..acbfb68 100644 --- a/sop-java-picocli/src/main/resources/msg_sop_de.properties +++ b/sop-java-picocli/src/main/resources/msg_sop_de.properties @@ -64,6 +64,7 @@ sop.error.runtime.key_cannot_sign=Privater Schl sop.error.runtime.cert_cannot_encrypt=Zertifikat aus Eingabe '%s' kann nicht verschlüsseln. sop.error.runtime.no_session_key_extracted=Nachrichtenschlüssel nicht extrahiert. Funktion wird möglicherweise nicht unterstützt. sop.error.runtime.no_verifiable_signature_found=Keine gültigen Signaturen gefunden. +sop.error.runtime.cannot_decrypt_message=Nachricht konnte nicht entschlüsselt werden. ## Usage errors sop.error.usage.password_or_cert_required=Es wird mindestens ein Passwort und/oder Zertifikat zur Verschlüsselung benötigt. sop.error.usage.argument_required=Argument '%s' ist erforderlich. diff --git a/sop-java/src/main/java/sop/exception/SOPGPException.java b/sop-java/src/main/java/sop/exception/SOPGPException.java index eca2476..4d8c9f6 100644 --- a/sop-java/src/main/java/sop/exception/SOPGPException.java +++ b/sop-java/src/main/java/sop/exception/SOPGPException.java @@ -119,6 +119,14 @@ public abstract class SOPGPException extends RuntimeException { public static final int EXIT_CODE = 29; + public CannotDecrypt() { + + } + + public CannotDecrypt(String errorMsg, Throwable e) { + super(errorMsg, e); + } + @Override public int getExitCode() { return EXIT_CODE;