aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/gpg
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function/gpg')
-rw-r--r--src/core/function/gpg/GpgAdvancedOperator.cpp75
-rw-r--r--src/core/function/gpg/GpgBasicOperator.cpp6
-rw-r--r--src/core/function/gpg/GpgCommandExecutor.cpp76
-rw-r--r--src/core/function/gpg/GpgContext.cpp37
-rw-r--r--src/core/function/gpg/GpgFileOpera.cpp14
-rw-r--r--src/core/function/gpg/GpgKeyGetter.cpp18
-rw-r--r--src/core/function/gpg/GpgKeyImportExporter.cpp14
-rw-r--r--src/core/function/gpg/GpgKeyManager.cpp110
-rw-r--r--src/core/function/gpg/GpgKeyOpera.cpp28
-rw-r--r--src/core/function/gpg/GpgUIDOperator.cpp2
10 files changed, 196 insertions, 184 deletions
diff --git a/src/core/function/gpg/GpgAdvancedOperator.cpp b/src/core/function/gpg/GpgAdvancedOperator.cpp
index 0f8d1718..c96b35f7 100644
--- a/src/core/function/gpg/GpgAdvancedOperator.cpp
+++ b/src/core/function/gpg/GpgAdvancedOperator.cpp
@@ -40,10 +40,10 @@ auto GpgFrontend::GpgAdvancedOperator::ClearGpgPasswordCache() -> bool {
const auto gpgconf_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.gpgconf_path", std::string{});
- SPDLOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
+ GF_CORE_LOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
if (gpgconf_path.empty()) {
- SPDLOG_ERROR("cannot get valid gpgconf path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid gpgconf path from rt, abort.");
return false;
}
@@ -53,7 +53,7 @@ auto GpgFrontend::GpgAdvancedOperator::ClearGpgPasswordCache() -> bool {
[&](int exit_code, const std::string & /*p_out*/,
const std::string & /*p_err*/) {
if (exit_code == 0) {
- SPDLOG_DEBUG("gpgconf reload exit code: {}", exit_code);
+ GF_CORE_LOG_DEBUG("gpgconf reload exit code: {}", exit_code);
success = true;
}
}});
@@ -65,10 +65,10 @@ auto GpgFrontend::GpgAdvancedOperator::ReloadGpgComponents() -> bool {
const auto gpgconf_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.gpgconf_path", std::string{});
- SPDLOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
+ GF_CORE_LOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
if (gpgconf_path.empty()) {
- SPDLOG_ERROR("cannot get valid gpgconf path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid gpgconf path from rt, abort.");
return false;
}
@@ -79,7 +79,7 @@ auto GpgFrontend::GpgAdvancedOperator::ReloadGpgComponents() -> bool {
if (exit_code == 0) {
success = true;
} else {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"gpgconf execute error, process stderr: {}, process stdout: {}",
p_err, p_out);
return;
@@ -91,10 +91,10 @@ auto GpgFrontend::GpgAdvancedOperator::ReloadGpgComponents() -> bool {
void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() {
const auto gpgconf_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.gpgconf_path", std::string{});
- SPDLOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
+ GF_CORE_LOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
if (gpgconf_path.empty()) {
- SPDLOG_ERROR("cannot get valid gpgconf path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid gpgconf path from rt, abort.");
return;
}
@@ -102,19 +102,20 @@ void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() {
{gpgconf_path,
{"--verbose", "--kill", "all"},
[&](int exit_code, const std::string &p_out, const std::string &p_err) {
- SPDLOG_DEBUG("gpgconf --kill all command got exit code: {}",
- exit_code);
+ GF_CORE_LOG_DEBUG("gpgconf --kill all command got exit code: {}",
+ exit_code);
bool success = true;
if (exit_code != 0) {
success = false;
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"gpgconf execute error, process stderr: {}, process stdout: {}",
p_err, p_out);
}
- SPDLOG_DEBUG("gpgconf --kill --all execute result: {}", success);
+ GF_CORE_LOG_DEBUG("gpgconf --kill --all execute result: {}", success);
if (!success) {
- SPDLOG_ERROR("restart all component after core initilized failed");
+ GF_CORE_LOG_ERROR(
+ "restart all component after core initilized failed");
Module::UpsertRTValue(
"core", "gpg_advanced_operator.restart_gpg_components", false);
return;
@@ -123,19 +124,19 @@ void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() {
success &= StartGpgAgent();
if (!success) {
- SPDLOG_ERROR("start gpg agent after core initilized failed");
+ GF_CORE_LOG_ERROR("start gpg agent after core initilized failed");
}
success &= StartDirmngr();
if (!success) {
- SPDLOG_ERROR("start dirmngr after core initilized failed");
+ GF_CORE_LOG_ERROR("start dirmngr after core initilized failed");
}
success &= StartKeyBoxd();
if (!success) {
- SPDLOG_ERROR("start keyboxd after core initilized failed");
+ GF_CORE_LOG_ERROR("start keyboxd after core initilized failed");
}
Module::UpsertRTValue(
@@ -148,10 +149,10 @@ auto GpgFrontend::GpgAdvancedOperator::ResetConfigures() -> bool {
const auto gpgconf_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.gpgconf_path", std::string{});
- SPDLOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
+ GF_CORE_LOG_DEBUG("got gpgconf path from rt: {}", gpgconf_path);
if (gpgconf_path.empty()) {
- SPDLOG_ERROR("cannot get valid gpgconf path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid gpgconf path from rt, abort.");
return false;
}
@@ -162,7 +163,7 @@ auto GpgFrontend::GpgAdvancedOperator::ResetConfigures() -> bool {
if (exit_code == 0) {
success = true;
} else {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"gpgconf execute error, process stderr: {}, process stdout: {}",
p_err, p_out);
return;
@@ -178,15 +179,15 @@ auto GpgFrontend::GpgAdvancedOperator::StartGpgAgent() -> bool {
const auto gpg_agent_path = Module::RetrieveRTValueTypedOrDefault<>(
"com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering",
"gnupg.gpg_agent_path", std::string{});
- SPDLOG_DEBUG("got gnupg agent path from rt: {}", gpg_agent_path);
+ GF_CORE_LOG_DEBUG("got gnupg agent path from rt: {}", gpg_agent_path);
const auto home_path = Module::RetrieveRTValueTypedOrDefault<>(
"com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering",
"gnupg.home_path", std::string{});
- SPDLOG_DEBUG("got gnupg home path from rt: {}", home_path);
+ GF_CORE_LOG_DEBUG("got gnupg home path from rt: {}", home_path);
if (gpg_agent_path.empty()) {
- SPDLOG_ERROR("cannot get valid gpg agent path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid gpg agent path from rt, abort.");
return false;
}
@@ -196,12 +197,12 @@ auto GpgFrontend::GpgAdvancedOperator::StartGpgAgent() -> bool {
[&](int exit_code, const std::string &p_out, const std::string &p_err) {
if (exit_code == 0) {
success = true;
- SPDLOG_INFO("start gpg-agent successfully");
+ GF_CORE_LOG_INFO("start gpg-agent successfully");
} else if (exit_code == 2) {
success = true;
- SPDLOG_INFO("gpg-agent already started");
+ GF_CORE_LOG_INFO("gpg-agent already started");
} else {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"gpg-agent execute error, process stderr: {}, process stdout: "
"{}",
p_err, p_out);
@@ -218,15 +219,15 @@ auto GpgFrontend::GpgAdvancedOperator::StartDirmngr() -> bool {
const auto dirmngr_path = Module::RetrieveRTValueTypedOrDefault<>(
"com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering",
"gnupg.dirmngr_path", std::string{});
- SPDLOG_DEBUG("got gnupg dirmngr path from rt: {}", dirmngr_path);
+ GF_CORE_LOG_DEBUG("got gnupg dirmngr path from rt: {}", dirmngr_path);
const auto home_path = Module::RetrieveRTValueTypedOrDefault<>(
"com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering",
"gnupg.home_path", std::string{});
- SPDLOG_DEBUG("got gnupg home path from rt: {}", home_path);
+ GF_CORE_LOG_DEBUG("got gnupg home path from rt: {}", home_path);
if (dirmngr_path.empty()) {
- SPDLOG_ERROR("cannot get valid dirmngr path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid dirmngr path from rt, abort.");
return false;
}
@@ -236,12 +237,12 @@ auto GpgFrontend::GpgAdvancedOperator::StartDirmngr() -> bool {
[&](int exit_code, const std::string &p_out, const std::string &p_err) {
if (exit_code == 0) {
success = true;
- SPDLOG_INFO("start dirmngr successfully");
+ GF_CORE_LOG_INFO("start dirmngr successfully");
} else if (exit_code == 2) {
success = true;
- SPDLOG_INFO("dirmngr already started");
+ GF_CORE_LOG_INFO("dirmngr already started");
} else {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"dirmngr execute error, process stderr: {}, process stdout: {}",
p_err, p_out);
return;
@@ -257,15 +258,15 @@ auto GpgFrontend::GpgAdvancedOperator::StartKeyBoxd() -> bool {
const auto keyboxd_path = Module::RetrieveRTValueTypedOrDefault<>(
"com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering",
"gnupg.keyboxd_path", std::string{});
- SPDLOG_DEBUG("got gnupg keyboxd path from rt: {}", keyboxd_path);
+ GF_CORE_LOG_DEBUG("got gnupg keyboxd path from rt: {}", keyboxd_path);
const auto home_path = Module::RetrieveRTValueTypedOrDefault<>(
"com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering",
"gnupg.home_path", std::string{});
- SPDLOG_DEBUG("got gnupg home path from rt: {}", home_path);
+ GF_CORE_LOG_DEBUG("got gnupg home path from rt: {}", home_path);
if (keyboxd_path.empty()) {
- SPDLOG_ERROR("cannot get valid keyboxd path from rt, abort.");
+ GF_CORE_LOG_ERROR("cannot get valid keyboxd path from rt, abort.");
return false;
}
@@ -275,12 +276,12 @@ auto GpgFrontend::GpgAdvancedOperator::StartKeyBoxd() -> bool {
[&](int exit_code, const std::string &p_out, const std::string &p_err) {
if (exit_code == 0) {
success = true;
- SPDLOG_INFO("start keyboxd successfully");
+ GF_CORE_LOG_INFO("start keyboxd successfully");
} else if (exit_code == 2) {
success = true;
- SPDLOG_INFO("keyboxd already started");
+ GF_CORE_LOG_INFO("keyboxd already started");
} else {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"keyboxd execute error, process stderr: {}, process stdout: {}",
p_err, p_out);
return;
diff --git a/src/core/function/gpg/GpgBasicOperator.cpp b/src/core/function/gpg/GpgBasicOperator.cpp
index 36bd25f6..fd81c093 100644
--- a/src/core/function/gpg/GpgBasicOperator.cpp
+++ b/src/core/function/gpg/GpgBasicOperator.cpp
@@ -192,15 +192,15 @@ void GpgBasicOperator::SetSigners(const KeyArgsList& signers, bool ascii) {
gpgme_signers_clear(ctx);
for (const GpgKey& key : signers) {
- SPDLOG_DEBUG("key fpr: {}", key.GetFingerprint());
+ GF_CORE_LOG_DEBUG("key fpr: {}", key.GetFingerprint());
if (key.IsHasActualSigningCapability()) {
- SPDLOG_DEBUG("signer");
+ GF_CORE_LOG_DEBUG("signer");
auto error = gpgme_signers_add(ctx, gpgme_key_t(key));
CheckGpgError(error);
}
}
if (signers.size() != gpgme_signers_count(ctx_.DefaultContext()))
- SPDLOG_DEBUG("not all signers added");
+ GF_CORE_LOG_DEBUG("not all signers added");
}
auto GpgBasicOperator::GetSigners(bool ascii) -> std::unique_ptr<KeyArgsList> {
diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp
index fbcb1e4d..fa4b7dbd 100644
--- a/src/core/function/gpg/GpgCommandExecutor.cpp
+++ b/src/core/function/gpg/GpgCommandExecutor.cpp
@@ -51,35 +51,36 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context)
return a + (a.length() > 0 ? " " : "") + b;
});
- SPDLOG_DEBUG("building task: called cmd {} arguments size: {}", cmd,
- arguments.size());
-
- Thread::Task::TaskCallback result_callback = [cmd, joined_argument](
- int /*rtn*/,
- const DataObjectPtr
- &data_object) {
- SPDLOG_DEBUG("data object args count of cmd executor result callback: {}",
- data_object->GetObjectSize());
- if (!data_object->Check<int, std::string, GpgCommandExecutorCallback>()) {
- throw std::runtime_error("invalid data object size");
- }
-
- auto exit_code = ExtractParams<int>(data_object, 0);
- auto process_stdout = ExtractParams<std::string>(data_object, 1);
- auto callback = ExtractParams<GpgCommandExecutorCallback>(data_object, 2);
-
- // call callback
- SPDLOG_DEBUG(
- "calling custom callback from caller of cmd {} {}, "
- "exit_code: {}",
- cmd, joined_argument, exit_code);
- callback(exit_code, process_stdout, {});
- };
+ GF_CORE_LOG_DEBUG("building task: called cmd {} arguments size: {}", cmd,
+ arguments.size());
+
+ Thread::Task::TaskCallback result_callback =
+ [cmd, joined_argument](int /*rtn*/, const DataObjectPtr &data_object) {
+ GF_CORE_LOG_DEBUG(
+ "data object args count of cmd executor result callback: {}",
+ data_object->GetObjectSize());
+ if (!data_object
+ ->Check<int, std::string, GpgCommandExecutorCallback>()) {
+ throw std::runtime_error("invalid data object size");
+ }
+
+ auto exit_code = ExtractParams<int>(data_object, 0);
+ auto process_stdout = ExtractParams<std::string>(data_object, 1);
+ auto callback =
+ ExtractParams<GpgCommandExecutorCallback>(data_object, 2);
+
+ // call callback
+ GF_CORE_LOG_DEBUG(
+ "calling custom callback from caller of cmd {} {}, "
+ "exit_code: {}",
+ cmd, joined_argument, exit_code);
+ callback(exit_code, process_stdout, {});
+ };
Thread::Task::TaskRunnable runner =
[joined_argument](const DataObjectPtr &data_object) -> int {
- SPDLOG_DEBUG("process runner called, data object size: {}",
- data_object->GetObjectSize());
+ GF_CORE_LOG_DEBUG("process runner called, data object size: {}",
+ data_object->GetObjectSize());
if (!data_object->Check<std::string, std::vector<std::string>,
GpgCommandExecutorInteractor,
@@ -113,7 +114,7 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context)
QObject::connect(
cmd_process, &QProcess::started, [cmd, joined_argument]() -> void {
- SPDLOG_DEBUG(
+ GF_CORE_LOG_DEBUG(
"\n== Process Execute Started ==\nCommand: {}\nArguments: "
"{}\n========================",
cmd, joined_argument);
@@ -124,11 +125,12 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context)
QObject::connect(
cmd_process, &QProcess::errorOccurred,
[=](QProcess::ProcessError error) {
- SPDLOG_ERROR("caught error while executing command: {} {}, error: {}",
- cmd, joined_argument, error);
+ GF_CORE_LOG_ERROR(
+ "caught error while executing command: {} {}, error: {}", cmd,
+ joined_argument, error);
});
- SPDLOG_DEBUG(
+ GF_CORE_LOG_DEBUG(
"\n== Process Execute Ready ==\nCommand: {}\nArguments: "
"{}\n========================",
cmd, joined_argument);
@@ -140,7 +142,7 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context)
cmd_process->readAllStandardOutput().toStdString();
int exit_code = cmd_process->exitCode();
- SPDLOG_DEBUG(
+ GF_CORE_LOG_DEBUG(
"\n==== Process Execution Summary ====\n"
"Command: {}\n"
"Arguments: {}\n"
@@ -198,7 +200,7 @@ void GpgCommandExecutor::ExecuteSync(ExecuteContext context) {
// current thread.
if (QThread::currentThread()->currentThreadId() !=
target_task_runner->GetThread()->currentThreadId()) {
- SPDLOG_TRACE("blocking until gpg command finish...");
+ GF_CORE_LOG_TRACE("blocking until gpg command finish...");
// block until task finished
// this is to keep reference vaild until task finished
looper.exec();
@@ -208,7 +210,7 @@ void GpgCommandExecutor::ExecuteSync(ExecuteContext context) {
void GpgCommandExecutor::ExecuteConcurrentlyAsync(ExecuteContexts contexts) {
for (auto &context : contexts) {
const auto &cmd = context.cmd;
- SPDLOG_INFO("gpg concurrently called cmd {}", cmd);
+ GF_CORE_LOG_INFO("gpg concurrently called cmd {}", cmd);
Thread::Task *task = BuildTaskFromExecCtx(context);
@@ -232,15 +234,15 @@ void GpgCommandExecutor::ExecuteConcurrentlySync(ExecuteContexts contexts) {
for (auto &context : contexts) {
const auto &cmd = context.cmd;
- SPDLOG_INFO("gpg concurrently called cmd {}", cmd);
+ GF_CORE_LOG_DEBUG("gpg concurrently called cmd {}", cmd);
Thread::Task *task = BuildTaskFromExecCtx(context);
QObject::connect(task, &Thread::Task::SignalTaskEnd, [&]() {
--remaining_tasks;
- SPDLOG_DEBUG("remaining tasks: {}", remaining_tasks);
+ GF_CORE_LOG_DEBUG("remaining tasks: {}", remaining_tasks);
if (remaining_tasks <= 0) {
- SPDLOG_DEBUG("no remaining task, quit");
+ GF_CORE_LOG_DEBUG("no remaining task, quit");
looper.quit();
}
});
@@ -265,7 +267,7 @@ void GpgCommandExecutor::ExecuteConcurrentlySync(ExecuteContexts contexts) {
}
if (need_looper) {
- SPDLOG_TRACE("blocking until concurrent gpg commands finish...");
+ GF_CORE_LOG_TRACE("blocking until concurrent gpg commands finish...");
// block until task finished
// this is to keep reference vaild until task finished
looper.exec();
diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp
index 7cde439c..30134191 100644
--- a/src/core/function/gpg/GpgContext.cpp
+++ b/src/core/function/gpg/GpgContext.cpp
@@ -109,7 +109,7 @@ class GpgContext::Impl {
int fd) -> gpgme_error_t {
std::string passphrase;
- SPDLOG_DEBUG(
+ GF_CORE_LOG_DEBUG(
"custom passphrase cb called, uid: {}, info: {}, last_was_bad: {}",
uid_hint == nullptr ? "<empty>" : std::string{uid_hint},
passphrase_info == nullptr ? "<empty>" : std::string{passphrase_info},
@@ -128,7 +128,8 @@ class GpgContext::Impl {
looper.exec();
auto passpahrase_size = passphrase.size();
- SPDLOG_DEBUG("get passphrase from pinentry size: {}", passpahrase_size);
+ GF_CORE_LOG_DEBUG("get passphrase from pinentry size: {}",
+ passpahrase_size);
size_t off = 0;
size_t res = 0;
@@ -139,7 +140,7 @@ class GpgContext::Impl {
res += gpgme_io_write(fd, "\n", 1);
- SPDLOG_DEBUG("custom passphrase cd is about to return, res: {}", res);
+ GF_CORE_LOG_DEBUG("custom passphrase cd is about to return, res: {}", res);
return res == passpahrase_size + 1
? 0
: gpgme_error_from_errno(GPG_ERR_CANCELED);
@@ -147,7 +148,7 @@ class GpgContext::Impl {
static auto TestStatusCb(void *hook, const char *keyword, const char *args)
-> gpgme_error_t {
- SPDLOG_DEBUG("keyword {}", keyword);
+ GF_CORE_LOG_DEBUG("keyword {}", keyword);
return GPG_ERR_NO_ERROR;
}
@@ -165,10 +166,10 @@ class GpgContext::Impl {
const auto gpgme_version = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.version", std::string{"0.0.0"});
- SPDLOG_DEBUG("got gpgme version version from rt: {}", gpgme_version);
+ GF_CORE_LOG_DEBUG("got gpgme version version from rt: {}", gpgme_version);
if (gpgme_get_keylist_mode(ctx) == 0) {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"ctx is not a valid pointer, reported by gpgme_get_keylist_mode");
return false;
}
@@ -187,8 +188,8 @@ class GpgContext::Impl {
const auto database_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.database_path", std::string{});
- SPDLOG_DEBUG("ctx set engine info, db path: {}, app path: {}",
- database_path, app_path);
+ GF_CORE_LOG_DEBUG("ctx set engine info, db path: {}, app path: {}",
+ database_path, app_path);
const char *app_path_c_str = app_path.c_str();
const char *db_path_c_str = database_path.c_str();
@@ -215,7 +216,8 @@ class GpgContext::Impl {
assert(ctx != nullptr);
if (args.custom_gpgconf && !args.custom_gpgconf_path.empty()) {
- SPDLOG_DEBUG("set custom gpgconf path: {}", args.custom_gpgconf_path);
+ GF_CORE_LOG_DEBUG("set custom gpgconf path: {}",
+ args.custom_gpgconf_path);
auto err =
gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_GPGCONF,
args.custom_gpgconf_path.c_str(), nullptr);
@@ -227,12 +229,13 @@ class GpgContext::Impl {
}
// set context offline mode
- SPDLOG_DEBUG("gpg context offline mode: {}", args_.offline_mode);
+ GF_CORE_LOG_DEBUG("gpg context offline mode: {}", args_.offline_mode);
gpgme_set_offline(ctx, args_.offline_mode ? 1 : 0);
// set option auto import missing key
// invalid at offline mode
- SPDLOG_DEBUG("gpg context auto import missing key: {}", args_.offline_mode);
+ GF_CORE_LOG_DEBUG("gpg context auto import missing key: {}",
+ args_.offline_mode);
if (!args.offline_mode && args.auto_import_missing_key) {
if (CheckGpgError(gpgme_set_ctx_flag(ctx, "auto-key-import", "1")) !=
GPG_ERR_NO_ERROR) {
@@ -241,19 +244,19 @@ class GpgContext::Impl {
}
if (!set_ctx_key_list_mode(ctx)) {
- SPDLOG_DEBUG("set ctx key list mode failed");
+ GF_CORE_LOG_DEBUG("set ctx key list mode failed");
return false;
}
// for unit test
if (args_.test_mode) {
if (!SetPassphraseCb(ctx, TestPassphraseCb)) {
- SPDLOG_ERROR("set passphrase cb failed, test");
+ GF_CORE_LOG_ERROR("set passphrase cb failed, test");
return false;
};
} else if (!args_.use_pinentry) {
if (!SetPassphraseCb(ctx, CustomPassphraseCb)) {
- SPDLOG_DEBUG("set passphrase cb failed, custom");
+ GF_CORE_LOG_DEBUG("set passphrase cb failed, custom");
return false;
}
}
@@ -265,7 +268,7 @@ class GpgContext::Impl {
}
if (!set_ctx_openpgp_engine_info(ctx)) {
- SPDLOG_ERROR("set gpgme context openpgp engine info failed");
+ GF_CORE_LOG_ERROR("set gpgme context openpgp engine info failed");
return false;
}
@@ -281,7 +284,7 @@ class GpgContext::Impl {
binary_ctx_ref_ = p_ctx;
if (!common_ctx_initialize(binary_ctx_ref_, args)) {
- SPDLOG_ERROR("get new ctx failed, binary");
+ GF_CORE_LOG_ERROR("get new ctx failed, binary");
return false;
}
@@ -292,7 +295,7 @@ class GpgContext::Impl {
auto default_ctx_initialize(const GpgContextInitArgs &args) -> bool {
gpgme_ctx_t p_ctx;
if (CheckGpgError(gpgme_new(&p_ctx)) != GPG_ERR_NO_ERROR) {
- SPDLOG_ERROR("get new ctx failed, default");
+ GF_CORE_LOG_ERROR("get new ctx failed, default");
return false;
}
assert(p_ctx != nullptr);
diff --git a/src/core/function/gpg/GpgFileOpera.cpp b/src/core/function/gpg/GpgFileOpera.cpp
index ecb292e0..53cc6099 100644
--- a/src/core/function/gpg/GpgFileOpera.cpp
+++ b/src/core/function/gpg/GpgFileOpera.cpp
@@ -89,7 +89,7 @@ void GpgFileOpera::EncryptDirectory(std::vector<GpgKey> keys,
GpgData data_in(ex);
GpgData data_out(out_path, false);
- SPDLOG_DEBUG("encrypt directory start");
+ GF_CORE_LOG_DEBUG("encrypt directory start");
auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext();
auto err = CheckGpgError(gpgme_op_encrypt(ctx, recipients.data(),
@@ -97,14 +97,14 @@ void GpgFileOpera::EncryptDirectory(std::vector<GpgKey> keys,
data_in, data_out));
data_object->Swap({GpgEncryptResult(gpgme_op_encrypt_result(ctx))});
- SPDLOG_DEBUG("encrypt directory finished, err: {}", err);
+ GF_CORE_LOG_DEBUG("encrypt directory finished, err: {}", err);
return err;
},
cb, "gpgme_op_encrypt", "2.1.0");
ArchiveFileOperator::NewArchive2DataExchanger(
in_path, ex, [=](GFError err, const DataObjectPtr&) {
- SPDLOG_DEBUG("new archive 2 fd operation, err: {}", err);
+ GF_CORE_LOG_DEBUG("new archive 2 fd operation, err: {}", err);
});
}
@@ -133,7 +133,7 @@ void GpgFileOpera::DecryptArchive(const std::filesystem::path& in_path,
ArchiveFileOperator::ExtractArchiveFromDataExchanger(
ex, out_path, [](GFError err, const DataObjectPtr&) {
- SPDLOG_DEBUG("extract archive from fd operation, err: {}", err);
+ GF_CORE_LOG_DEBUG("extract archive from fd operation, err: {}", err);
});
RunGpgOperaAsync(
@@ -272,7 +272,7 @@ void GpgFileOpera::EncryptSignDirectory(KeyArgsList keys,
ArchiveFileOperator::NewArchive2DataExchanger(
in_path, ex, [=](GFError err, const DataObjectPtr&) {
- SPDLOG_DEBUG("new archive 2 fd operation, err: {}", err);
+ GF_CORE_LOG_DEBUG("new archive 2 fd operation, err: {}", err);
});
}
@@ -306,7 +306,7 @@ void GpgFileOpera::DecryptVerifyArchive(const std::filesystem::path& in_path,
ArchiveFileOperator::ExtractArchiveFromDataExchanger(
ex, out_path, [](GFError err, const DataObjectPtr&) {
- SPDLOG_DEBUG("extract archive from ex operation, err: {}", err);
+ GF_CORE_LOG_DEBUG("extract archive from ex operation, err: {}", err);
});
RunGpgOperaAsync(
@@ -373,7 +373,7 @@ void GpgFileOpera::EncryptDerectorySymmetric(
ArchiveFileOperator::NewArchive2DataExchanger(
in_path, ex, [=](GFError err, const DataObjectPtr&) {
- SPDLOG_DEBUG("new archive 2 fd operation, err: {}", err);
+ GF_CORE_LOG_DEBUG("new archive 2 fd operation, err: {}", err);
});
}
} // namespace GpgFrontend \ No newline at end of file
diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp
index de8895d9..5c5ed039 100644
--- a/src/core/function/gpg/GpgKeyGetter.cpp
+++ b/src/core/function/gpg/GpgKeyGetter.cpp
@@ -43,7 +43,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
public:
explicit Impl(int channel)
: SingletonFunctionObject<GpgKeyGetter::Impl>(channel) {
- SPDLOG_DEBUG("called channel: {}", channel);
+ GF_CORE_LOG_DEBUG("called channel: {}", channel);
}
auto GetKey(const std::string& fpr, bool use_cache) -> GpgKey {
@@ -56,7 +56,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
gpgme_key_t p_key = nullptr;
gpgme_get_key(ctx_.DefaultContext(), fpr.c_str(), &p_key, 1);
if (p_key == nullptr) {
- SPDLOG_WARN("GpgKeyGetter GetKey Private _p_key Null fpr", fpr);
+ GF_CORE_LOG_WARN("GpgKeyGetter GetKey Private _p_key Null fpr", fpr);
return GetPubkey(fpr, true);
}
return GpgKey(std::move(p_key));
@@ -71,7 +71,8 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
gpgme_key_t p_key = nullptr;
gpgme_get_key(ctx_.DefaultContext(), fpr.c_str(), &p_key, 0);
- if (p_key == nullptr) SPDLOG_WARN("GpgKeyGetter GetKey _p_key Null", fpr);
+ if (p_key == nullptr)
+ GF_CORE_LOG_WARN("GpgKeyGetter GetKey _p_key Null", fpr);
return GpgKey(std::move(p_key));
}
@@ -93,7 +94,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
}
auto FlushKeyCache() -> bool {
- SPDLOG_DEBUG("flush key channel called, channel: {}", GetChannel());
+ GF_CORE_LOG_DEBUG("flush key channel called, channel: {}", GetChannel());
// clear the keys cache
keys_cache_.clear();
@@ -126,8 +127,9 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
}
}
- SPDLOG_DEBUG("flush key channel cache address: {} object address: {}",
- static_cast<void*>(&keys_cache_), static_cast<void*>(this));
+ GF_CORE_LOG_DEBUG("flush key channel cache address: {} object address: {}",
+ static_cast<void*>(&keys_cache_),
+ static_cast<void*>(this));
// for debug
assert(CheckGpgError2ErrCode(err, GPG_ERR_EOF) == GPG_ERR_EOF);
@@ -135,7 +137,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
err = gpgme_op_keylist_end(ctx_.DefaultContext());
assert(CheckGpgError2ErrCode(err, GPG_ERR_EOF) == GPG_ERR_NO_ERROR);
- SPDLOG_DEBUG("flush key channel done, channel: {}", GetChannel());
+ GF_CORE_LOG_DEBUG("flush key channel done, channel: {}", GetChannel());
return true;
}
@@ -209,7 +211,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
GpgKeyGetter::GpgKeyGetter(int channel)
: SingletonFunctionObject<GpgKeyGetter>(channel),
p_(SecureCreateUniqueObject<Impl>(channel)) {
- SPDLOG_DEBUG("called channel: {}", channel);
+ GF_CORE_LOG_DEBUG("called channel: {}", channel);
}
GpgKeyGetter::~GpgKeyGetter() = default;
diff --git a/src/core/function/gpg/GpgKeyImportExporter.cpp b/src/core/function/gpg/GpgKeyImportExporter.cpp
index a2db25e1..e9ca3e84 100644
--- a/src/core/function/gpg/GpgKeyImportExporter.cpp
+++ b/src/core/function/gpg/GpgKeyImportExporter.cpp
@@ -96,8 +96,8 @@ auto GpgKeyImportExporter::ExportKeys(KeyIdArgsListPtr& uid_list,
delete[] keys_array;
- SPDLOG_DEBUG("export keys read_bytes: {}",
- gpgme_data_seek(data_out, 0, SEEK_END));
+ GF_CORE_LOG_DEBUG("export keys read_bytes: {}",
+ gpgme_data_seek(data_out, 0, SEEK_END));
auto temp_out_buffer = data_out.Read2Buffer();
@@ -151,7 +151,7 @@ auto GpgKeyImportExporter::ExportAllKeys(KeyIdArgsListPtr& uid_list,
auto GpgKeyImportExporter::ExportSecretKey(const GpgKey& key,
ByteArrayPtr& out_buffer) const
-> bool {
- SPDLOG_DEBUG("export secret key: {}", key.GetId().c_str());
+ GF_CORE_LOG_DEBUG("export secret key: {}", key.GetId().c_str());
gpgme_key_t target_key[2] = {static_cast<gpgme_key_t>(key), nullptr};
@@ -172,8 +172,8 @@ auto GpgKeyImportExporter::ExportKey(const GpgKey& key,
auto err =
gpgme_op_export(ctx_.DefaultContext(), key.GetId().c_str(), 0, data_out);
- SPDLOG_DEBUG("export keys read_bytes: {}",
- gpgme_data_seek(data_out, 0, SEEK_END));
+ GF_CORE_LOG_DEBUG("export keys read_bytes: {}",
+ gpgme_data_seek(data_out, 0, SEEK_END));
auto temp_out_buffer = data_out.Read2Buffer();
std::swap(out_buffer, temp_out_buffer);
@@ -187,7 +187,7 @@ auto GpgKeyImportExporter::ExportKeyOpenSSH(const GpgKey& key,
auto err = gpgme_op_export(ctx_.DefaultContext(), key.GetId().c_str(),
GPGME_EXPORT_MODE_SSH, data_out);
- SPDLOG_DEBUG("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END));
+ GF_CORE_LOG_DEBUG("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END));
auto temp_out_buffer = data_out.Read2Buffer();
std::swap(out_buffer, temp_out_buffer);
@@ -200,7 +200,7 @@ auto GpgKeyImportExporter::ExportSecretKeyShortest(
auto err = gpgme_op_export(ctx_.DefaultContext(), key.GetId().c_str(),
GPGME_EXPORT_MODE_MINIMAL, data_out);
- SPDLOG_DEBUG("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END));
+ GF_CORE_LOG_DEBUG("read_bytes: {}", gpgme_data_seek(data_out, 0, SEEK_END));
auto temp_out_buffer = data_out.Read2Buffer();
std::swap(out_buffer, temp_out_buffer);
diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp
index b2de0ed7..38ebd040 100644
--- a/src/core/function/gpg/GpgKeyManager.cpp
+++ b/src/core/function/gpg/GpgKeyManager.cpp
@@ -100,58 +100,59 @@ auto GpgFrontend::GpgKeyManager::SetExpire(
auto GpgFrontend::GpgKeyManager::SetOwnerTrustLevel(const GpgKey& key,
int trust_level) -> bool {
if (trust_level < 0 || trust_level > 5) {
- SPDLOG_ERROR("illegal owner trust level: {}", trust_level);
+ GF_CORE_LOG_ERROR("illegal owner trust level: {}", trust_level);
}
- AutomatonNextStateHandler next_state_handler =
- [](AutomatonState state, std::string status, std::string args) {
- SPDLOG_DEBUG("next_state_handler state: {}, gpg_status: {}, args: {}",
- state, status, args);
- std::vector<std::string> tokens;
- boost::split(tokens, args, boost::is_any_of(" "));
+ AutomatonNextStateHandler next_state_handler = [](AutomatonState state,
+ std::string status,
+ std::string args) {
+ GF_CORE_LOG_DEBUG("next_state_handler state: {}, gpg_status: {}, args: {}",
+ state, status, args);
+ std::vector<std::string> tokens;
+ boost::split(tokens, args, boost::is_any_of(" "));
- switch (state) {
- case AS_START:
- if (status == "GET_LINE" && args == "keyedit.prompt") {
- return AS_COMMAND;
- }
- return AS_ERROR;
- case AS_COMMAND:
- if (status == "GET_LINE" && args == "edit_ownertrust.value") {
- return AS_VALUE;
- }
- return AS_ERROR;
- case AS_VALUE:
- if (status == "GET_LINE" && args == "keyedit.prompt") {
- return AS_QUIT;
- } else if (status == "GET_BOOL" &&
- args == "edit_ownertrust.set_ultimate.okay") {
- return AS_REALLY_ULTIMATE;
- }
- return AS_ERROR;
- case AS_REALLY_ULTIMATE:
- if (status == "GET_LINE" && args == "keyedit.prompt") {
- return AS_QUIT;
- }
- return AS_ERROR;
- case AS_QUIT:
- if (status == "GET_LINE" && args == "keyedit.save.okay") {
- return AS_SAVE;
- }
- return AS_ERROR;
- case AS_ERROR:
- if (status == "GET_LINE" && args == "keyedit.prompt") {
- return AS_QUIT;
- }
- return AS_ERROR;
- default:
- return AS_ERROR;
- };
- };
+ switch (state) {
+ case AS_START:
+ if (status == "GET_LINE" && args == "keyedit.prompt") {
+ return AS_COMMAND;
+ }
+ return AS_ERROR;
+ case AS_COMMAND:
+ if (status == "GET_LINE" && args == "edit_ownertrust.value") {
+ return AS_VALUE;
+ }
+ return AS_ERROR;
+ case AS_VALUE:
+ if (status == "GET_LINE" && args == "keyedit.prompt") {
+ return AS_QUIT;
+ } else if (status == "GET_BOOL" &&
+ args == "edit_ownertrust.set_ultimate.okay") {
+ return AS_REALLY_ULTIMATE;
+ }
+ return AS_ERROR;
+ case AS_REALLY_ULTIMATE:
+ if (status == "GET_LINE" && args == "keyedit.prompt") {
+ return AS_QUIT;
+ }
+ return AS_ERROR;
+ case AS_QUIT:
+ if (status == "GET_LINE" && args == "keyedit.save.okay") {
+ return AS_SAVE;
+ }
+ return AS_ERROR;
+ case AS_ERROR:
+ if (status == "GET_LINE" && args == "keyedit.prompt") {
+ return AS_QUIT;
+ }
+ return AS_ERROR;
+ default:
+ return AS_ERROR;
+ };
+ };
AutomatonActionHandler action_handler =
[trust_level](AutomatonHandelStruct& handler, AutomatonState state) {
- SPDLOG_DEBUG("action_handler state: {}", state);
+ GF_CORE_LOG_DEBUG("action_handler state: {}", state);
switch (state) {
case AS_COMMAND:
return std::string("trust");
@@ -194,16 +195,17 @@ auto GpgFrontend::GpgKeyManager::interactor_cb_fnc(void* handle,
auto handle_struct = static_cast<AutomatonHandelStruct*>(handle);
std::string status_s = status;
std::string args_s = args;
- SPDLOG_DEBUG("cb start status: {}, args: {}, fd: {}, handle struct state: {}",
- status_s, args_s, fd, handle_struct->CuurentStatus());
+ GF_CORE_LOG_DEBUG(
+ "cb start status: {}, args: {}, fd: {}, handle struct state: {}",
+ status_s, args_s, fd, handle_struct->CuurentStatus());
if (status_s == "KEY_CONSIDERED") {
std::vector<std::string> tokens;
boost::split(tokens, args, boost::is_any_of(" "));
if (tokens.empty() || tokens[0] != handle_struct->KeyFpr()) {
- SPDLOG_ERROR("handle struct key fpr {} mismatch token: {}, exit...",
- handle_struct->KeyFpr(), tokens[0]);
+ GF_CORE_LOG_ERROR("handle struct key fpr {} mismatch token: {}, exit...",
+ handle_struct->KeyFpr(), tokens[0]);
return -1;
}
@@ -211,13 +213,13 @@ auto GpgFrontend::GpgKeyManager::interactor_cb_fnc(void* handle,
}
if (status_s == "GOT_IT" || status_s.empty()) {
- SPDLOG_DEBUG("status GOT_IT, continue...");
+ GF_CORE_LOG_DEBUG("status GOT_IT, continue...");
return 0;
}
AutomatonState next_state = handle_struct->NextState(status_s, args_s);
if (next_state == AS_ERROR) {
- SPDLOG_DEBUG("handle struct next state caught error, skipping...");
+ GF_CORE_LOG_DEBUG("handle struct next state caught error, skipping...");
return GPG_ERR_FALSE;
}
@@ -228,8 +230,8 @@ auto GpgFrontend::GpgKeyManager::interactor_cb_fnc(void* handle,
// set state and preform action
handle_struct->SetStatus(next_state);
Command cmd = handle_struct->Action();
- SPDLOG_DEBUG("handle struct action done, next state: {}, action cmd: {}",
- next_state, cmd);
+ GF_CORE_LOG_DEBUG("handle struct action done, next state: {}, action cmd: {}",
+ next_state, cmd);
if (!cmd.empty()) {
gpgme_io_write(fd, cmd.c_str(), cmd.size());
gpgme_io_write(fd, "\n", 1);
diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp
index c48b75f3..49703781 100644
--- a/src/core/function/gpg/GpgKeyOpera.cpp
+++ b/src/core/function/gpg/GpgKeyOpera.cpp
@@ -68,7 +68,7 @@ void GpgKeyOpera::DeleteKeys(GpgFrontend::KeyIdArgsListPtr key_ids) {
GPGME_DELETE_ALLOW_SECRET | GPGME_DELETE_FORCE));
assert(gpg_err_code(err) == GPG_ERR_NO_ERROR);
} else {
- SPDLOG_WARN("GpgKeyOpera DeleteKeys get key failed", tmp);
+ GF_CORE_LOG_WARN("GpgKeyOpera DeleteKeys get key failed", tmp);
}
}
}
@@ -91,7 +91,7 @@ auto GpgKeyOpera::SetExpire(const GpgKey& key, const SubkeyId& subkey_fpr,
std::chrono::system_clock::now());
}
- SPDLOG_DEBUG(key.GetId(), subkey_fpr, expires_time);
+ GF_CORE_LOG_DEBUG(key.GetId(), subkey_fpr, expires_time);
GpgError err;
if (key.GetFingerprint() == subkey_fpr || subkey_fpr.empty()) {
@@ -124,12 +124,12 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key,
"--gen-revoke", key.GetFingerprint()},
[=](int exit_code, const std::string& p_out, const std::string& p_err) {
if (exit_code != 0) {
- SPDLOG_ERROR(
+ GF_CORE_LOG_ERROR(
"gnupg gen revoke execute error, process stderr: {}, process "
"stdout: {}",
p_err, p_out);
} else {
- SPDLOG_DEBUG(
+ GF_CORE_LOG_DEBUG(
"gnupg gen revoke exit_code: {}, process stdout size: {}",
exit_code, p_out.size());
}
@@ -139,7 +139,7 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key,
// Code From Gpg4Win
while (proc->canReadLine()) {
const QString line = QString::fromUtf8(proc->readLine()).trimmed();
- SPDLOG_DEBUG("line: {}", line.toStdString());
+ GF_CORE_LOG_DEBUG("line: {}", line.toStdString());
if (line == QLatin1String("[GNUPG:] GET_BOOL gen_revoke.okay")) {
proc->write("y\n");
} else if (line == QLatin1String("[GNUPG:] GET_LINE "
@@ -174,8 +174,8 @@ void GpgKeyOpera::GenerateKey(const std::shared_ptr<GenKeyInfo>& params,
const char* userid = userid_utf8.c_str();
auto algo_utf8 = params->GetAlgo() + params->GetKeySizeStr();
- SPDLOG_DEBUG("params: {} {}", params->GetAlgo(),
- params->GetKeySizeStr());
+ GF_CORE_LOG_DEBUG("params: {} {}", params->GetAlgo(),
+ params->GetKeySizeStr());
const char* algo = algo_utf8.c_str();
unsigned long expires = 0;
@@ -193,7 +193,8 @@ void GpgKeyOpera::GenerateKey(const std::shared_ptr<GenKeyInfo>& params,
if (params->IsNonExpired()) flags |= GPGME_CREATE_NOEXPIRE;
if (params->IsNoPassPhrase()) flags |= GPGME_CREATE_NOPASSWD;
- SPDLOG_DEBUG("key generation args: {}", userid, algo, expires, flags);
+ GF_CORE_LOG_DEBUG("key generation args: {}", userid, algo, expires,
+ flags);
err = gpgme_op_createkey(ctx.DefaultContext(), userid, algo, 0, expires,
nullptr, flags);
@@ -222,8 +223,8 @@ void GpgKeyOpera::GenerateSubkey(const GpgKey& key,
[key, &ctx = ctx_, params](const DataObjectPtr&) -> GpgError {
if (!params->IsSubKey()) return GPG_ERR_CANCELED;
- SPDLOG_DEBUG("generate subkey algo {} key size {}", params->GetAlgo(),
- params->GetKeySizeStr());
+ GF_CORE_LOG_DEBUG("generate subkey algo {} key size {}",
+ params->GetAlgo(), params->GetKeySizeStr());
auto algo_utf8 = (params->GetAlgo() + params->GetKeySizeStr());
const char* algo = algo_utf8.c_str();
@@ -242,7 +243,8 @@ void GpgKeyOpera::GenerateSubkey(const GpgKey& key,
if (params->IsNonExpired()) flags |= GPGME_CREATE_NOEXPIRE;
if (params->IsNoPassPhrase()) flags |= GPGME_CREATE_NOPASSWD;
- SPDLOG_DEBUG("args: {} {} {} {}", key.GetId(), algo, expires, flags);
+ GF_CORE_LOG_DEBUG("args: {} {} {} {}", key.GetId(), algo, expires,
+ flags);
auto err = gpgme_op_createsubkey(ctx.DefaultContext(),
static_cast<gpgme_key_t>(key), algo, 0,
@@ -267,10 +269,10 @@ auto GpgKeyOpera::ModifyTOFUPolicy(const GpgKey& key,
-> GpgError {
const auto gnupg_version = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.gnupg_version", std::string{"2.0.0"});
- SPDLOG_DEBUG("got gnupg version from rt: {}", gnupg_version);
+ GF_CORE_LOG_DEBUG("got gnupg version from rt: {}", gnupg_version);
if (CompareSoftwareVersion(gnupg_version, "2.1.10") < 0) {
- SPDLOG_ERROR("operator not support");
+ GF_CORE_LOG_ERROR("operator not support");
return GPG_ERR_NOT_SUPPORTED;
}
diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp
index 4610c504..63afb40c 100644
--- a/src/core/function/gpg/GpgUIDOperator.cpp
+++ b/src/core/function/gpg/GpgUIDOperator.cpp
@@ -60,7 +60,7 @@ auto GpgUIDOperator::SetPrimaryUID(const GpgKey& key, const std::string& uid)
auto GpgUIDOperator::AddUID(const GpgKey& key, const std::string& name,
const std::string& comment,
const std::string& email) -> bool {
- SPDLOG_DEBUG("new uuid: {} {} {}", name, comment, email);
+ GF_CORE_LOG_DEBUG("new uuid: {} {} {}", name, comment, email);
auto uid = boost::format("%1%(%2%)<%3%>") % name % comment % email;
return AddUID(key, uid.str());
}