1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

scd:openpgp: New attribute "MANUFACTURER".

* scd/app-openpgp.c (get_manufacturer): New..
(do_getattr): Add new attribute "MANUFACTURER".
(do_learn_status): Always print it.
--

This will make it easy to maintain the list of OpenPGP vendors at just
one place.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-04-03 09:56:56 +02:00
parent ba247a114c
commit 541a6a903e
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 57 additions and 0 deletions

View File

@ -1158,6 +1158,7 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
key using the <ubid> prefixed with a caret (^).
*** KEYPAIRINFO <grip> <keyref> [<usage>] [<keytime>]
This status is emitted by scdaemon and gpg-agent to convey brief
information about keypairs stored on tokens. <grip> is the
hexified keygrip of the key or, if no key is stored, an "X".
@ -1170,6 +1171,12 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
by OpenPGP cards for the stored key creation time. A '-' means no
info available. The format is the usual ISO string are a number
with the seconds since Epoch.
*** MANUFACTORER <n> [<string>]
This status returns the Manufactorer ID as the unsigned number N.
For OpenPGP this is weel defined; for other cards this is 0. The
name of the manufacturer is also given as <string>; spaces are not
escaped. For PKCS#15 cards <string> is TokenInfo.manufactorerID.
* Format of the --attribute-fd output

View File

@ -280,6 +280,47 @@ static gpg_error_t change_keyattr_from_string
const char *keyref, const char *keyalgo,
const void *value, size_t valuelen);
/* Return the OpenPGP card manufacturer name. */
static const char *
get_manufacturer (unsigned int no)
{
/* Note: Make sure that there is no colon or linefeed in the string. */
switch (no)
{
case 0x0001: return "PPC Card Systems";
case 0x0002: return "Prism";
case 0x0003: return "OpenFortress";
case 0x0004: return "Wewid";
case 0x0005: return "ZeitControl";
case 0x0006: return "Yubico";
case 0x0007: return "OpenKMS";
case 0x0008: return "LogoEmail";
case 0x0009: return "Fidesmo";
case 0x000A: return "Dangerous Things";
case 0x000B: return "Feitian Technologies";
case 0x002A: return "Magrathea";
case 0x0042: return "GnuPG e.V.";
case 0x1337: return "Warsaw Hackerspace";
case 0x2342: return "warpzone"; /* hackerspace Muenster. */
case 0x4354: return "Confidential Technologies"; /* cotech.de */
case 0x5443: return "TIF-IT e.V.";
case 0x63AF: return "Trustica";
case 0xBA53: return "c-base e.V.";
case 0xBD0E: return "Paranoidlabs";
case 0xF517: return "FSIJ";
case 0xF5EC: return "F-Secure";
/* 0x0000 and 0xFFFF are defined as test cards per spec,
* 0xFF00 to 0xFFFE are assigned for use with randomly created
* serial numbers. */
case 0x0000:
case 0xffff: return "test card";
default: return (no & 0xff00) == 0xff00? "unmanaged S/N range":"unknown";
}
}
@ -1040,6 +1081,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
{ "UIF-2", 0x00D7, 0 },
{ "UIF-3", 0x00D8, 0 },
{ "KDF", 0x00F9, 5 },
{ "MANUFACTURER", 0x0000, -8 },
{ NULL, 0 }
};
int idx, i, rc;
@ -1131,6 +1173,13 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0);
return 0;
}
if (table[idx].special == -8)
{
return send_status_printf
(ctrl, table[idx].name, "%u %s",
app->app_local->manufacturer,
get_manufacturer (app->app_local->manufacturer));
}
relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &rc);
if (relptr)
@ -1938,6 +1987,7 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
(void)flags;
do_getattr (app, ctrl, "EXTCAP");
do_getattr (app, ctrl, "MANUFACTURER");
do_getattr (app, ctrl, "DISP-NAME");
do_getattr (app, ctrl, "DISP-LANG");
do_getattr (app, ctrl, "DISP-SEX");