From ffd969250421fc4f2a73619e3b305fd8d781c655 Mon Sep 17 00:00:00 2001 From: SET Date: Sat, 7 Nov 2020 12:21:49 +0100 Subject: [PATCH] List key certifications Set context KeyListMode to ::Signatures | ::Validate. List certification on public key only. --- GpgMEWorker.cpp | 3 +++ K7Main.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/GpgMEWorker.cpp b/GpgMEWorker.cpp index a2ad2a1..48ab850 100644 --- a/GpgMEWorker.cpp +++ b/GpgMEWorker.cpp @@ -17,6 +17,9 @@ GpgMEWorker::GpgMEWorker() { m_ctx = Context::createForProtocol(Protocol::OpenPGP); + // Allow to list key certifications + m_ctx->setKeyListMode(GpgME::KeyListMode::Signatures + | GpgME::KeyListMode::Validate); m_ppp = NULL; } diff --git a/K7Main.cpp b/K7Main.cpp index a7e8f55..d93b963 100644 --- a/K7Main.cpp +++ b/K7Main.cpp @@ -285,7 +285,8 @@ void K7Main::OnKeyAnchorClicked(WAnchor * source) if (hasSecret == WString("0")) secret = false; const string id = source->id(); - DisplayUids(id, secret); + // With secret = false, key signatures can be retrieved. + DisplayUids(id); DisplaySubKeys(id, secret); if (m_config->CanDelete()) // m_btnDelete is NULL otherwise m_btnDelete->setHidden(!CanKeyBeDeleted(id)); @@ -331,7 +332,7 @@ void K7Main::DisplayUids(const WString& fullKeyID, bool secret) TreeTableNodeText * ttntUidComment = new TreeTableNodeText(uid.comment(), uidNode, 3); uidNode->setColumnWidget(3, unique_ptr (ttntUidComment)); rootNode->addChildNode(unique_ptr (uidNode)); - // uid.numSignatures() is always 0, even for signed keys ! + // Set context KeyListMode to ::Signatures | ::Validate for (uint s = 0; s < uid.numSignatures(); s++) { UserID::Signature sig = uid.signature(s); @@ -346,7 +347,7 @@ void K7Main::DisplayUids(const WString& fullKeyID, bool secret) sigNode->setColumnWidget(2, cpp14::make_unique (exp)); TreeTableNodeText * ttntComment = new TreeTableNodeText(sig.signerComment(), sigNode, 3); sigNode->setColumnWidget(3, unique_ptr (ttntComment)); - uidNode->addChild(unique_ptr (sigNode)); + uidNode->addChildNode(unique_ptr (sigNode)); } } m_ttbUids->show();