aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-25 17:23:46 +0000
committersaturneric <[email protected]>2024-01-25 17:23:46 +0000
commit06fcf7034d0ddb7444b57a1f9fe898eed7baafed (patch)
tree5547361afdae66c776150ea41a474daaebe7773a /src/core/function/result_analyse/GpgSignResultAnalyse.cpp
parentfeat: load buddled qt and qtbase translations (diff)
downloadGpgFrontend-06fcf7034d0ddb7444b57a1f9fe898eed7baafed.tar.gz
GpgFrontend-06fcf7034d0ddb7444b57a1f9fe898eed7baafed.zip
feat: enhance analysed results of verification and signing
Diffstat (limited to 'src/core/function/result_analyse/GpgSignResultAnalyse.cpp')
-rw-r--r--src/core/function/result_analyse/GpgSignResultAnalyse.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
index bf429f38..6e3e5cf4 100644
--- a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
+++ b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
@@ -71,13 +71,32 @@ void GpgSignResultAnalyse::doAnalyse() {
stream_ << Qt::endl;
- auto singer_key = GpgKeyGetter::GetInstance().GetKey(new_sign->fpr);
+ QString fpr = new_sign->fpr == nullptr ? "" : new_sign->fpr;
+ auto singer_key = GpgKeyGetter::GetInstance().GetKey(fpr);
if (singer_key.IsGood()) {
- stream_ << "- " << tr("Signer") << ": "
+ stream_ << "- " << tr("Signed By") << ": "
<< singer_key.GetUIDs()->front().GetUID() << Qt::endl;
+
+ auto subkeys = singer_key.GetSubKeys();
+ auto it = std::find_if(
+ subkeys->begin(), subkeys->end(),
+ [fpr](const GpgSubKey &k) { return k.GetFingerprint() == fpr; });
+
+ if (it != subkeys->end()) {
+ auto &subkey = *it;
+ if (subkey.GetFingerprint() != singer_key.GetFingerprint()) {
+ stream_ << "- " << tr("Key ID") << ": " << singer_key.GetId()
+ << " (" << tr("Subkey") << ")" << Qt::endl;
+ } else {
+ stream_ << "- " << tr("Key ID") << ": " << singer_key.GetId()
+ << " (" << tr("Primary Key") << ")" << Qt::endl;
+ }
+ stream_ << "- " << tr("Key Create Date") << ": "
+ << QLocale().toString(subkey.GetCreateTime()) << Qt::endl;
+ }
} else {
- stream_ << "- " << tr("Signer") << ": "
- << "<unknown>" << Qt::endl;
+ stream_ << "- " << tr("Signed By") << "(" << tr("Fingerprint") << ")"
+ << ": " << (fpr.isEmpty() ? tr("<unknown>") : fpr) << Qt::endl;
}
stream_ << "- " << tr("Public Key Algo") << ": "
<< gpgme_pubkey_algo_name(new_sign->pubkey_algo) << Qt::endl;