1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-10-31 20:08:43 +01:00

scd:openpgp: New KEY-STATUS attribute.

* scd/app-openpgp.c (do_getattr): Return KEY-STATUS
This commit is contained in:
Werner Koch 2020-05-27 13:47:13 +02:00
parent 08310849a2
commit 2149676122
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 18 additions and 1 deletions

View File

@ -1178,6 +1178,14 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
name of the manufacturer is also given as <string>; spaces are not
escaped. For PKCS#15 cards <string> is TokenInfo.manufactorerID.
*** KEY-STATUS <keyref> <status>
This is the response from scdaemon on GETATTR KEY-STATUS for
OpenPGP cards. <keyref> is the usual keyref (e.g. OPENPGP.1 or
OPENPGP.129) and <status> is an integer describing the status of
the key: 0 = key is not present, 1 = key generated on card, 2 =
key imported. See section 4.4.3.8 of the OpenPGP Smart Card
Application V3.4.
* Format of the --attribute-fd output
When --attribute-fd is set, during key listings (--list-keys,

View File

@ -1080,9 +1080,10 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
{ "UIF-1", 0x00D6, 0 },
{ "UIF-2", 0x00D7, 0 },
{ "UIF-3", 0x00D8, 0 },
{ "UIF", 0x0000, -9 }, /* Shortcut for all UIF */
{ "KDF", 0x00F9, 5 },
{ "MANUFACTURER", 0x0000, -8 },
{ "UIF", 0x0000, -9 }, /* Shortcut for all UIF */
{ "KEY-STATUS", 0x00DE, 6 },
{ NULL, 0 }
};
int idx, i, rc;
@ -1234,6 +1235,14 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
send_status_info (ctrl, table[idx].name, value, valuelen, NULL, 0);
}
else if (table[idx].special == 6)
{
for (i=0,rc=0; !rc && i+1 < valuelen; i += 2)
rc = send_status_printf (ctrl, table[idx].name, "OPENPGP.%u %u",
value[i], value[i+1]);
if (gpg_err_code (rc) == GPG_ERR_NO_OBJ)
rc = gpg_error (GPG_ERR_NOT_SUPPORTED);
}
else
send_status_info (ctrl, table[idx].name, value, valuelen, NULL, 0);