aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-05-27 11:47:13 +0000
committerWerner Koch <[email protected]>2020-05-27 11:47:13 +0000
commit21496761226c1020a98e3ec7dd2b9dd013d4386b (patch)
tree342c74782eb55cc8e0cdbd14c1855338941e5ed7
parentcard: Add command "bye" (diff)
downloadgnupg-21496761226c1020a98e3ec7dd2b9dd013d4386b.tar.gz
gnupg-21496761226c1020a98e3ec7dd2b9dd013d4386b.zip
scd:openpgp: New KEY-STATUS attribute.
* scd/app-openpgp.c (do_getattr): Return KEY-STATUS
-rw-r--r--doc/DETAILS8
-rw-r--r--scd/app-openpgp.c11
2 files changed, 18 insertions, 1 deletions
diff --git a/doc/DETAILS b/doc/DETAILS
index a1c53b88e..c22c14b72 100644
--- a/doc/DETAILS
+++ b/doc/DETAILS
@@ -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,
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 6c0c0f6d9..fe4c95a4e 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -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);