mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-28 22:49:59 +01:00
scd:p15: Fix last commit and improve D-TRUST detection.
* scd/app-p15.c (read_p15_info): Improve D-TRUST card detection. (do_getattr): Fix faulty code for the last commit. Append the product name to MANUFACTURER. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
21e3f750bd
commit
cc5aa68b63
@ -1248,7 +1248,9 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
|
|||||||
This status returns the Manufactorer ID as the unsigned number N.
|
This status returns the Manufactorer ID as the unsigned number N.
|
||||||
For OpenPGP this is well defined; for other cards this is 0. The
|
For OpenPGP this is well defined; for other cards this is 0. The
|
||||||
name of the manufacturer is also given as <string>; spaces are not
|
name of the manufacturer is also given as <string>; spaces are not
|
||||||
escaped. For PKCS#15 cards <string> is TokenInfo.manufactorerID.
|
escaped. For PKCS#15 cards <string> is TokenInfo.manufactorerID;
|
||||||
|
a string in brackets describing GnuPG's own card product name may
|
||||||
|
be appended to <string>.
|
||||||
|
|
||||||
*** KEY-STATUS <keyref> <status>
|
*** KEY-STATUS <keyref> <status>
|
||||||
This is the response from scdaemon on GETATTR KEY-STATUS for
|
This is the response from scdaemon on GETATTR KEY-STATUS for
|
||||||
|
@ -3703,7 +3703,7 @@ read_p15_info (app_t app)
|
|||||||
}
|
}
|
||||||
if (!app->app_local->card_product
|
if (!app->app_local->card_product
|
||||||
&& app->app_local->token_label
|
&& app->app_local->token_label
|
||||||
&& !strcmp (app->app_local->token_label, "D-TRUST Card V3")
|
&& !strncmp (app->app_local->token_label, "D-TRUST Card V3", 15)
|
||||||
&& app->app_local->card_type == CARD_TYPE_CARDOS_50)
|
&& app->app_local->card_type == CARD_TYPE_CARDOS_50)
|
||||||
{
|
{
|
||||||
app->app_local->card_product = CARD_PRODUCT_DTRUST;
|
app->app_local->card_product = CARD_PRODUCT_DTRUST;
|
||||||
@ -4546,6 +4546,8 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *sn;
|
||||||
|
|
||||||
/* We use the first private key object which has a serial
|
/* We use the first private key object which has a serial
|
||||||
* number set. If none was found, we parse the first
|
* number set. If none was found, we parse the first
|
||||||
* object and see whether this has then a serial number. */
|
* object and see whether this has then a serial number. */
|
||||||
@ -4560,11 +4562,12 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
if (!prkdf->serial_number)
|
if (!prkdf->serial_number)
|
||||||
prkdf = NULL;
|
prkdf = NULL;
|
||||||
}
|
}
|
||||||
if (prkdf)
|
sn = get_dispserialno (app, prkdf);
|
||||||
|
/* Unless there is a bogus S/N in the cert, or the product
|
||||||
|
* has a different strategy for the display-s/n, we should
|
||||||
|
* have a suitable one from the cert now. */
|
||||||
|
if (sn)
|
||||||
{
|
{
|
||||||
char *sn = get_dispserialno (app, prkdf);
|
|
||||||
/* Unless there is a bogus S/N in the cert we should
|
|
||||||
* have a suitable one from the cert here now. */
|
|
||||||
err = send_status_printf (ctrl, name, "%s", sn);
|
err = send_status_printf (ctrl, name, "%s", sn);
|
||||||
xfree (sn);
|
xfree (sn);
|
||||||
return err;
|
return err;
|
||||||
@ -4574,7 +4577,13 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
}
|
}
|
||||||
else if (!strcmp (name, "MANUFACTURER"))
|
else if (!strcmp (name, "MANUFACTURER"))
|
||||||
{
|
{
|
||||||
if (app->app_local->manufacturer_id)
|
if (app->app_local->manufacturer_id
|
||||||
|
&& (app->app_local->card_product
|
||||||
|
|| strchr (app->app_local->manufacturer_id, '[')))
|
||||||
|
return send_status_printf (ctrl, "MANUFACTURER", "0 %s [%s]",
|
||||||
|
app->app_local->manufacturer_id,
|
||||||
|
cardproduct2str (app->app_local->card_product));
|
||||||
|
else if (app->app_local->manufacturer_id)
|
||||||
return send_status_printf (ctrl, "MANUFACTURER", "0 %s",
|
return send_status_printf (ctrl, "MANUFACTURER", "0 %s",
|
||||||
app->app_local->manufacturer_id);
|
app->app_local->manufacturer_id);
|
||||||
else
|
else
|
||||||
@ -4902,7 +4911,7 @@ get_dispserialno (app_t app, prkdf_object_t prkdf)
|
|||||||
* prompts) or has any control character. */
|
* prompts) or has any control character. */
|
||||||
if (app->app_local->card_product == CARD_PRODUCT_RSCS)
|
if (app->app_local->card_product == CARD_PRODUCT_RSCS)
|
||||||
{
|
{
|
||||||
/* We use only the rigght 8 hex digits. */
|
/* We use only the right 8 hex digits. */
|
||||||
serial = app_get_serialno (app);
|
serial = app_get_serialno (app);
|
||||||
if (serial && (n=strlen (serial)) > 8)
|
if (serial && (n=strlen (serial)) > 8)
|
||||||
memmove (serial, serial + n - 8, 9);
|
memmove (serial, serial + n - 8, 9);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user