2001-11-13 12:50:14 +00:00
|
|
|
/* keybox-search-desc.h - Keybox serch description
|
|
|
|
* Copyright (C) 2001 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 19:49:40 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-11-13 12:50:14 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GnuPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-11-05 12:02:19 +01:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2001-11-13 12:50:14 +00:00
|
|
|
*/
|
|
|
|
|
2011-02-04 12:57:53 +01:00
|
|
|
/*
|
2001-11-13 12:50:14 +00:00
|
|
|
This file is a temporary kludge until we can come up with solution
|
|
|
|
to share this description between keybox and the application
|
|
|
|
specific keydb
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEYBOX_SEARCH_DESC_H
|
|
|
|
#define KEYBOX_SEARCH_DESC_H 1
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
KEYDB_SEARCH_MODE_NONE,
|
|
|
|
KEYDB_SEARCH_MODE_EXACT,
|
|
|
|
KEYDB_SEARCH_MODE_SUBSTR,
|
|
|
|
KEYDB_SEARCH_MODE_MAIL,
|
|
|
|
KEYDB_SEARCH_MODE_MAILSUB,
|
|
|
|
KEYDB_SEARCH_MODE_MAILEND,
|
|
|
|
KEYDB_SEARCH_MODE_WORDS,
|
|
|
|
KEYDB_SEARCH_MODE_SHORT_KID,
|
|
|
|
KEYDB_SEARCH_MODE_LONG_KID,
|
2019-03-14 08:54:59 +01:00
|
|
|
KEYDB_SEARCH_MODE_FPR, /* (Length of fpr in .fprlen) */
|
2001-11-13 12:50:14 +00:00
|
|
|
KEYDB_SEARCH_MODE_ISSUER,
|
|
|
|
KEYDB_SEARCH_MODE_ISSUER_SN,
|
2001-12-11 12:28:17 +00:00
|
|
|
KEYDB_SEARCH_MODE_SN,
|
2001-11-16 17:56:23 +00:00
|
|
|
KEYDB_SEARCH_MODE_SUBJECT,
|
2006-10-20 11:38:48 +00:00
|
|
|
KEYDB_SEARCH_MODE_KEYGRIP,
|
2019-09-27 09:24:58 +02:00
|
|
|
KEYDB_SEARCH_MODE_UBID,
|
2001-11-13 12:50:14 +00:00
|
|
|
KEYDB_SEARCH_MODE_FIRST,
|
|
|
|
KEYDB_SEARCH_MODE_NEXT
|
|
|
|
} KeydbSearchMode;
|
|
|
|
|
2009-12-08 16:30:33 +00:00
|
|
|
|
2019-08-06 16:07:33 +02:00
|
|
|
/* Identifiers for the public key types we use in GnuPG. */
|
|
|
|
enum pubkey_types
|
|
|
|
{
|
|
|
|
PUBKEY_TYPE_UNKNOWN = 0,
|
|
|
|
PUBKEY_TYPE_OPGP = 1,
|
|
|
|
PUBKEY_TYPE_X509 = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-03-14 08:54:59 +01:00
|
|
|
/* Forward declaration. See g10/packet.h. */
|
2009-12-08 16:30:33 +00:00
|
|
|
struct gpg_pkt_user_id_s;
|
|
|
|
typedef struct gpg_pkt_user_id_s *gpg_pkt_user_id_t;
|
|
|
|
|
2019-11-28 09:39:35 +01:00
|
|
|
|
2009-12-08 16:30:33 +00:00
|
|
|
/* A search descriptor. */
|
2011-02-04 12:57:53 +01:00
|
|
|
struct keydb_search_desc
|
2009-12-08 16:30:33 +00:00
|
|
|
{
|
2001-11-13 12:50:14 +00:00
|
|
|
KeydbSearchMode mode;
|
2015-09-14 11:27:43 +02:00
|
|
|
/* Callback used to filter results. The first parameter is
|
|
|
|
SKIPFUNCVALUE. The second is the keyid. The third is the
|
|
|
|
1-based index of the UID packet that matched the search criteria
|
|
|
|
(or 0, if none).
|
|
|
|
|
|
|
|
Return non-zero if the result should be skipped. */
|
|
|
|
int (*skipfnc)(void *, u32 *, int);
|
2001-11-13 12:50:14 +00:00
|
|
|
void *skipfncvalue;
|
2011-02-04 12:57:53 +01:00
|
|
|
const unsigned char *sn;
|
2020-09-08 10:05:08 +02:00
|
|
|
unsigned short snlen;
|
2001-11-13 12:50:14 +00:00
|
|
|
union {
|
|
|
|
const char *name;
|
2018-10-26 12:38:43 +09:00
|
|
|
unsigned char fpr[32];
|
2015-11-16 12:41:46 +01:00
|
|
|
u32 kid[2]; /* Note that this is in native endianness. */
|
2019-11-28 09:39:35 +01:00
|
|
|
unsigned char grip[KEYGRIP_LEN];
|
|
|
|
unsigned char ubid[UBID_LEN];
|
2001-11-13 12:50:14 +00:00
|
|
|
} u;
|
2021-07-08 13:55:18 +02:00
|
|
|
byte name_used;/* The union uses NAME. */
|
2020-09-08 10:05:08 +02:00
|
|
|
byte snhex; /* SN above is a hexstring and not binary. */
|
2019-03-14 08:54:59 +01:00
|
|
|
byte fprlen; /* Only used with KEYDB_SEARCH_MODE_FPR. */
|
2009-12-08 16:30:33 +00:00
|
|
|
int exact; /* Use exactly this key ('!' suffix in gpg). */
|
2001-11-13 12:50:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct keydb_search_desc;
|
|
|
|
typedef struct keydb_search_desc KEYDB_SEARCH_DESC;
|
|
|
|
typedef struct keydb_search_desc KEYBOX_SEARCH_DESC;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /*KEYBOX_SEARCH_DESC_H*/
|