[Pkg-gnupg-commit] [gpgme] 301/412: Cpp: Add Key to signature

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:27:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 7c5a4974b71c30e824cbfcb3a0a70064e5ed5adb
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 24 13:59:37 2016 +0200

    Cpp: Add Key to signature
    
    * lang/cpp/src/verificationresult.cpp,
    lang/cpp/src/verificationresult.h (Signature::key): New.
---
 lang/cpp/src/verificationresult.cpp | 14 ++++++++++++++
 lang/cpp/src/verificationresult.h   |  6 ++++++
 2 files changed, 20 insertions(+)

diff --git a/lang/cpp/src/verificationresult.cpp b/lang/cpp/src/verificationresult.cpp
index c32c896..c62625d 100644
--- a/lang/cpp/src/verificationresult.cpp
+++ b/lang/cpp/src/verificationresult.cpp
@@ -24,6 +24,7 @@
 #include <notation.h>
 #include "result_p.h"
 #include "util.h"
+#include "key.h"
 
 #include <gpgme.h>
 
@@ -64,6 +65,10 @@ public:
 # endif
             scopy->next = 0;
             sigs.push_back(scopy);
+            // copy keys
+            if (scopy->key) {
+                keys.push_back(Key(scopy->key, true));
+            }
             // copy notations:
             nota.push_back(std::vector<Nota>());
             purls.push_back(0);
@@ -107,6 +112,7 @@ public:
 
     std::vector<gpgme_signature_t> sigs;
     std::vector< std::vector<Nota> > nota;
+    std::vector<GpgME::Key> keys;
     std::vector<char *> purls;
     std::string file_name;
 };
@@ -366,6 +372,14 @@ std::vector<GpgME::Notation> GpgME::Signature::notations() const
     return result;
 }
 
+GpgME::Key GpgME::Signature::key() const
+{
+    if (isNull()) {
+        return Key();
+    }
+    return d->keys[idx];
+}
+
 class GpgME::Notation::Private
 {
 public:
diff --git a/lang/cpp/src/verificationresult.h b/lang/cpp/src/verificationresult.h
index 3394a47..93288af 100644
--- a/lang/cpp/src/verificationresult.h
+++ b/lang/cpp/src/verificationresult.h
@@ -40,6 +40,7 @@ namespace GpgME
 class Error;
 class Signature;
 class Notation;
+class Key;
 
 class GPGMEPP_EXPORT VerificationResult : public Result
 {
@@ -157,6 +158,11 @@ public:
     GpgME::Notation notation(unsigned int index) const;
     std::vector<GpgME::Notation> notations() const;
 
+    /** Returns the key object associated with this signature.
+     * May be incomplete but will have at least the fingerprint
+     * set or the associated TOFU Information if applicable. */
+    GpgME::Key key() const;
+
 private:
     std::shared_ptr<VerificationResult::Private> d;
     unsigned int idx;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list