mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
* app-openpgp.c (send_fprtime_if_not_null): New.
(do_getattr): Add KEY_TIME. (do_learn_status): Print KEY_TIME. * cardglue.c (learn_status_cb): Parse KEY-TIME. * card-util.c (card_status): Print creation time if available.
This commit is contained in:
parent
1c334577f3
commit
5a37f0deab
@ -1,3 +1,11 @@
|
||||
2004-12-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* app-openpgp.c (send_fprtime_if_not_null): New.
|
||||
(do_getattr): Add KEY_TIME.
|
||||
(do_learn_status): Print KEY_TIME.
|
||||
* cardglue.c (learn_status_cb): Parse KEY-TIME.
|
||||
* card-util.c (card_status): Print creation time if available.
|
||||
|
||||
2004-12-09 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* options.h, g10.c (main), textfilter.c (len_without_trailing_ws):
|
||||
|
@ -79,6 +79,7 @@ static struct {
|
||||
{ 0x00C4, 0, 0x6E, 1, 0, 1, 1, "CHV Status Bytes" },
|
||||
{ 0x00C5, 0, 0x6E, 1, 0, 0, 0, "Fingerprints" },
|
||||
{ 0x00C6, 0, 0x6E, 1, 0, 0, 0, "CA Fingerprints" },
|
||||
{ 0x00CD, 0, 0x6E, 1, 0, 0, 0, "Generation time" },
|
||||
{ 0x007A, 1, 0, 1, 0, 0, 0, "Security Support Template" },
|
||||
{ 0x0093, 0, 0x7A, 1, 1, 0, 0, "Digital Signature Counter" },
|
||||
{ 0x0101, 0, 0, 0, 0, 0, 0, "Private DO 1"},
|
||||
@ -579,6 +580,23 @@ send_fpr_if_not_null (ctrl_t ctrl, const char *keyword,
|
||||
buf, (size_t)strlen (buf), NULL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
send_fprtime_if_not_null (ctrl_t ctrl, const char *keyword,
|
||||
int number, const unsigned char *stamp)
|
||||
{
|
||||
char numbuf1[50], numbuf2[50];
|
||||
unsigned long value;
|
||||
|
||||
value = (stamp[0] << 24) | (stamp[1]<<16) | (stamp[2]<<8) | stamp[3];
|
||||
if (!value)
|
||||
return;
|
||||
sprintf (numbuf1, "%d", number);
|
||||
sprintf (numbuf2, "%lu", value);
|
||||
send_status_info (ctrl, keyword,
|
||||
numbuf1, (size_t)strlen(numbuf1),
|
||||
numbuf2, (size_t)strlen(numbuf2), NULL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
send_key_data (ctrl_t ctrl, const char *name,
|
||||
const unsigned char *a, size_t alen)
|
||||
@ -611,6 +629,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
||||
{ "DISP-SEX", 0x5F35 },
|
||||
{ "PUBKEY-URL", 0x5F50 },
|
||||
{ "KEY-FPR", 0x00C5, 3 },
|
||||
{ "KEY-TIME", 0x00CD, 4 },
|
||||
{ "CA-FPR", 0x00C6, 3 },
|
||||
{ "CHV-STATUS", 0x00C4, 1 },
|
||||
{ "SIG-COUNTER", 0x0093, 2 },
|
||||
@ -694,6 +713,12 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
||||
for (i=0; i < 3; i++)
|
||||
send_fpr_if_not_null (ctrl, table[idx].name, i+1, value+i*20);
|
||||
}
|
||||
else if (table[idx].special == 4)
|
||||
{
|
||||
if (valuelen >= 12)
|
||||
for (i=0; i < 3; i++)
|
||||
send_fprtime_if_not_null (ctrl, table[idx].name, i+1, value+i*4);
|
||||
}
|
||||
else
|
||||
send_status_info (ctrl, table[idx].name, value, valuelen, NULL, 0);
|
||||
|
||||
@ -713,6 +738,8 @@ do_learn_status (app_t app, ctrl_t ctrl)
|
||||
do_getattr (app, ctrl, "PUBKEY-URL");
|
||||
do_getattr (app, ctrl, "LOGIN-DATA");
|
||||
do_getattr (app, ctrl, "KEY-FPR");
|
||||
if (app->card_version > 0x0100)
|
||||
do_getattr (app, ctrl, "KEY-TIME");
|
||||
do_getattr (app, ctrl, "CA-FPR");
|
||||
do_getattr (app, ctrl, "CHV-STATUS");
|
||||
do_getattr (app, ctrl, "SIG-COUNTER");
|
||||
|
@ -356,7 +356,9 @@ card_status (FILE *fp, char *serialno, size_t serialnobuflen)
|
||||
print_sha1_fpr_colon (fp, info.fpr2valid? info.fpr2:NULL);
|
||||
print_sha1_fpr_colon (fp, info.fpr3valid? info.fpr3:NULL);
|
||||
putc ('\n', fp);
|
||||
|
||||
fprintf (fp, "fprtime:%lu:%lu:%lu:\n",
|
||||
(unsigned long)info.fpr1time, (unsigned long)info.fpr2time,
|
||||
(unsigned long)info.fpr3time);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -409,10 +411,19 @@ card_status (FILE *fp, char *serialno, size_t serialnobuflen)
|
||||
tty_fprintf (fp, "Signature counter : %lu\n", info.sig_counter);
|
||||
tty_fprintf (fp, "Signature key ....:");
|
||||
print_sha1_fpr (fp, info.fpr1valid? info.fpr1:NULL);
|
||||
if (info.fpr1valid && info.fpr1time)
|
||||
tty_fprintf (fp, " created ....: %s\n",
|
||||
asctimestamp (info.fpr1time));
|
||||
tty_fprintf (fp, "Encryption key....:");
|
||||
print_sha1_fpr (fp, info.fpr2valid? info.fpr2:NULL);
|
||||
if (info.fpr2valid && info.fpr2time)
|
||||
tty_fprintf (fp, " created ....: %s\n",
|
||||
asctimestamp (info.fpr2time));
|
||||
tty_fprintf (fp, "Authentication key:");
|
||||
print_sha1_fpr (fp, info.fpr3valid? info.fpr3:NULL);
|
||||
if (info.fpr3valid && info.fpr3time)
|
||||
tty_fprintf (fp, " created ....: %s\n",
|
||||
asctimestamp (info.fpr3time));
|
||||
tty_fprintf (fp, "General key info..: ");
|
||||
if (info.fpr1valid && !get_pubkey_byfprint (pk, info.fpr1, 20))
|
||||
print_pubkey_info (fp, pk);
|
||||
|
@ -558,6 +558,20 @@ learn_status_cb (void *opaque, const char *line)
|
||||
else if (no == 3)
|
||||
parm->fpr3valid = unhexify_fpr (line, parm->fpr3);
|
||||
}
|
||||
else if (keywordlen == 8 && !memcmp (keyword, "KEY-TIME", keywordlen))
|
||||
{
|
||||
int no = atoi (line);
|
||||
while (* line && !spacep (line))
|
||||
line++;
|
||||
while (spacep (line))
|
||||
line++;
|
||||
if (no == 1)
|
||||
parm->fpr1time = strtoul (line, NULL, 10);
|
||||
else if (no == 2)
|
||||
parm->fpr2time = strtoul (line, NULL, 10);
|
||||
else if (no == 3)
|
||||
parm->fpr3time = strtoul (line, NULL, 10);
|
||||
}
|
||||
else if (keywordlen == 6 && !memcmp (keyword, "CA-FPR", keywordlen))
|
||||
{
|
||||
int no = atoi (line);
|
||||
|
@ -50,6 +50,9 @@ struct agent_card_info_s {
|
||||
char fpr1[20];
|
||||
char fpr2[20];
|
||||
char fpr3[20];
|
||||
u32 fpr1time;
|
||||
u32 fpr2time;
|
||||
u32 fpr3time;
|
||||
unsigned long sig_counter;
|
||||
int chv1_cached; /* True if a PIN is not required for each
|
||||
signing. Note that the gpg-agent might cache
|
||||
|
Loading…
Reference in New Issue
Block a user