summaryrefslogtreecommitdiffstats
path: root/kbx/keybox-search.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-11-16 18:56:23 +0100
committerWerner Koch <wk@gnupg.org>2001-11-16 18:56:23 +0100
commit0f26760d9f550fd9aaa7d0c4f18f8571b7818142 (patch)
treef4c3c0756bdd5df1a9c370947c269fdd997542bb /kbx/keybox-search.c
parentWe have reached a state where we are able to import certs and (diff)
downloadgnupg2-0f26760d9f550fd9aaa7d0c4f18f8571b7818142.tar.xz
gnupg2-0f26760d9f550fd9aaa7d0c4f18f8571b7818142.zip
Base code for gpgsm --verify does work
Diffstat (limited to 'kbx/keybox-search.c')
-rw-r--r--kbx/keybox-search.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kbx/keybox-search.c b/kbx/keybox-search.c
index 3468a8ecf..2a4ceca94 100644
--- a/kbx/keybox-search.c
+++ b/kbx/keybox-search.c
@@ -205,6 +205,20 @@ has_issuer_sn (KEYBOXBLOB blob, const char *name, const unsigned char *sn)
&& blob_cmp_name (blob, 0 /* issuer */, name, namelen));
}
+static int
+has_subject (KEYBOXBLOB blob, const char *name)
+{
+ size_t namelen;
+
+ return_val_if_fail (name, 0);
+
+ if (blob_get_type (blob) != BLOBTYPE_X509)
+ return 0;
+
+ namelen = strlen (name);
+ return blob_cmp_name (blob, 1 /* subject */, name, namelen);
+}
+
/*
@@ -316,6 +330,10 @@ keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc)
if (has_issuer_sn (blob, desc[n].u.name, desc[n].sn))
goto found;
break;
+ case KEYDB_SEARCH_MODE_SUBJECT:
+ if (has_subject (blob, desc[n].u.name))
+ goto found;
+ break;
case KEYDB_SEARCH_MODE_SHORT_KID:
/* if (has_short_kid (blob, desc[n].u.kid[1])) */
/* goto found; */