mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
gpg: Prepare card code to allow other than OpenPGP cards.
* g10/call-agent.c (start_agent): Use card app auto selection. * g10/card-util.c (current_card_status): Print the Application type. (card_status): Put empty line between card listings. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit e47524c34a2a9f53c2507f67a0b41b460cee78b7)
This commit is contained in:
parent
768cb6402f
commit
fe5c8de862
@ -336,7 +336,7 @@ start_agent (ctrl_t ctrl, int flag_for_card)
|
||||
if (!(flag_for_card & FLAG_FOR_CARD_SUPPRESS_ERRORS))
|
||||
rc = warn_version_mismatch (agent_ctx, SCDAEMON_NAME, 2);
|
||||
if (!rc)
|
||||
rc = assuan_transact (agent_ctx, "SCD SERIALNO openpgp",
|
||||
rc = assuan_transact (agent_ctx, "SCD SERIALNO",
|
||||
NULL, NULL, NULL, NULL,
|
||||
learn_status_cb, &info);
|
||||
if (rc && !(flag_for_card & FLAG_FOR_CARD_SUPPRESS_ERRORS))
|
||||
|
@ -416,36 +416,43 @@ current_card_status (ctrl_t ctrl, estream_t fp,
|
||||
if (!info.serialno || strncmp (info.serialno, "D27600012401", 12)
|
||||
|| strlen (info.serialno) != 32 )
|
||||
{
|
||||
const char *name1, *name2;
|
||||
if (info.apptype && !strcmp (info.apptype, "NKS"))
|
||||
{
|
||||
if (opt.with_colons)
|
||||
es_fputs ("netkey-card:\n", fp);
|
||||
log_info ("this is a NetKey card\n");
|
||||
name1 = "netkey";
|
||||
name2 = "NetKey";
|
||||
}
|
||||
else if (info.apptype && !strcmp (info.apptype, "DINSIG"))
|
||||
{
|
||||
if (opt.with_colons)
|
||||
es_fputs ("dinsig-card:\n", fp);
|
||||
log_info ("this is a DINSIG compliant card\n");
|
||||
name1 = "dinsig";
|
||||
name2 = "DINSIG";
|
||||
}
|
||||
else if (info.apptype && !strcmp (info.apptype, "P15"))
|
||||
{
|
||||
if (opt.with_colons)
|
||||
es_fputs ("pkcs15-card:\n", fp);
|
||||
log_info ("this is a PKCS#15 compliant card\n");
|
||||
name1 = "pkcs15";
|
||||
name2 = "PKCS#15";
|
||||
}
|
||||
else if (info.apptype && !strcmp (info.apptype, "GELDKARTE"))
|
||||
{
|
||||
if (opt.with_colons)
|
||||
es_fputs ("geldkarte-card:\n", fp);
|
||||
log_info ("this is a Geldkarte compliant card\n");
|
||||
name1 = "geldkarte";
|
||||
name2 = "Geldkarte";
|
||||
}
|
||||
else if (info.apptype && !strcmp (info.apptype, "PIV"))
|
||||
{
|
||||
name1 = "piv";
|
||||
name2 = "PIV";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opt.with_colons)
|
||||
es_fputs ("unknown:\n", fp);
|
||||
name1 = "unknown";
|
||||
name2 = "Unknown";
|
||||
}
|
||||
log_info ("not an OpenPGP card\n");
|
||||
|
||||
if (opt.with_colons)
|
||||
es_fprintf (fp, "%s-card:\n", name1);
|
||||
else
|
||||
tty_fprintf (fp, "Application type .: %s\n", name2);
|
||||
|
||||
agent_release_card_info (&info);
|
||||
xfree (pk);
|
||||
return;
|
||||
@ -460,6 +467,8 @@ current_card_status (ctrl_t ctrl, estream_t fp,
|
||||
|
||||
if (opt.with_colons)
|
||||
es_fputs ("openpgp-card:\n", fp);
|
||||
else
|
||||
tty_fprintf (fp, "Application type .: %s\n", "OpenPGP");
|
||||
|
||||
|
||||
if (opt.with_colons)
|
||||
@ -693,6 +702,7 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
|
||||
strlist_t card_list, sl;
|
||||
char *serialno0, *serialno1;
|
||||
int all_cards = 0;
|
||||
int any_card = 0;
|
||||
|
||||
if (serialno == NULL)
|
||||
{
|
||||
@ -720,6 +730,10 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
|
||||
if (!all_cards && strcmp (serialno, sl->d))
|
||||
continue;
|
||||
|
||||
if (any_card && !opt.with_colons)
|
||||
tty_fprintf (fp, "\n");
|
||||
any_card = 1;
|
||||
|
||||
err = agent_scd_serialno (&serialno1, sl->d);
|
||||
if (err)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user