[git] GPGME - branch, master, updated. gpgme-1.10.0-17-g7f9d5c6
by Andre Heinecke
cvs at cvs.gnupg.org
Fri Feb 16 13:00:52 CET 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".
The branch, master has been updated
via 7f9d5c6cd204bfd84ea477b284df795b1dadb1af (commit)
from 3224d7f0ea83a3c2baaa9f97846c4a5b392d2c59 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7f9d5c6cd204bfd84ea477b284df795b1dadb1af
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Fri Feb 16 12:58:54 2018 +0100
cpp: Add shorthand for key locate
* lang/cpp/src/key.cpp (Key::locate): New static helper.
* lang/cpp/src/key.h: Update accordingly.
diff --git a/NEWS b/NEWS
index 40d5b53..1a342b1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,12 @@
Noteworthy changes in version 1.10.1 (unreleased)
-------------------------------------------------
+ * Interface changes relative to the 1.10.0 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ cpp: Key::locate NEW.
+ cpp: Data::toString NEW.
+
+
Noteworthy changes in version 1.10.0 (2017-12-12)
-------------------------------------------------
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 66fdea9..0e86a19 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -371,6 +371,27 @@ void Key::update()
return;
}
+// static
+Key Key::locate(const char *mbox)
+{
+ if (!mbox) {
+ return Key();
+ }
+
+ auto ctx = Context::createForProtocol(OpenPGP);
+ if (!ctx) {
+ return Key();
+ }
+
+ ctx->setKeyListMode (Extern | Local);
+
+ Error e = ctx->startKeyListing (mbox);
+ auto ret = ctx->nextKey (e);
+ delete ctx;
+
+ return ret;
+}
+
//
//
// class Subkey
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index 829bd26..c3c711c 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -164,6 +164,20 @@ public:
* @returns a possible error.
**/
Error addUid(const char *uid);
+
+ /**
+ * @brief try to locate the best pgp key for a given mailbox.
+ *
+ * Boils down to gpg --locate-key <mbox>
+ * This may take some time if remote sources are also
+ * used.
+ *
+ * @param mbox should be a mail address does not need to be normalized.
+ *
+ * @returns The best key for a mailbox or a null key.
+ */
+ static Key locate(const char *mbox);
+
private:
gpgme_key_t impl() const
{
-----------------------------------------------------------------------
Summary of changes:
NEWS | 6 ++++++
lang/cpp/src/key.cpp | 21 +++++++++++++++++++++
lang/cpp/src/key.h | 14 ++++++++++++++
3 files changed, 41 insertions(+)
hooks/post-receive
--
GnuPG Made Easy
http://git.gnupg.org
More information about the Gnupg-commits
mailing list