diff --git a/NEWS b/NEWS --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ * Interface changes relative to the 1.15.1 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + gpgme_key_sig_t EXTENDED: New field 'trust_depth'. + gpgme_key_sig_t EXTENDED: New field 'trust_value'. + gpgme_key_sig_t EXTENDED: New field 'trust_regexp'. GPGME_KEYSIGN_FORCE NEW. qt: CryptoConfig::entry CHANGED: Added overload; deprecated old diff --git a/src/gpgme.h.in b/src/gpgme.h.in --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -644,6 +644,15 @@ /* The expiration timestamp, 0 if the subkey does not expire. */ long int expires; + /* The depth of a trust signature, 0 if no trust signature. */ + unsigned char trust_depth; + + /* The trust value of a trust signature, 0 if no trust signature. */ + unsigned char trust_value; + + /* The scope of a trust signature. Might be NULL. */ + char *trust_regexp; + /* Same as in gpgme_signature_t. */ gpgme_error_t status; diff --git a/src/key.c b/src/key.c --- a/src/key.c +++ b/src/key.c @@ -369,6 +369,7 @@ notation = next_notation; } + free (keysig->trust_regexp); free (keysig); keysig = next_keysig; } diff --git a/src/keylist.c b/src/keylist.c --- a/src/keylist.c +++ b/src/keylist.c @@ -967,6 +967,30 @@ 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_regexp, 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]) diff --git a/tests/run-keylist.c b/tests/run-keylist.c --- a/tests/run-keylist.c +++ b/tests/run-keylist.c @@ -369,6 +369,9 @@ printf (" created: %s\n", isotimestr(ks->timestamp)); printf (" expires: %s\n", isotimestr(ks->expires)); printf (" class: %x\n", ks->sig_class); + printf (" trust depth: %u\n", ks->trust_depth); + printf (" trust value: %u\n", ks->trust_value); + printf ("trust regexp: %s\n", nonnull( ks->trust_regexp)); } }