aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/GpgContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/GpgContext.cpp')
-rw-r--r--src/core/GpgContext.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/core/GpgContext.cpp b/src/core/GpgContext.cpp
index 1cb137e6..7d98004d 100644
--- a/src/core/GpgContext.cpp
+++ b/src/core/GpgContext.cpp
@@ -43,6 +43,7 @@
#include "core/function/gpg/GpgCommandExecutor.h"
#include "core/thread/Task.h"
#include "core/thread/TaskRunnerGetter.h"
+#include "function/gpg/GpgKeyGetter.h"
#ifdef _WIN32
#include <windows.h>
@@ -169,6 +170,23 @@ GpgContext::GpgContext(const GpgContextInitArgs &args) : args_(args) {
SPDLOG_ERROR("env check failed");
return;
} else {
+ // speed up loading process
+ gpgme_set_offline(*this, 1);
+
+ // set keylist mode
+ if (info_.GnupgVersion >= "2.0.0") {
+ check_gpg_error(gpgme_set_keylist_mode(
+ *this, GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_WITH_SECRET |
+ GPGME_KEYLIST_MODE_SIGS |
+ GPGME_KEYLIST_MODE_SIG_NOTATIONS |
+ GPGME_KEYLIST_MODE_WITH_TOFU));
+ } else {
+ check_gpg_error(gpgme_set_keylist_mode(
+ *this, GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_SIGS |
+ GPGME_KEYLIST_MODE_SIG_NOTATIONS |
+ GPGME_KEYLIST_MODE_WITH_TOFU));
+ }
+
// async, init context
Thread::TaskRunnerGetter::GetInstance()
.GetTaskRunner(Thread::TaskRunnerGetter::kTaskRunnerType_GPG)
@@ -206,21 +224,6 @@ void GpgContext::post_init_ctx() {
gpgme_set_armor(*this, 0);
}
- // Speed up loading process
- gpgme_set_offline(*this, 1);
-
- if (info_.GnupgVersion >= "2.0.0") {
- check_gpg_error(gpgme_set_keylist_mode(
- *this, GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_WITH_SECRET |
- GPGME_KEYLIST_MODE_SIGS | GPGME_KEYLIST_MODE_SIG_NOTATIONS |
- GPGME_KEYLIST_MODE_WITH_TOFU));
- } else {
- check_gpg_error(gpgme_set_keylist_mode(
- *this, GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_SIGS |
- GPGME_KEYLIST_MODE_SIG_NOTATIONS |
- GPGME_KEYLIST_MODE_WITH_TOFU));
- }
-
// for unit test
if (args_.test_mode) {
if (info_.GnupgVersion >= "2.1.0") SetPassphraseCb(test_passphrase_cb);