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.
This commit is contained in:
parent
799b168243
commit
40ea1c8577
@ -259,11 +259,16 @@ const char *Key::shortKeyID() const
|
|||||||
|
|
||||||
const char *Key::primaryFingerprint() const
|
const char *Key::primaryFingerprint() const
|
||||||
{
|
{
|
||||||
const char *fpr = key && key->subkeys ? key->subkeys->fpr : 0 ;
|
if (!key) {
|
||||||
if (fpr) {
|
return nullptr;
|
||||||
return fpr;
|
}
|
||||||
} else {
|
if (key->fpr) {
|
||||||
return keyID();
|
/* Return what gpgme thinks is the primary fingerprint */
|
||||||
|
return key->fpr;
|
||||||
|
}
|
||||||
|
if (key->subkeys) {
|
||||||
|
/* Return the first subkeys fingerprint */
|
||||||
|
return key->subkeys->fpr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user