gnupg/g10 (ChangeLog app-openpgp.c card-util.c cardglue.c
cardglue.h)
cvs user wk
cvs at cvs.gnupg.org
Fri Dec 10 11:40:53 CET 2004
Date: Friday, December 10, 2004 @ 11:49:14
Author: wk
Path: /cvs/gnupg/gnupg/g10
Modified: ChangeLog app-openpgp.c card-util.c cardglue.c cardglue.h
* 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.
---------------+
ChangeLog | 8 ++++++++
app-openpgp.c | 31 +++++++++++++++++++++++++++++--
card-util.c | 13 ++++++++++++-
cardglue.c | 14 ++++++++++++++
cardglue.h | 3 +++
5 files changed, 66 insertions(+), 3 deletions(-)
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.650 gnupg/g10/ChangeLog:1.651
--- gnupg/g10/ChangeLog:1.650 Fri Dec 10 06:35:54 2004
+++ gnupg/g10/ChangeLog Fri Dec 10 11:49:14 2004
@@ -1,3 +1,11 @@
+2004-12-10 Werner Koch <wk at 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 at jabberwocky.com>
* options.h, g10.c (main), textfilter.c (len_without_trailing_ws):
Index: gnupg/g10/app-openpgp.c
diff -u gnupg/g10/app-openpgp.c:1.21 gnupg/g10/app-openpgp.c:1.22
--- gnupg/g10/app-openpgp.c:1.21 Thu Dec 9 17:57:30 2004
+++ gnupg/g10/app-openpgp.c Fri Dec 10 11:49:14 2004
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: app-openpgp.c,v 1.21 2004/12/09 16:57:30 wk Exp $
+ * $Id: app-openpgp.c,v 1.22 2004/12/10 10:49:14 wk Exp $
*/
#include <config.h>
@@ -79,6 +79,7 @@
{ 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"},
@@ -580,6 +581,23 @@
}
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,8 +629,9 @@
{ "DISP-SEX", 0x5F35 },
{ "PUBKEY-URL", 0x5F50 },
{ "KEY-FPR", 0x00C5, 3 },
+ { "KEY-TIME", 0x00CD, 4 },
{ "CA-FPR", 0x00C6, 3 },
- { "CHV-STATUS", 0x00C4, 1 },
+ { "CHV-STATUS", 0x00C4, 1 },
{ "SIG-COUNTER", 0x0093, 2 },
{ "SERIALNO", 0x004F, -1 },
{ "AID", 0x004F },
@@ -694,6 +713,12 @@
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_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");
Index: gnupg/g10/card-util.c
diff -u gnupg/g10/card-util.c:1.22 gnupg/g10/card-util.c:1.23
--- gnupg/g10/card-util.c:1.22 Thu Dec 9 17:57:30 2004
+++ gnupg/g10/card-util.c Fri Dec 10 11:49:14 2004
@@ -356,7 +356,9 @@
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 @@
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);
Index: gnupg/g10/cardglue.c
diff -u gnupg/g10/cardglue.c:1.20 gnupg/g10/cardglue.c:1.21
--- gnupg/g10/cardglue.c:1.20 Thu Dec 9 17:57:30 2004
+++ gnupg/g10/cardglue.c Fri Dec 10 11:49:14 2004
@@ -558,6 +558,20 @@
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);
Index: gnupg/g10/cardglue.h
diff -u gnupg/g10/cardglue.h:1.12 gnupg/g10/cardglue.h:1.13
--- gnupg/g10/cardglue.h:1.12 Thu Dec 9 17:57:30 2004
+++ gnupg/g10/cardglue.h Fri Dec 10 11:49:14 2004
@@ -50,6 +50,9 @@
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
More information about the Gnupg-commits
mailing list