From 276187f6b62a73e92b1c20f589510f80ab9e88d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 4 May 2021 18:35:29 +0200 Subject: core: Extend gpgme_key_sig_t with trust signature members. * src/gpgme.h.in (struct _gpgme_key_sig): Add fields 'trust_depth', 'trust_value', and 'trust_scope'. * src/key.c (gpgme_key_unref): Free trust_scope. * src/keylist.c (keylist_colon_handler): Set the fields. * tests/run-keylist.c (main): Print the fields. -- The trust signature values are part of gpg's output since the year 2003. This now adds support to gpgme. GnuPG-bug-id: 5245, 5419 --- src/keylist.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/keylist.c') diff --git a/src/keylist.c b/src/keylist.c index a4de3ad5..42743f07 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -967,6 +967,30 @@ keylist_colon_handler (void *priv, char *line) if (fields >= 7) keysig->expires = _gpgme_parse_timestamp (field[6], NULL); + /* Field 8 has the trust depth and the trust value. */ + if (fields >= 8 && *field[7]) + { + const char *trust_depth = field[7]; + char *trust_value = strchr (field[7] + 1, ' '); + if (trust_value) + *(trust_value++) = '\0'; + if (trust_value) + { + int depth = atoi (trust_depth); + int value = atoi (trust_value); + + if (depth >= 1 && depth < 256) + keysig->trust_depth = depth; + if (value >= 1 && value < 256) + keysig->trust_value = value; + } + } + + /* Field 9 has the trust signature scope (a regular expression). */ + if (fields >= 9) + if (_gpgme_decode_c_string (field[8], &keysig->trust_scope, 0)) + return gpg_error (GPG_ERR_ENOMEM); /* FIXME */ + /* Field 11 has the signature class (eg, 0x30 means revoked). */ if (fields >= 11) if (field[10][0] && field[10][1]) -- cgit v1.2.3