mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Do not use a fixed string for --gpgconf-list:default_pubkey_algo.
* g10/keygen.c (get_default_pubkey_algo): New. (parse_key_parameter_string): Use it. * g10/gpg.c (gpgconf_list): Take value from new function. -- Note that consumers of that gpgconf-list value may need to be adjusted to that new value. It should anyway only be used to display the default algorithm. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
522e6f798d
commit
f1304ee9b2
3 changed files with 20 additions and 2 deletions
19
g10/keygen.c
19
g10/keygen.c
|
@ -152,6 +152,23 @@ static unsigned int get_keysize_range (int algo,
|
|||
|
||||
|
||||
|
||||
/* Return the algo string for a default new key. */
|
||||
const char *
|
||||
get_default_pubkey_algo (void)
|
||||
{
|
||||
if (opt.def_new_key_algo)
|
||||
{
|
||||
if (*opt.def_new_key_algo && !strchr (opt.def_new_key_algo, ':'))
|
||||
return opt.def_new_key_algo;
|
||||
/* To avoid checking that option every time we delay that until
|
||||
* here. The only thing we really need to make sure is that
|
||||
* there is no colon in the string so that the --gpgconf-list
|
||||
* command won't mess up its output. */
|
||||
log_info (_("invalid value for option '%s'\n"), "--default-new-key-algo");
|
||||
}
|
||||
return DEFAULT_STD_KEY_PARAM;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_status_key_created (int letter, PKT_public_key *pk, const char *handle)
|
||||
|
@ -3122,7 +3139,7 @@ parse_key_parameter_string (const char *string, int part,
|
|||
|
||||
if (!string || !*string
|
||||
|| !strcmp (string, "default") || !strcmp (string, "-"))
|
||||
string = opt.def_new_key_algo? opt.def_new_key_algo : DEFAULT_STD_KEY_PARAM;
|
||||
string = get_default_pubkey_algo ();
|
||||
else if (!strcmp (string, "future-default"))
|
||||
string = FUTURE_STD_KEY_PARAM;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue