diff --git a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/SignCmd.java b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/SignCmd.java index 7574923..08001e2 100644 --- a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/SignCmd.java +++ b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/SignCmd.java @@ -40,6 +40,10 @@ public class SignCmd implements Runnable { paramLabel = "KEYS") List secretKeyFile = new ArrayList<>(); + @CommandLine.Option(names = "--with-key-password", description = "Password(s) to unlock the secret key(s) with", + paramLabel = "PASSWORD") + List withKeyPassword = new ArrayList<>(); + @CommandLine.Option(names = "--micalg-out", description = "Emits the digest algorithm used to the specified file in a way that can be used to populate the micalg parameter for the PGP/MIME Content-Type (RFC3156)", paramLabel = "MICALG") File micAlgOut; @@ -70,6 +74,10 @@ public class SignCmd implements Runnable { System.exit(19); } + for (String password : withKeyPassword) { + sign.withKeyPassword(password); + } + for (File keyFile : secretKeyFile) { try (FileInputStream keyIn = new FileInputStream(keyFile)) { sign.key(keyIn);