diff options
author | Werner Koch <[email protected]> | 2023-03-15 08:36:36 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2023-03-15 08:42:12 +0000 |
commit | 5118beeec18f731fe3c0084b181eff9531181be6 (patch) | |
tree | ac534cd22f6012cdccffd3d4b4f2f29f7faa26a9 /g10/card-util.c | |
parent | scd,openpgp: Switch key attributes between RSA and ECC in writekey. (diff) | |
download | gnupg-5118beeec18f731fe3c0084b181eff9531181be6.tar.gz gnupg-5118beeec18f731fe3c0084b181eff9531181be6.zip |
gpg: Delete secret key after "keytocard".
* g10/card-util.c (card_store_subkey): Add arg processed_keys.
* g10/keyedit.c (keyedit_menu): Delete secret key.
--
This used to work using the gpg-agent: learn we called at "save" time.
However, the recent change inhibited the creation of a shadow key by
learn if a regular key still exists. Now we do an explicit delete key
at save time. This syncs the behaviour with the description of the
man page.
GnuPG-bug-id: 6378
Diffstat (limited to 'g10/card-util.c')
-rw-r--r-- | g10/card-util.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/g10/card-util.c b/g10/card-util.c index 02de241f2..6451b31e7 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -1781,12 +1781,13 @@ card_generate_subkey (ctrl_t ctrl, kbnode_t pub_keyblock) } -/* Store the key at NODE into the smartcard and modify NODE to - carry the serialno stuff instead of the actual secret key - parameters. USE is the usage for that key; 0 means any - usage. */ +/* Store the key at NODE into the smartcard and modify NODE to carry + the serialno stuff instead of the actual secret key parameters. + USE is the usage for that key; 0 means any usage. If + PROCESSED_KEYS is not NULL it is a poiter to an strlist which will + be filled with the keygrips of successfully stored keys. */ int -card_store_subkey (KBNODE node, int use) +card_store_subkey (KBNODE node, int use, strlist_t *processed_keys) { struct agent_card_info_s info; int okay = 0; @@ -1875,7 +1876,11 @@ card_store_subkey (KBNODE node, int use) if (rc) log_error (_("KEYTOCARD failed: %s\n"), gpg_strerror (rc)); else - okay = 1; + { + okay = 1; + if (processed_keys) + add_to_strlist (processed_keys, hexgrip); + } xfree (hexgrip); leave: |