aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keyedit.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2015-12-24 00:54:23 +0000
committerNIIBE Yutaka <[email protected]>2015-12-24 00:54:23 +0000
commit40959add1ba0efc1f4aa87fa075fa42423eff73c (patch)
tree1ef038237399cd9f1b7dbab6146ad8dbc4e3d8f5 /g10/keyedit.c
parentagent: Support --force option for IMPORT_KEY. (diff)
downloadgnupg-40959add1ba0efc1f4aa87fa075fa42423eff73c.tar.gz
gnupg-40959add1ba0efc1f4aa87fa075fa42423eff73c.zip
g10: fix regression of bkuptocard subcommand in --edit-key.
* g10/keyedit.c (keyedit_menu): Call transfer_secret_keys. * g10/import.c (transfer_secret_keys): Make it global function. Allow stats==NULL. -- GnuPG-bug-id: 2169
Diffstat (limited to 'g10/keyedit.c')
-rw-r--r--g10/keyedit.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/g10/keyedit.c b/g10/keyedit.c
index d958db8f3..15500ef1d 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1922,7 +1922,6 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
case cmdBKUPTOCARD:
case cmdCHECKBKUPKEY:
- log_debug ("FIXME: This needs to be changed\n");
{
/* Ask for a filename, check whether this is really a
backup key as generated by the card generation, parse
@@ -1975,6 +1974,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
if (cmd == cmdCHECKBKUPKEY)
{
+ log_debug ("FIXME: This needs to be changed\n");
/* PKT_public_key *sk = node->pkt->pkt.secret_key; */
/* switch (is_secret_key_protected (sk)) */
/* { */
@@ -1996,14 +1996,21 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
/* } */
}
else /* Store it. */
- {
- if (card_store_subkey (node, 0))
- {
- redisplay = 1;
- sec_shadowing = 1;
- }
- }
- release_kbnode (node);
+ {
+ /* We need to transfer it to gpg-agent. */
+ err = transfer_secret_keys (ctrl, NULL, node, 1);
+
+ /* Then, treat the pkt as a public key to call
+ card_store_subkey. */
+ pkt->pkttype = PKT_PUBLIC_KEY;
+
+ if (card_store_subkey (node, 0))
+ {
+ redisplay = 1;
+ sec_shadowing = 1;
+ }
+ }
+ release_kbnode (node);
}
break;