aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src/key.cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2016-08-24 11:57:49 +0000
committerAndre Heinecke <[email protected]>2016-08-24 11:57:49 +0000
commit40ea1c85773cbe324557c34b3a4282f609fcdaf6 (patch)
tree7b63671f5dbdbcc7e32c9d5a66b52566ef6f6ce2 /lang/cpp/src/key.cpp
parentCpp: Move tofuinfo from signature to userid (diff)
downloadgpgme-40ea1c85773cbe324557c34b3a4282f609fcdaf6.tar.gz
gpgme-40ea1c85773cbe324557c34b3a4282f609fcdaf6.zip
Cpp: Use fpr field for primaryFingerprint
* lang/cpp/src/key.cpp (Key::primaryFingerprint): Return fpr value if available. -- Should not be necessary but we might have an incomplete key without subkeys but the fingerprint already set in gpgme's data type.
Diffstat (limited to 'lang/cpp/src/key.cpp')
-rw-r--r--lang/cpp/src/key.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 68d7685f..6f40f666 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -259,11 +259,16 @@ const char *Key::shortKeyID() const
const char *Key::primaryFingerprint() const
{
- const char *fpr = key && key->subkeys ? key->subkeys->fpr : 0 ;
- if (fpr) {
- return fpr;
- } else {
- return keyID();
+ if (!key) {
+ return nullptr;
+ }
+ if (key->fpr) {
+ /* Return what gpgme thinks is the primary fingerprint */
+ return key->fpr;
+ }
+ if (key->subkeys) {
+ /* Return the first subkeys fingerprint */
+ return key->subkeys->fpr;
}
}