From 17b305924c92cd272dcad18b5255440ac393e70c Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sun, 9 Apr 2023 19:53:21 +0200 Subject: [PATCH] Throw IncompatibleOptions error for sign --as=clearsigned --no-armor --- .../main/java/sop/cli/picocli/commands/InlineSignCmd.java | 5 +++++ sop-java-picocli/src/main/resources/msg_sop.properties | 3 +++ sop-java-picocli/src/main/resources/msg_sop_de.properties | 3 +++ 3 files changed, 11 insertions(+) diff --git a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/InlineSignCmd.java b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/InlineSignCmd.java index 2608783..7e7c8af 100644 --- a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/InlineSignCmd.java +++ b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/InlineSignCmd.java @@ -41,6 +41,11 @@ public class InlineSignCmd extends AbstractSopCmd { InlineSign inlineSign = throwIfUnsupportedSubcommand( SopCLI.getSop().inlineSign(), "inline-sign"); + if (!armor && type == InlineSignAs.clearsigned) { + String errorMsg = getMsg("sop.error.usage.incompatible_options.clearsigned_no_armor"); + throw new SOPGPException.IncompatibleOptions(errorMsg); + } + if (type != null) { try { inlineSign.mode(type); diff --git a/sop-java-picocli/src/main/resources/msg_sop.properties b/sop-java-picocli/src/main/resources/msg_sop.properties index c0f9f67..069b0ce 100644 --- a/sop-java-picocli/src/main/resources/msg_sop.properties +++ b/sop-java-picocli/src/main/resources/msg_sop.properties @@ -32,6 +32,8 @@ usage.exitCodeList.15=69:Unsupported subcommand usage.exitCodeList.16=71:Unsupported special prefix (e.g. \"@ENV/@FD\") of indirect parameter usage.exitCodeList.17=73:Ambiguous input (a filename matching the designator already exists) usage.exitCodeList.18=79:Key is not signing capable +usage.exitCodeList.19=83:Options were supplied that are incompatible with each other +usage.exitCodeList.20=89:The requested profile is unsupported, or the indicated subcommand does not accept profiles ## SHARED RESOURCES stacktrace=Print stacktrace @@ -73,6 +75,7 @@ sop.error.usage.password_or_cert_required=At least one password file or cert fil sop.error.usage.argument_required=Argument '%s' is required. sop.error.usage.parameter_required=Parameter '%s' is required. sop.error.usage.option_requires_other_option=Option '%s' is requested, but no option %s was provided. +sop.error.usage.incompatible_options.clearsigned_no_armor=Options '--no-armor' and '--as=clearsigned' are incompatible. # Feature Support sop.error.feature_support.subcommand_not_supported=Subcommand '%s' is not supported. sop.error.feature_support.option_not_supported=Option '%s' not supported. \ No newline at end of file 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 b05c86a..a8569e5 100644 --- a/sop-java-picocli/src/main/resources/msg_sop_de.properties +++ b/sop-java-picocli/src/main/resources/msg_sop_de.properties @@ -32,6 +32,8 @@ usage.exitCodeList.15=69:Nicht unterst usage.exitCodeList.16=71:Nicht unterstützter Spezialprefix (z.B.. "@ENV/@FD") von indirektem Parameter usage.exitCodeList.17=73:Mehrdeutige Eingabe (ein Dateiname, der dem Bezeichner entspricht, existiert bereits) usage.exitCodeList.18=79:Schlüssel ist nicht fähig zu signieren +usage.exitCodeList.19=83:Miteinander inkompatible Optionen spezifiziert +usage.exitCodeList.20=89:Das angeforderte Profil wird nicht unterstützt, oder der angegebene Unterbefehl akzeptiert keine Profile ## SHARED RESOURCES stacktrace=Stacktrace ausgeben @@ -72,6 +74,7 @@ sop.error.usage.password_or_cert_required=Es wird mindestens ein Passwort und/od sop.error.usage.argument_required=Argument '%s' ist erforderlich. sop.error.usage.parameter_required=Parameter '%s' ist erforderlich. sop.error.usage.option_requires_other_option=Option '%s' wurde angegeben, jedoch kein Wert für %s. +sop.error.usage.incompatible_options.clearsigned_no_armor=Optionen '--no-armor' und '--as=clearsigned' sind inkompatibel. # Feature Support sop.error.feature_support.subcommand_not_supported=Unterbefehl '%s' wird nicht unterstützt. sop.error.feature_support.option_not_supported=Option '%s' wird nicht unterstützt. \ No newline at end of file