diff --git a/doc/DETAILS b/doc/DETAILS index 883fe039e..2c61d2c97 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -1138,6 +1138,38 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB: *** BEGIN_STREAM, END_STREAM Used to issued by the experimental pipemode. +** Inter-component codes + Status codes are also used between the components of the GnuPG + system via the Assuan S lines. Some of them are documented here: + +*** PUBKEY_INFO + The type of the public key in the following D-lines or + communicated via a pipe. is the value of =enum pubkey_types= + and the Unique Blob ID (UBID) which is the fingerprint of + the primary key truncated to 20 octets and formatted in hex. Note + that the keyboxd SEARCH command can be used to lookup the public + key using the prefixed with a caret (^). + +*** KEYPAIRINFO [] [] + + This status is emitted by scdaemon and gpg-agent to convey brief + information about keypairs stored on tokens. is the + hexified keygrip of the key or, if no key is stored, an "X". + is the ID of a card's key; for example "OPENPGP.2" for + the second key slot of an OpenPGP card. is optional and + returns technically possible key usages, this is a string of + single letters describing the usage ('c' for certify, 'e' for + encryption, 's' for signing, 'a' for authentication). A '-' can be + used to tell that usage flags are not conveyed. is used + 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 [] + + 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 ; spaces are not + escaped. For PKCS#15 cards is TokenInfo.manufactorerID. * Format of the --attribute-fd output diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index fe13f2840..aa80016f6 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -268,6 +268,47 @@ static gpg_error_t change_keyattr_from_string void *pincb_arg, 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"; + } +} @@ -992,6 +1033,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name) { "$SIGNKEYID", 0x0000, -7 }, { "$DISPSERIALNO",0x0000, -4 }, { "KDF", 0x00F9, 5 }, + { "MANUFACTURER", 0x0000, -8 }, { NULL, 0 } }; int idx, i, rc; @@ -1083,6 +1125,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) @@ -1860,6 +1909,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");