Page MenuHome GnuPG

Fallback for keys with keyid but no finterprint value in gpgme
ActivePublic

Authored by aheinecke on May 19 2021, 1:19 PM.
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index b893a7cd..9d9f4615 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -292,10 +292,14 @@ const char *Key::primaryFingerprint() const
/* Return what gpgme thinks is the primary fingerprint */
return key->fpr;
}
- if (key->subkeys) {
+ if (key->subkeys && key->subkeys->fpr) {
/* Return the first subkeys fingerprint */
return key->subkeys->fpr;
}
+ if (key->subkeys && key->subkeys->keyid) {
+ /* When no fingerprint is available use the first subkeys keyid */
+ return key->subkeys->keyid;
+ }
return nullptr;
}