diff options
author | Werner Koch <wk@gnupg.org> | 2001-11-16 18:56:23 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2001-11-16 18:56:23 +0100 |
commit | 0f26760d9f550fd9aaa7d0c4f18f8571b7818142 (patch) | |
tree | f4c3c0756bdd5df1a9c370947c269fdd997542bb /kbx | |
parent | We have reached a state where we are able to import certs and (diff) | |
download | gnupg2-0f26760d9f550fd9aaa7d0c4f18f8571b7818142.tar.xz gnupg2-0f26760d9f550fd9aaa7d0c4f18f8571b7818142.zip |
Base code for gpgsm --verify does work
Diffstat (limited to 'kbx')
-rw-r--r-- | kbx/keybox-search-desc.h | 1 | ||||
-rw-r--r-- | kbx/keybox-search.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/kbx/keybox-search-desc.h b/kbx/keybox-search-desc.h index 22bcba69b..88ffde8d0 100644 --- a/kbx/keybox-search-desc.h +++ b/kbx/keybox-search-desc.h @@ -42,6 +42,7 @@ typedef enum { KEYDB_SEARCH_MODE_FPR, KEYDB_SEARCH_MODE_ISSUER, KEYDB_SEARCH_MODE_ISSUER_SN, + KEYDB_SEARCH_MODE_SUBJECT, KEYDB_SEARCH_MODE_FIRST, KEYDB_SEARCH_MODE_NEXT } KeydbSearchMode; 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; */ |