mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
gpg: Fix "generate" command in --card-edit.
* g10/card-util.c (get_info_for_key_operation): Get the APPTYPE before testing for it. * g10/card-util.c (current_card_status): Always try to update the shadow keys. * g10/call-agent.c (agent_scd_getattr): Handle $AUTHKEYID. -- The first part fixed a regression introduced today. GnuPG-bug-id: 5100 The second part is usually not required because our ssh-agent code anyway looks for the OpenPGP.3 key. However, this helps to put the Display S/N into the shadow key so that we get a better prompt to insert the card.
This commit is contained in:
parent
2d23a72690
commit
914ee72475
@ -1104,6 +1104,9 @@ agent_scd_getattr (const char *name, struct agent_card_info_s *info)
|
|||||||
if (info->fpr2valid)
|
if (info->fpr2valid)
|
||||||
assuan_transact (agent_ctx, "READKEY --card --no-data -- $ENCRKEYID",
|
assuan_transact (agent_ctx, "READKEY --card --no-data -- $ENCRKEYID",
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
if (info->fpr3valid)
|
||||||
|
assuan_transact (agent_ctx, "READKEY --card --no-data -- $AUTHKEYID",
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -378,6 +378,7 @@ current_card_status (ctrl_t ctrl, estream_t fp,
|
|||||||
else
|
else
|
||||||
tty_fprintf (fp, "Application ID ...: %s\n",
|
tty_fprintf (fp, "Application ID ...: %s\n",
|
||||||
info.serialno? info.serialno : "[none]");
|
info.serialno? info.serialno : "[none]");
|
||||||
|
|
||||||
if (!info.serialno || strncmp (info.serialno, "D27600012401", 12)
|
if (!info.serialno || strncmp (info.serialno, "D27600012401", 12)
|
||||||
|| strlen (info.serialno) != 32 )
|
|| strlen (info.serialno) != 32 )
|
||||||
{
|
{
|
||||||
@ -427,6 +428,7 @@ current_card_status (ctrl_t ctrl, estream_t fp,
|
|||||||
xfree (pk);
|
xfree (pk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openpgp:
|
openpgp:
|
||||||
if (!serialno)
|
if (!serialno)
|
||||||
;
|
;
|
||||||
@ -440,6 +442,8 @@ current_card_status (ctrl_t ctrl, estream_t fp,
|
|||||||
else
|
else
|
||||||
tty_fprintf (fp, "Application type .: %s\n", "OpenPGP");
|
tty_fprintf (fp, "Application type .: %s\n", "OpenPGP");
|
||||||
|
|
||||||
|
/* Try to update/create the shadow key here for OpenPGP cards. */
|
||||||
|
agent_update_shadow_keys ();
|
||||||
|
|
||||||
if (opt.with_colons)
|
if (opt.with_colons)
|
||||||
{
|
{
|
||||||
@ -1241,7 +1245,9 @@ get_info_for_key_operation (struct agent_card_info_s *info)
|
|||||||
|
|
||||||
memset (info, 0, sizeof *info);
|
memset (info, 0, sizeof *info);
|
||||||
rc = agent_scd_getattr ("SERIALNO", info);
|
rc = agent_scd_getattr ("SERIALNO", info);
|
||||||
if (rc || !info->apptype || strcmp (info->apptype, "openpgp"))
|
if (!rc)
|
||||||
|
rc = agent_scd_getattr ("APPTYPE", info);
|
||||||
|
if (rc || !info->apptype || ascii_strcasecmp (info->apptype, "openpgp"))
|
||||||
{
|
{
|
||||||
log_error (_("key operation not possible: %s\n"),
|
log_error (_("key operation not possible: %s\n"),
|
||||||
rc ? gpg_strerror (rc) : _("not an OpenPGP card"));
|
rc ? gpg_strerror (rc) : _("not an OpenPGP card"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user