29 #ifndef __SGPGMEPP_CONTEXT_H__
30 #define __SGPGMEPP_CONTEXT_H__
35 #include "GpgConstants.h"
36 #include "GpgFunctionObject.h"
48 bool independent_database =
false;
49 std::string db_path = {};
51 bool gpg_alone =
false;
52 std::string gpg_path = {};
54 bool test_mode =
false;
56 bool offline_mode =
false;
57 bool auto_import_missing_key =
false;
59 bool custom_gpgconf =
false;
60 std::string custom_gpgconf_path;
100 [[nodiscard]]
bool good()
const;
107 [[nodiscard]]
const GpgInfo& GetInfo(
bool refresh =
false);
114 operator gpgme_ctx_t()
const {
return _ctx_ref.get(); }
118 GpgContextInitArgs args_{};
119 bool extend_info_loaded_ =
false;
120 std::shared_mutex preload_lock_{};
126 void post_init_ctx();
133 std::string need_user_input_passphrase();
139 std::optional<std::string> check_binary_chacksum(std::filesystem::path);
146 void operator()(gpgme_ctx_t _ctx);
149 using CtxRefHandler =
150 std::unique_ptr<struct gpgme_context, _ctx_ref_deleter>;
151 CtxRefHandler _ctx_ref =
nullptr;
159 void SignalNeedUserInputPassphrase();
172 static gpgme_error_t test_passphrase_cb(
void* opaque,
const char* uid_hint,
173 const char* passphrase_info,
174 int last_was_bad,
int fd);
186 static gpgme_error_t custom_passphrase_cb(
void* opaque,
const char* uid_hint,
187 const char* passphrase_info,
188 int last_was_bad,
int fd);
198 static gpgme_error_t test_status_cb(
void* hook,
const char* keyword,
206 void SetPassphraseCb(gpgme_passphrase_cb_t func)
const;
Definition: GpgContext.h:71
~GpgContext() override=default
Destroy the Gpg Context object.
Use to record some info about gnupg.
Definition: GpgInfo.h:40
Definition: GpgFunctionObject.h:150
Definition: CoreCommonUtil.cpp:31
Definition: GpgContext.h:46
Definition: GpgContext.h:145