mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-29 10:32:08 +01:00
SOP: Add support for key password in GenerateKeyCmd
This commit is contained in:
parent
580c3af350
commit
9016c9f428
1 changed files with 8 additions and 0 deletions
|
@ -28,6 +28,10 @@ public class GenerateKeyCmd implements Runnable {
|
|||
@CommandLine.Parameters(description = "User-ID, eg. \"Alice <alice@example.com>\"")
|
||||
List<String> userId = new ArrayList<>();
|
||||
|
||||
@CommandLine.Option(names = "--with-key-password",
|
||||
description = "Password to protect the key")
|
||||
String withKeyPassword;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
GenerateKey generateKey = SopCLI.getSop().generateKey();
|
||||
|
@ -43,6 +47,10 @@ public class GenerateKeyCmd implements Runnable {
|
|||
generateKey.noArmor();
|
||||
}
|
||||
|
||||
if (withKeyPassword != null && !withKeyPassword.trim().isEmpty()) {
|
||||
generateKey.withKeyPassword(withKeyPassword.trim());
|
||||
}
|
||||
|
||||
try {
|
||||
Ready ready = generateKey.generate();
|
||||
ready.writeTo(System.out);
|
||||
|
|
Loading…
Reference in a new issue