aboutsummaryrefslogtreecommitdiffstats
path: root/common/userids.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-09-27 08:05:07 +0000
committerWerner Koch <[email protected]>2019-09-27 08:05:07 +0000
commit4be79b5abeae82b9840e6aa93874f743e13c6df7 (patch)
tree2d9310b43f277203adcd14858cd593f9b7004bd7 /common/userids.c
parentkbx: First take on a cache for the keyboxd. (diff)
downloadgnupg-4be79b5abeae82b9840e6aa93874f743e13c6df7.tar.gz
gnupg-4be79b5abeae82b9840e6aa93874f743e13c6df7.zip
kbx,gpg: Allow lookup using a UBID.
* common/userids.c (classify_user_id): Detect UBIDs. * kbx/backend-cache.c (blob_table_put): Store the public key type. (be_cache_search): Add search mode for UBIDs. * kbx/backend.h (struct db_request_part_s): Add cache.seqno_ubid. * g10/keydb.c (keydb_search_desc_dump): Fix printing of keygrip. Add ubid printing. * g10/call-keyboxd.c (keydb_search): Support search by UBID. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/userids.c')
-rw-r--r--common/userids.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/userids.c b/common/userids.c
index 55bd85546..eb714a9af 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -65,6 +65,9 @@
* (note that you can't search for these characters). Compare
* is not case sensitive.
* - If the userid starts with a '&' a 40 hex digits keygrip is expected.
+ * - If the userid starts with a '^' followed by 40 hex digits it describes
+ * a Unique-Blob-ID (UBID) which is the hash of keyblob or certificate as
+ * stored in the database. This is used in the IPC of the keyboxd.
*/
gpg_error_t
@@ -251,6 +254,17 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
}
break;
+ case '^': /* UBID */
+ {
+ if (hex2bin (s+1, desc->u.ubid, 20) < 0)
+ {
+ rc = gpg_error (GPG_ERR_INV_USER_ID); /* Invalid. */
+ goto out;
+ }
+ mode = KEYDB_SEARCH_MODE_UBID;
+ }
+ break;
+
default:
if (s[0] == '0' && s[1] == 'x')
{