summaryrefslogtreecommitdiffstats
path: root/g10/gpg.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-06-02 18:38:10 +0200
committerWerner Koch <wk@gnupg.org>2016-06-02 18:38:10 +0200
commit01285f909e43e8d6a48fbcc77bb5af53d567d8a2 (patch)
treebd7d1824b299b989b8a88980ef8b98d35fb13bb8 /g10/gpg.c
parentgpg: Improve the new parse_subkey_algostr_usagestr fucntion. (diff)
downloadgnupg2-01285f909e43e8d6a48fbcc77bb5af53d567d8a2.tar.xz
gnupg2-01285f909e43e8d6a48fbcc77bb5af53d567d8a2.zip
gpg: Extend the --quick-gen-key command.
* g10/keygen.c (quickgen_set_para): Add arg 'use'. (quick_generate_keypair): Add args 'algostr', 'usagestr', and 'expirestr'. Implement primary only key mode. (parse_algo_usage_expire): Set NBITS for the default algo. * g10/gpg.c (main): Extend --quick-gen-key command. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/gpg.c')
-rw-r--r--g10/gpg.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index 279533076..b193fcdfd 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -4096,11 +4096,29 @@ main (int argc, char **argv)
break;
case aQuickKeygen:
- if (argc != 1 )
- wrong_args("--gen-key user-id");
- username = make_username (fname);
- quick_generate_keypair (ctrl, username);
- xfree (username);
+ {
+ const char *x_algo, *x_usage, *x_expire;
+
+ if (argc < 1 || argc > 4)
+ wrong_args("--quick-gen-key USER-ID [ALGO [USAGE [EXPIRE]]]");
+ username = make_username (fname);
+ argv++, argc--;
+ x_algo = "";
+ x_usage = "";
+ x_expire = "";
+ if (argc)
+ {
+ x_algo = *argv++; argc--;
+ if (argc)
+ {
+ x_usage = *argv++; argc--;
+ if (argc)
+ x_expire = *argv++; argc--;
+ }
+ }
+ quick_generate_keypair (ctrl, username, x_algo, x_usage, x_expire);
+ xfree (username);
+ }
break;
case aKeygen: /* generate a key */