From 84abace9afca4e7c70c61e4102c4021d006c4d11 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 31 Oct 2024 13:25:04 +0100 Subject: [PATCH] Backport: revoke-key command: Allow for multiple '--with-key-password' options --- .../java/sop/cli/picocli/commands/RevokeKeyCmd.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/RevokeKeyCmd.java b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/RevokeKeyCmd.java index 45f22fa..3c2e45b 100644 --- a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/RevokeKeyCmd.java +++ b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/RevokeKeyCmd.java @@ -11,6 +11,8 @@ import sop.exception.SOPGPException; import sop.operation.RevokeKey; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; @CommandLine.Command(name = "revoke-key", resourceBundle = "msg_revoke-key", @@ -23,7 +25,7 @@ public class RevokeKeyCmd extends AbstractSopCmd { @CommandLine.Option(names = "--with-key-password", paramLabel = "PASSWORD") - String withKeyPassword; + List withKeyPassword = new ArrayList<>(); @Override public void run() { @@ -36,8 +38,10 @@ public class RevokeKeyCmd extends AbstractSopCmd { if (withKeyPassword != null) { try { - String password = stringFromInputStream(getInput(withKeyPassword)); - revokeKey.withKeyPassword(password); + for (String passwordFile : withKeyPassword) { + String password = stringFromInputStream(getInput(passwordFile)); + revokeKey.withKeyPassword(password); + } } catch (SOPGPException.UnsupportedOption e) { String errorMsg = getMsg("sop.error.feature_support.option_not_supported", "--with-key-password"); throw new SOPGPException.UnsupportedOption(errorMsg, e);