aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/GpgKeyGetter.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-09-20 09:35:57 +0000
committerSaturneric <[email protected]>2021-09-20 09:35:57 +0000
commit8544bb3ed9ccf09f3082c3032381a1b61dc5e122 (patch)
treee5b12fd9c1331718dd60926ed7b4056361a8b68f /src/gpg/function/GpgKeyGetter.cpp
parentSupport multi-channel Context. (diff)
downloadGpgFrontend-8544bb3ed9ccf09f3082c3032381a1b61dc5e122.tar.gz
GpgFrontend-8544bb3ed9ccf09f3082c3032381a1b61dc5e122.zip
The basic functions of the core pass the test.
Adjust and improve the core part of the interface.
Diffstat (limited to '')
-rw-r--r--src/gpg/function/GpgKeyGetter.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/gpg/function/GpgKeyGetter.cpp b/src/gpg/function/GpgKeyGetter.cpp
index ab907ea7..f2413706 100644
--- a/src/gpg/function/GpgKeyGetter.cpp
+++ b/src/gpg/function/GpgKeyGetter.cpp
@@ -27,7 +27,6 @@
#include "GpgConstants.h"
GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetKey(const std::string& fpr) {
- DLOG(INFO) << "GpgKeyGetter GetKey Fpr " << fpr;
gpgme_key_t _p_key;
gpgme_get_key(ctx, fpr.c_str(), &_p_key, 1);
if (_p_key == nullptr)
@@ -40,34 +39,27 @@ GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetPubkey(
const std::string& fpr) {
gpgme_key_t _p_key;
gpgme_get_key(ctx, fpr.c_str(), &_p_key, 0);
+ if (_p_key == nullptr)
+ DLOG(WARNING) << "GpgKeyGetter GetKey _p_key Null";
return GpgKey(std::move(_p_key));
}
GpgFrontend::KeyListPtr GpgFrontend::GpgKeyGetter::FetchKey() {
gpgme_error_t err;
- DLOG(INFO) << "Clear List and Map";
-
- KeyListPtr keys_list = std::make_unique<std::vector<GpgKey>>();
-
- DLOG(INFO) << "Operate KeyList Start";
+ auto keys_list = std::make_unique<std::vector<GpgKey>>();
err = gpgme_op_keylist_start(ctx, nullptr, 0);
assert(check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR);
- DLOG(INFO) << "Start Loop";
-
gpgme_key_t key;
while ((err = gpgme_op_keylist_next(ctx, &key)) == GPG_ERR_NO_ERROR) {
keys_list->push_back(GpgKey(std::move(key)));
- DLOG(INFO) << "Append Key" << keys_list->back().id().c_str();
}
assert(check_gpg_error_2_err_code(err, GPG_ERR_EOF) == GPG_ERR_EOF);
err = gpgme_op_keylist_end(ctx);
- DLOG(INFO) << "Operate KeyList End";
-
return keys_list;
}