diff options
author | Werner Koch <wk@gnupg.org> | 2016-06-02 18:38:10 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-06-02 18:38:10 +0200 |
commit | 01285f909e43e8d6a48fbcc77bb5af53d567d8a2 (patch) | |
tree | bd7d1824b299b989b8a88980ef8b98d35fb13bb8 /g10/gpg.c | |
parent | gpg: Improve the new parse_subkey_algostr_usagestr fucntion. (diff) | |
download | gnupg2-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.c | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -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 */ |