aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keygen.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-02-03 16:40:43 +0000
committerWerner Koch <[email protected]>2011-02-03 16:40:43 +0000
commitd9e2dcc1a9182b3144fa4f9b23b6ce7fb2cf63cc (patch)
tree1cff7ab9d33af37963b41cbe2b2b73a9ad6f72ad /g10/keygen.c
parentUpdate copyright year (diff)
downloadgnupg-d9e2dcc1a9182b3144fa4f9b23b6ce7fb2cf63cc.tar.gz
gnupg-d9e2dcc1a9182b3144fa4f9b23b6ce7fb2cf63cc.zip
Extend algo selection menu.
This allows to add an ECC key and to set the capabilities of an ECDSA key. Fix printing of the ECC algorithm when creating a signature.
Diffstat (limited to 'g10/keygen.c')
-rw-r--r--g10/keygen.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/g10/keygen.c b/g10/keygen.c
index fdae6fb83..a5650a8bf 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -1629,7 +1629,7 @@ ask_key_flags(int algo,int subkey)
{
tty_printf("\n");
tty_printf(_("Possible actions for a %s key: "),
- gcry_pk_algo_name (algo));
+ openpgp_pk_algo_name (algo));
print_key_flags(possible);
tty_printf("\n");
tty_printf(_("Current allowed actions: "));
@@ -1727,9 +1727,16 @@ ask_algo (int addmode, int *r_subkey_algo, unsigned int *r_usage)
tty_printf (_(" (%d) RSA (set your own capabilities)\n"), 8 );
}
- tty_printf (_(" (%d) ECDSA and ECDH\n"), 9 );
+ if (opt.expert && !addmode)
+ tty_printf (_(" (%d) ECDSA and ECDH\n"), 9 );
+ if (opt.expert)
+ tty_printf (_(" (%d) ECDSA (sign only)\n"), 10 );
+ if (opt.expert)
+ tty_printf (_(" (%d) ECDSA (set your own capabilities)\n"), 11 );
+ if (opt.expert && addmode)
+ tty_printf (_(" (%d) ECDH (encrypt only)\n"), 12 );
- for(;;)
+ for (;;)
{
*r_usage = 0;
*r_subkey_algo = 0;
@@ -1785,12 +1792,30 @@ ask_algo (int addmode, int *r_subkey_algo, unsigned int *r_usage)
*r_usage = ask_key_flags (algo, addmode);
break;
}
- else if (algo == 9)
+ else if (algo == 9 && opt.expert && !addmode)
{
algo = PUBKEY_ALGO_ECDSA;
*r_subkey_algo = PUBKEY_ALGO_ECDH;
break;
}
+ else if (algo == 10 && opt.expert)
+ {
+ algo = PUBKEY_ALGO_ECDSA;
+ *r_usage = PUBKEY_USAGE_SIG;
+ break;
+ }
+ else if (algo == 11 && opt.expert)
+ {
+ algo = PUBKEY_ALGO_ECDSA;
+ *r_usage = ask_key_flags (algo, addmode);
+ break;
+ }
+ else if (algo == 12 && opt.expert && addmode)
+ {
+ algo = PUBKEY_ALGO_ECDH;
+ *r_usage = PUBKEY_USAGE_ENC;
+ break;
+ }
else
tty_printf (_("Invalid selection.\n"));
}