1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

agent,scd: Scan and load all public keys for availability.

* agent/divert-scd.c (ask_for_card): Scan by SERIALNO command.
* scd/app-openpgp.c (do_with_keygrip): Make sure to load pubkey.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2019-05-16 10:09:41 +09:00
parent 1091f22511
commit dc35b25195
2 changed files with 18 additions and 7 deletions

View file

@ -48,15 +48,22 @@ ask_for_card (ctrl_t ctrl, const unsigned char *shadow_info,
*r_kid = NULL;
bin2hex (grip, 20, hexgrip);
err = agent_card_keyinfo (ctrl, hexgrip, &keyinfo);
/* Scan device(s), and check if key for GRIP is available. */
err = agent_card_serialno (ctrl, &serialno, NULL);
if (!err)
{
agent_card_free_keyinfo (keyinfo);
if ((*r_kid = xtrystrdup (hexgrip)))
return 0;
else
return gpg_error_from_syserror ();
xfree (serialno);
bin2hex (grip, 20, hexgrip);
err = agent_card_keyinfo (ctrl, hexgrip, &keyinfo);
if (!err)
{
/* Key for GRIP found, use it directly. */
agent_card_free_keyinfo (keyinfo);
if ((*r_kid = xtrystrdup (hexgrip)))
return 0;
else
return gpg_error_from_syserror ();
}
}
err = parse_shadow_info (shadow_info, &want_sn, &want_kid, NULL);