mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Add a sample key.
Detect and show the card type.
This commit is contained in:
parent
367281480a
commit
38251aa74f
@ -1,3 +1,10 @@
|
||||
2009-01-13 Werner Koch <wk@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@g10code.com>
|
||||
|
||||
* getkey.c (finish_lookup): Take care of keys with a zero
|
||||
|
@ -208,6 +208,17 @@ store_serialno (const char *line)
|
||||
|
||||
|
||||
|
||||
/* 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 @@ agent_release_card_info (struct agent_card_info_s *info)
|
||||
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 @@ learn_status_cb (void *opaque, const char *line)
|
||||
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 @@ agent_learn (struct agent_card_info_s *info)
|
||||
|
||||
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;
|
||||
|
@ -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. */
|
||||
|
@ -368,9 +368,30 @@ card_status (FILE *fp, char *serialno, size_t serialnobuflen)
|
||||
info.serialno? info.serialno : "[none]");
|
||||
if (!info.serialno || strncmp (info.serialno, "D27600012401", 12)
|
||||
|| strlen (info.serialno) != 32 )
|
||||
{
|
||||
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);
|
||||
|
@ -543,6 +543,7 @@ cmd_serialno (assuan_context_t ctx, char *line)
|
||||
P15 = PKCS-15 structure used
|
||||
DINSIG = DIN SIG
|
||||
OPENPGP = OpenPGP card
|
||||
NKS = NetKey card
|
||||
|
||||
are implemented. These strings are aliases for the AID
|
||||
|
||||
|
4
tests/openpgp/samplekeys/README
Normal file
4
tests/openpgp/samplekeys/README
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
no-creation-time.gpg A key with a zero creation time.
|
||||
|
||||
|
BIN
tests/openpgp/samplekeys/no-creation-time.gpg
Normal file
BIN
tests/openpgp/samplekeys/no-creation-time.gpg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user