diff --git a/g10/keyedit.c b/g10/keyedit.c index cfbbed7c9..0553208c3 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1352,7 +1352,7 @@ enum cmdids #endif /*!NO_TRUST_MODELS*/ cmdSHOWPREF, cmdSETPREF, cmdPREFKS, cmdNOTATION, cmdINVCMD, cmdSHOWPHOTO, cmdUPDTRUST, - cmdCHKTRUST, cmdADDCARDKEY, cmdKEYTOCARD, cmdBKUPTOCARD, cmdCHECKBKUPKEY, + cmdCHKTRUST, cmdADDCARDKEY, cmdKEYTOCARD, cmdBKUPTOCARD, cmdCLEAN, cmdMINIMIZE, cmdGRIP, cmdNOP }; @@ -1404,7 +1404,6 @@ static struct N_("move a key to a smartcard")}, { "bkuptocard", cmdBKUPTOCARD, KEYEDIT_NEED_SK | KEYEDIT_ONLY_SK, N_("move a backup key to a smartcard")}, - { "checkbkupkey", cmdCHECKBKUPKEY, KEYEDIT_NEED_SK | KEYEDIT_ONLY_SK, NULL}, #endif /*ENABLE_CARD_SUPPORT */ { "delkey", cmdDELKEY, KEYEDIT_NOT_SK, N_("delete selected subkeys")}, { "addrevoker", cmdADDREVOKER, KEYEDIT_NOT_SK | KEYEDIT_NEED_SK, @@ -1921,7 +1920,6 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr, break; case cmdBKUPTOCARD: - case cmdCHECKBKUPKEY: { /* Ask for a filename, check whether this is really a backup key as generated by the card generation, parse @@ -1982,47 +1980,21 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr, xfree (fname); node = new_kbnode (pkt); - 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)) */ - /* { */ - /* case 0: /\* Not protected. *\/ */ - /* tty_printf (_("This key is not protected.\n")); */ - /* break; */ - /* case -1: */ - /* log_error (_("unknown key protection algorithm\n")); */ - /* break; */ - /* default: */ - /* if (sk->protect.s2k.mode == 1001) */ - /* tty_printf (_("Secret parts of key" */ - /* " are not available.\n")); */ - /* if (sk->protect.s2k.mode == 1002) */ - /* tty_printf (_("Secret parts of key" */ - /* " are stored on-card.\n")); */ - /* else */ - /* check_secret_key (sk, 0); */ - /* } */ - } - else /* Store it. */ + /* Transfer it to gpg-agent which handles secret keys. */ + err = transfer_secret_keys (ctrl, NULL, node, 1); + + /* Treat the pkt as a public key. */ + pkt->pkttype = PKT_PUBLIC_KEY; + + /* Ask gpg-agent to store the secret key to card. */ + if (card_store_subkey (node, 0)) { - /* 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; - } + redisplay = 1; + sec_shadowing = 1; } release_kbnode (node); - } - break; + } + break; #endif /* ENABLE_CARD_SUPPORT */