aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/GpgKeyGetter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg/function/GpgKeyGetter.cpp')
-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;
}