mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-11 22:01:08 +02:00
card: Allow listing of NKS cards.
* tools/card-call-scd.c (learn_status_cb): Always fill chvinfo. * tools/gpg-card.h (struct card_info_s): Increase size of chvinfo and chvmaxlen. * tools/gpg-card.c (list_nks): New. (print_a_version): Support single part version numbers. (list_card): Call list_nks. -- Note that chvmaxlen is not yet used with NKS. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
1f6a39092f
commit
9496634745
@ -913,7 +913,7 @@ learn_status_cb (void *opaque, const char *line)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (parm->apptype == APP_TYPE_PIV)
|
else
|
||||||
{
|
{
|
||||||
for (i=0; *p && i < DIM (parm->chvinfo); i++)
|
for (i=0; *p && i < DIM (parm->chvinfo); i++)
|
||||||
{
|
{
|
||||||
|
@ -916,6 +916,41 @@ list_piv (card_info_t info, estream_t fp, int no_key_lookup)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* List Netkey card specific data. */
|
||||||
|
static void
|
||||||
|
list_nks (card_info_t info, estream_t fp, int no_key_lookup)
|
||||||
|
{
|
||||||
|
static struct keyinfolabel_s keyinfolabels[] = {
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
const char *s;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
tty_fprintf (fp, "PIN retry counter :");
|
||||||
|
for (i=0; i < DIM (info->chvinfo); i++)
|
||||||
|
{
|
||||||
|
if (info->chvinfo[i] >= 0)
|
||||||
|
tty_fprintf (fp, " %d", info->chvinfo[i]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (info->chvinfo[i])
|
||||||
|
{
|
||||||
|
case -1: s = "[error]"; break;
|
||||||
|
case -2: s = "-"; break; /* No such PIN or info not available. */
|
||||||
|
case -3: s = "[blocked]"; break;
|
||||||
|
case -4: s = "[nullpin]"; break;
|
||||||
|
case -5: s = "[verified]"; break;
|
||||||
|
default: s = "[?]"; break;
|
||||||
|
}
|
||||||
|
tty_fprintf (fp, " %s", s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tty_fprintf (fp, "\n");
|
||||||
|
list_all_kinfo (info, keyinfolabels, fp, no_key_lookup);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_a_version (estream_t fp, const char *prefix, unsigned int value)
|
print_a_version (estream_t fp, const char *prefix, unsigned int value)
|
||||||
{
|
{
|
||||||
@ -929,8 +964,10 @@ print_a_version (estream_t fp, const char *prefix, unsigned int value)
|
|||||||
tty_fprintf (fp, "%s %u.%u.%u.%u\n", prefix, a, b, c, d);
|
tty_fprintf (fp, "%s %u.%u.%u.%u\n", prefix, a, b, c, d);
|
||||||
else if (b)
|
else if (b)
|
||||||
tty_fprintf (fp, "%s %u.%u.%u\n", prefix, b, c, d);
|
tty_fprintf (fp, "%s %u.%u.%u\n", prefix, b, c, d);
|
||||||
else
|
else if (c)
|
||||||
tty_fprintf (fp, "%s %u.%u\n", prefix, c, d);
|
tty_fprintf (fp, "%s %u.%u\n", prefix, c, d);
|
||||||
|
else
|
||||||
|
tty_fprintf (fp, "%s %u\n", prefix, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -974,6 +1011,7 @@ list_card (card_info_t info, int no_key_lookup)
|
|||||||
{
|
{
|
||||||
case APP_TYPE_OPENPGP: list_openpgp (info, fp, no_key_lookup); break;
|
case APP_TYPE_OPENPGP: list_openpgp (info, fp, no_key_lookup); break;
|
||||||
case APP_TYPE_PIV: list_piv (info, fp, no_key_lookup); break;
|
case APP_TYPE_PIV: list_piv (info, fp, no_key_lookup); break;
|
||||||
|
case APP_TYPE_NKS: list_nks (info, fp, no_key_lookup); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ struct card_info_s
|
|||||||
required for each signing. Note that the
|
required for each signing. Note that the
|
||||||
gpg-agent might cache it anyway. */
|
gpg-agent might cache it anyway. */
|
||||||
int is_v2; /* True if this is a v2 openpgp card. */
|
int is_v2; /* True if this is a v2 openpgp card. */
|
||||||
int chvmaxlen[3]; /* Maximum allowed length of a CHV. */
|
int chvmaxlen[4]; /* Maximum allowed length of a CHV. */
|
||||||
int chvinfo[3]; /* Allowed retries for the CHV; 0 = blocked. */
|
int chvinfo[4]; /* Allowed retries for the CHV; 0 = blocked. */
|
||||||
unsigned char chvusage[2]; /* Data object 5F2F */
|
unsigned char chvusage[2]; /* Data object 5F2F */
|
||||||
struct {
|
struct {
|
||||||
unsigned int ki:1; /* Key import available. */
|
unsigned int ki:1; /* Key import available. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user