[svn] GnuPG - r4918 - in trunk: g10 scd tests/openpgp tests/openpgp/samplekeys
svn author wk
cvs at cvs.gnupg.org
Tue Jan 13 15:01:56 CET 2009
Author: wk
Date: 2009-01-13 15:01:56 +0100 (Tue, 13 Jan 2009)
New Revision: 4918
Added:
trunk/tests/openpgp/samplekeys/
trunk/tests/openpgp/samplekeys/README
trunk/tests/openpgp/samplekeys/no-creation-time.gpg
Modified:
trunk/g10/ChangeLog
trunk/g10/call-agent.c
trunk/g10/call-agent.h
trunk/g10/card-util.c
trunk/scd/command.c
Log:
Add a sample key.
Detect and show the card type.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2009-01-12 10:56:52 UTC (rev 4917)
+++ trunk/g10/ChangeLog 2009-01-13 14:01:56 UTC (rev 4918)
@@ -1,3 +1,10 @@
+2009-01-13 Werner Koch <wk at g10code.com>
+
+ * call-agent.c (dummy_data_cb): New.
+ (agent_learn): Use it.
+ * card-util.c (card_status): Print type of non-OpenPGP card.
+ * call-agent.h (agent_card_info_s): Add field APPTYPE.
+
2009-01-12 Werner Koch <wk at g10code.com>
* getkey.c (finish_lookup): Take care of keys with a zero
Modified: trunk/g10/call-agent.c
===================================================================
--- trunk/g10/call-agent.c 2009-01-12 10:56:52 UTC (rev 4917)
+++ trunk/g10/call-agent.c 2009-01-13 14:01:56 UTC (rev 4918)
@@ -208,6 +208,17 @@
+/* This is a dummy data line callback. */
+static int
+dummy_data_cb (void *opaque, const void *buffer, size_t length)
+{
+ (void)opaque;
+ (void)buffer;
+ (void)length;
+ return 0;
+}
+
+
/* This is the default inquiry callback. It mainly handles the
Pinentry notifications. */
static int
@@ -239,6 +250,7 @@
return;
xfree (info->serialno); info->serialno = NULL;
+ xfree (info->apptype); info->apptype = NULL;
xfree (info->disp_name); info->disp_name = NULL;
xfree (info->disp_lang); info->disp_lang = NULL;
xfree (info->pubkey_url); info->pubkey_url = NULL;
@@ -267,6 +279,11 @@
parm->is_v2 = (strlen (parm->serialno) >= 16
&& xtoi_2 (parm->serialno+12) >= 2 );
}
+ else if (keywordlen == 7 && !memcmp (keyword, "APPTYPE", keywordlen))
+ {
+ xfree (parm->apptype);
+ parm->apptype = unescape_status_string (line);
+ }
else if (keywordlen == 9 && !memcmp (keyword, "DISP-NAME", keywordlen))
{
xfree (parm->disp_name);
@@ -372,7 +389,7 @@
memset (info, 0, sizeof *info);
rc = assuan_transact (agent_ctx, "LEARN --send",
- NULL, NULL, default_inq_cb, NULL,
+ dummy_data_cb, NULL, default_inq_cb, NULL,
learn_status_cb, info);
return rc;
Modified: trunk/g10/call-agent.h
===================================================================
--- trunk/g10/call-agent.h 2009-01-12 10:56:52 UTC (rev 4917)
+++ trunk/g10/call-agent.h 2009-01-13 14:01:56 UTC (rev 4918)
@@ -23,6 +23,7 @@
struct agent_card_info_s
{
int error; /* private. */
+ char *apptype; /* Malloced application type string. */
char *serialno; /* malloced hex string. */
char *disp_name; /* malloced. */
char *disp_lang; /* malloced. */
Modified: trunk/g10/card-util.c
===================================================================
--- trunk/g10/card-util.c 2009-01-12 10:56:52 UTC (rev 4917)
+++ trunk/g10/card-util.c 2009-01-13 14:01:56 UTC (rev 4918)
@@ -369,8 +369,29 @@
if (!info.serialno || strncmp (info.serialno, "D27600012401", 12)
|| strlen (info.serialno) != 32 )
{
- if (opt.with_colons)
- fputs ("unknown:\n", fp);
+ if (info.apptype && !strcmp (info.apptype, "NKS"))
+ {
+ if (opt.with_colons)
+ fputs ("netkey-card:\n", fp);
+ log_info ("this is a NetKey card\n");
+ }
+ else if (info.apptype && !strcmp (info.apptype, "DINSIG"))
+ {
+ if (opt.with_colons)
+ fputs ("dinsig-card:\n", fp);
+ log_info ("this is a DINSIG compliant card\n");
+ }
+ else if (info.apptype && !strcmp (info.apptype, "P15"))
+ {
+ if (opt.with_colons)
+ fputs ("pkcs15-card:\n", fp);
+ log_info ("this is a PKCS#15 compliant card\n");
+ }
+ else
+ {
+ if (opt.with_colons)
+ fputs ("unknown:\n", fp);
+ }
log_info ("not an OpenPGP card\n");
agent_release_card_info (&info);
xfree (pk);
Modified: trunk/scd/command.c
===================================================================
--- trunk/scd/command.c 2009-01-12 10:56:52 UTC (rev 4917)
+++ trunk/scd/command.c 2009-01-13 14:01:56 UTC (rev 4918)
@@ -543,7 +543,8 @@
P15 = PKCS-15 structure used
DINSIG = DIN SIG
OPENPGP = OpenPGP card
-
+ NKS = NetKey card
+
are implemented. These strings are aliases for the AID
S KEYPAIRINFO <hexstring_with_keygrip> <hexstring_with_id>
Added: trunk/tests/openpgp/samplekeys/README
===================================================================
--- trunk/tests/openpgp/samplekeys/README (rev 0)
+++ trunk/tests/openpgp/samplekeys/README 2009-01-13 14:01:56 UTC (rev 4918)
@@ -0,0 +1,4 @@
+
+no-creation-time.gpg A key with a zero creation time.
+
+
Added: trunk/tests/openpgp/samplekeys/no-creation-time.gpg
===================================================================
(Binary files differ)
Property changes on: trunk/tests/openpgp/samplekeys/no-creation-time.gpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the Gnupg-commits
mailing list