aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgme.h.in
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-05-21 08:29:49 +0000
committerWerner Koch <[email protected]>2016-05-21 08:32:51 +0000
commit10df06ee8f9192309bf124872438f7c32457e1c6 (patch)
treefa06a7511fea47cf784f9ac0e003bf04ecb0c27c /src/gpgme.h.in
parentapi: Add new context flag "raw-description". (diff)
downloadgpgme-10df06ee8f9192309bf124872438f7c32457e1c6.tar.gz
gpgme-10df06ee8f9192309bf124872438f7c32457e1c6.zip
api: Return Tofu info for signatures.
* src/gpgme.h.in (gpgme_tofu_policy_t): New. (gpgme_status_code_t): Add status codes for TOFU. (struct _gpgme_tofu_info, gpgme_tofu_info_t): New. (struct _gpgme_signature): Add field 'tofu'. * src/status-table.c (status_table): Add new codes. * src/verify.c: Include limits.h. (release_tofu_info): New. (release_op_data): Call that. (parse_tofu_user): New. (parse_tofu_stats): New. (parse_tofu_stats_long): New. (_gpgme_verify_status_handler): Handle TOFU status lines. * tests/run-verify.c (print_description): New. (print_result): print tofu info. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/gpgme.h.in')
-rw-r--r--src/gpgme.h.in61
1 files changed, 60 insertions, 1 deletions
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 5f7896de..335ed6b5 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -371,6 +371,19 @@ typedef enum
gpgme_validity_t;
+/* The TOFU policies. */
+typedef enum
+ {
+ GPGME_TOFU_POLICY_NONE = 0,
+ GPGME_TOFU_POLICY_AUTO = 1,
+ GPGME_TOFU_POLICY_GOOD = 2,
+ GPGME_TOFU_POLICY_UNKNOWN = 3,
+ GPGME_TOFU_POLICY_BAD = 4,
+ GPGME_TOFU_POLICY_ASK = 5
+ }
+gpgme_tofu_policy_t;
+
+
/* The available protocols. */
typedef enum
{
@@ -533,7 +546,10 @@ typedef enum
GPGME_STATUS_KEY_NOT_CREATED = 91,
GPGME_STATUS_INQUIRE_MAXLEN = 92,
GPGME_STATUS_FAILURE = 93,
- GPGME_STATUS_KEY_CONSIDERED = 94
+ GPGME_STATUS_KEY_CONSIDERED = 94,
+ GPGME_STATUS_TOFU_USER = 95,
+ GPGME_STATUS_TOFU_STATS = 96,
+ GPGME_STATUS_TOFU_STATS_LONG = 97
}
gpgme_status_code_t;
@@ -1533,6 +1549,46 @@ typedef enum
}
gpgme_sigsum_t;
+
+struct _gpgme_tofu_info
+{
+ struct _gpgme_tofu_info *next;
+
+ /* The mail address (addr-spec from RFC5322) of the tofu binding. */
+ char *address;
+
+ /* The fingerprint of the primary key. */
+ char *fpr;
+
+ /* The TOFU validity:
+ * 0 := conflict
+ * 1 := key without history
+ * 2 := key with too little history
+ * 3 := key with enough history for basic trust
+ * 4 := key with a lot of history
+ */
+ unsigned int validity : 3;
+
+ /* The TOFU policy (gpgme_tofu_policy_t). */
+ unsigned int policy : 4;
+
+ unsigned int _rfu : 25;
+
+ /* Number of signatures seen for this binding. Capped at USHRT_MAX. */
+ unsigned short signcount;
+ unsigned short reserved;
+
+ /* Number of seconds since the first and the most recently seen
+ * message was verified. */
+ unsigned int firstseen;
+ unsigned int lastseen;
+
+ /* If non-NULL a human readable string summarizing the TOFU data. */
+ char *description;
+};
+typedef struct _gpgme_tofu_info *gpgme_tofu_info_t;
+
+
struct _gpgme_signature
{
struct _gpgme_signature *next;
@@ -1578,6 +1634,9 @@ struct _gpgme_signature
/* The mailbox from the PKA information or NULL. */
char *pka_address;
+
+ /* If non-NULL, TOFU info for this signature are available. */
+ gpgme_tofu_info_t tofu;
};
typedef struct _gpgme_signature *gpgme_signature_t;