aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keyedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/keyedit.c')
-rw-r--r--g10/keyedit.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/g10/keyedit.c b/g10/keyedit.c
index bae79b37e..970a72027 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1201,6 +1201,7 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
int any;
u32 keyid[2], subid[2];
char *hexgrip = NULL;
+ const char *hexgrip2;
char *cache_nonce = NULL;
char *passwd_nonce = NULL;
@@ -1230,7 +1231,6 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
err = hexkeygrip_from_pk (pk, &hexgrip);
if (err)
goto leave;
- /* FIXME: Handle dual keys. */
err = agent_get_keyinfo (ctrl, hexgrip, &serialno, NULL);
if (!err && serialno)
; /* Key on card. */
@@ -1258,7 +1258,7 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
if (node->pkt->pkttype == PKT_PUBLIC_KEY
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
{
- char *desc;
+ char *desc, *p;
pk = node->pkt->pkt.public_key;
keyid_from_pk (pk, subid);
@@ -1267,12 +1267,22 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
err = hexkeygrip_from_pk (pk, &hexgrip);
if (err)
goto leave;
+ if ((p=strchr (hexgrip, ',')))
+ {
+ *p++ = 0;
+ hexgrip2 = p;
+ }
+ else
+ hexgrip2 = NULL;
/* Note that when using --dry-run we don't change the
* passphrase but merely verify the current passphrase. */
desc = gpg_format_keydesc (ctrl, pk, FORMAT_KEYDESC_NORMAL, 1);
err = agent_passwd (ctrl, hexgrip, desc, !!opt.dry_run,
&cache_nonce, &passwd_nonce);
+ if (!err && hexgrip2)
+ err = agent_passwd (ctrl, hexgrip2, desc, !!opt.dry_run,
+ &cache_nonce, &passwd_nonce);
xfree (desc);
if (err)