summaryrefslogtreecommitdiff
path: root/lang/cpp/src/key.cpp
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2021-12-01 16:54:37 +0900
committerJinWang An <jinwang.an@samsung.com>2021-12-01 16:54:37 +0900
commitfd4d11c14daa6a54c81202dffc02cc419fa67568 (patch)
treee14910ad034ec7b4d10552a13e219174ccd4946d /lang/cpp/src/key.cpp
parent442a1386c9708114c2b721afea60d5593e36c423 (diff)
downloadgpgme-fd4d11c14daa6a54c81202dffc02cc419fa67568.tar.gz
gpgme-fd4d11c14daa6a54c81202dffc02cc419fa67568.tar.bz2
gpgme-fd4d11c14daa6a54c81202dffc02cc419fa67568.zip
Imported Upstream version 1.11.0upstream/1.11.0
Diffstat (limited to 'lang/cpp/src/key.cpp')
-rw-r--r--lang/cpp/src/key.cpp21
1 files changed, 21 insertions, 0 deletions
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