Add support for --with-key-password to Sign

This commit is contained in:
Paul Schaub 2022-05-24 21:55:35 +02:00
parent 8406793d0e
commit 55aefb799f
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,10 @@ public class SignCmd implements Runnable {
paramLabel = "KEYS")
List<File> secretKeyFile = new ArrayList<>();
@CommandLine.Option(names = "--with-key-password", description = "Password(s) to unlock the secret key(s) with",
paramLabel = "PASSWORD")
List<String> 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);