summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-gpg-verify-result.c
diff options
context:
space:
mode:
authorRobert McQueen <rob@endlessm.com>2017-07-30 17:44:35 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-07-31 14:37:09 +0000
commite8a9172daad5f27ba5805fd4e4abba1b419dffc0 (patch)
treeb7f9db6fa86424cafc49c10d447b99c8210b0a7b /src/libostree/ostree-gpg-verify-result.c
parent156cf23576df15cfd06d8138f7fc4443bfee5058 (diff)
downloadostree-e8a9172daad5f27ba5805fd4e4abba1b419dffc0.tar.gz
gpg-verify-result: try to display the primary key ID from signatures
The fingerprint associated with each signature can be different to the primary key ID (the normal one that people use to identify a GPG key) if the signature is from a signing subkey. Try to find the primary key and print this ID in preference to the subkey signature. https://github.com/ostreedev/ostree/issues/608 Closes: #1036 Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-gpg-verify-result.c')
-rw-r--r--src/libostree/ostree-gpg-verify-result.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libostree/ostree-gpg-verify-result.c b/src/libostree/ostree-gpg-verify-result.c
index 059b3d56..7cee6c28 100644
--- a/src/libostree/ostree-gpg-verify-result.c
+++ b/src/libostree/ostree-gpg-verify-result.c
@@ -334,7 +334,8 @@ ostree_gpg_verify_result_get (OstreeGpgVerifyResult *result,
* (OSTREE_GPG_SIGNATURE_ATTR_KEY_MISSING). */
for (ii = 0; ii < n_attrs; ii++)
{
- if (attrs[ii] == OSTREE_GPG_SIGNATURE_ATTR_USER_NAME ||
+ if (attrs[ii] == OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT ||
+ attrs[ii] == OSTREE_GPG_SIGNATURE_ATTR_USER_NAME ||
attrs[ii] == OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL)
{
(void) gpgme_get_key (result->context, signature->fpr, &key, 0);
@@ -378,7 +379,11 @@ ostree_gpg_verify_result_get (OstreeGpgVerifyResult *result,
break;
case OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT:
- child = g_variant_new_string (signature->fpr);
+ if (key != NULL && key->subkeys != NULL)
+ v_string = key->subkeys->fpr;
+ else
+ v_string = signature->fpr;
+ child = g_variant_new_string (v_string);
break;
case OSTREE_GPG_SIGNATURE_ATTR_TIMESTAMP: