1
0

Support multi-channel Context.

Make the test configurable.
Other modifications.
This commit is contained in:
Saturneric 2021-09-19 23:54:06 +08:00
parent 5874147d9e
commit 0f0b9510bb
11 changed files with 364 additions and 175 deletions

View File

@ -23,9 +23,13 @@
*/ */
#include "gpg/GpgContext.h" #include "gpg/GpgContext.h"
#include "GpgConstants.h"
#include <gpg-error.h>
#include <gpgme.h>
#include <functional> #include <functional>
#include <string>
#include "GpgConstants.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -39,7 +43,10 @@ namespace GpgFrontend {
* Constructor * Constructor
* Set up gpgme-context, set paths to app-run path * Set up gpgme-context, set paths to app-run path
*/ */
GpgContext::GpgContext() { GpgContext::GpgContext(bool independent_database,
std::string db_path,
int channel)
: SingletonFunctionObject<GpgContext>(channel) {
static bool _first = true; static bool _first = true;
if (_first) { if (_first) {
@ -57,25 +64,26 @@ GpgContext::GpgContext() {
check_gpg_error(gpgme_new(&_p_ctx)); check_gpg_error(gpgme_new(&_p_ctx));
_ctx_ref = CtxRefHandler(_p_ctx); _ctx_ref = CtxRefHandler(_p_ctx);
LOG(INFO) << "GpgContext _ctx_ref Created"; DLOG(INFO) << "GpgContext _ctx_ref Created";
auto engineInfo = gpgme_ctx_get_engine_info(*this); auto engineInfo = gpgme_ctx_get_engine_info(*this);
LOG(INFO) << "GpgContext gpgme_ctx_get_engine_info Called"; DLOG(INFO) << "GpgContext gpgme_ctx_get_engine_info Called";
// Check ENV before running // Check ENV before running
bool check_pass = false, find_openpgp = false, find_gpgconf = false, bool check_pass = false, find_openpgp = false, find_gpgconf = false,
find_assuan = false, find_cms = false; find_assuan = false, find_cms = false;
while (engineInfo != nullptr) { while (engineInfo != nullptr) {
LOG(INFO) << gpgme_get_protocol_name(engineInfo->protocol) << " " DLOG(INFO) << gpgme_get_protocol_name(engineInfo->protocol) << " "
<< engineInfo->file_name << " " << engineInfo->version; << engineInfo->file_name << " " << engineInfo->version;
if (engineInfo->protocol == GPGME_PROTOCOL_GPGCONF && if (engineInfo->protocol == GPGME_PROTOCOL_GPGCONF &&
strcmp(engineInfo->version, "1.0.0") != 0) strcmp(engineInfo->version, "1.0.0") != 0)
find_gpgconf = true; find_gpgconf = true;
if (engineInfo->protocol == GPGME_PROTOCOL_OpenPGP && if (engineInfo->protocol == GPGME_PROTOCOL_OpenPGP &&
strcmp(engineInfo->version, "1.0.0") != 0) strcmp(engineInfo->version, "1.0.0") != 0)
find_openpgp = true, info.AppPath = engineInfo->file_name; find_openpgp = true, info.AppPath = engineInfo->file_name,
info.DatabasePath = "default";
if (engineInfo->protocol == GPGME_PROTOCOL_CMS && if (engineInfo->protocol == GPGME_PROTOCOL_CMS &&
strcmp(engineInfo->version, "1.0.0") != 0) strcmp(engineInfo->version, "1.0.0") != 0)
find_cms = true; find_cms = true;
@ -87,11 +95,21 @@ GpgContext::GpgContext() {
if (find_gpgconf && find_openpgp && find_cms && find_assuan) if (find_gpgconf && find_openpgp && find_cms && find_assuan)
check_pass = true; check_pass = true;
LOG(INFO) << "GpgContext check_pass " << check_pass; DLOG(INFO) << "GpgContext check_pass " << check_pass;
if (!check_pass) { if (!check_pass) {
good_ = false; good_ = false;
return; return;
} else { } else {
// Set Independent Database
if (independent_database) {
info.DatabasePath = db_path;
auto err = gpgme_ctx_set_engine_info(
_ctx_ref.get(), GPGME_PROTOCOL_OpenPGP, info.AppPath.c_str(),
info.DatabasePath.c_str());
assert(check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR);
DLOG(INFO) << "Set independent_database path" << db_path;
}
/** Setting the output type must be done at the beginning */ /** Setting the output type must be done at the beginning */
/** think this means ascii-armor --> ? */ /** think this means ascii-armor --> ? */
gpgme_set_armor(*this, 1); gpgme_set_armor(*this, 1);
@ -104,6 +122,7 @@ GpgContext::GpgContext() {
GPGME_KEYLIST_MODE_WITH_TOFU)); GPGME_KEYLIST_MODE_WITH_TOFU));
good_ = true; good_ = true;
} }
DLOG(INFO) << "GpgContext init done ";
} }
bool GpgContext::good() const { bool GpgContext::good() const {

View File

@ -35,21 +35,22 @@ namespace GpgFrontend {
* Custom Encapsulation of GpgME APIs * Custom Encapsulation of GpgME APIs
*/ */
class GpgContext : public SingletonFunctionObject<GpgContext> { class GpgContext : public SingletonFunctionObject<GpgContext> {
public:
public: GpgContext(bool independent_database = false,
GpgContext(); std::string path = std::string(),
int channel = 0);
~GpgContext() override = default; ~GpgContext() override = default;
[[nodiscard]] bool good() const; [[nodiscard]] bool good() const;
[[nodiscard]] const GpgInfo &GetInfo() const { return info; } [[nodiscard]] const GpgInfo& GetInfo() const { return info; }
static std::string getGpgmeVersion(); static std::string getGpgmeVersion();
operator gpgme_ctx_t() const { return _ctx_ref.get(); } operator gpgme_ctx_t() const { return _ctx_ref.get(); }
private: private:
GpgInfo info; GpgInfo info;
struct _ctx_ref_deletor { struct _ctx_ref_deletor {
@ -59,17 +60,17 @@ private:
} }
}; };
using CtxRefHandler = using CtxRefHandler = std::unique_ptr<struct gpgme_context, _ctx_ref_deletor>;
std::unique_ptr<struct gpgme_context, _ctx_ref_deletor>;
CtxRefHandler _ctx_ref = nullptr; CtxRefHandler _ctx_ref = nullptr;
bool good_ = true; bool good_ = true;
public: public:
static gpgme_error_t test_passphrase_cb(void *opaque, const char *uid_hint, static gpgme_error_t test_passphrase_cb(void* opaque,
const char *passphrase_info, const char* uid_hint,
int last_was_bad, int fd) { const char* passphrase_info,
int last_was_bad,
int fd) {
LOG(INFO) << "test_passphrase_cb Called"; LOG(INFO) << "test_passphrase_cb Called";
size_t res; size_t res;
char pass[] = "abcdefg\n"; char pass[] = "abcdefg\n";
@ -82,7 +83,7 @@ public:
(void)last_was_bad; (void)last_was_bad;
do { do {
res = gpgme_io_write(fd, &pass[off], pass_len - off); res = gpgme_io_write(fd, &pass[off], pass_len - off);
if (res > 0) if (res > 0)
off += res; off += res;
} while (res > 0 && off != pass_len); } while (res > 0 && off != pass_len);
@ -92,6 +93,6 @@ public:
void SetPassphraseCb(decltype(test_passphrase_cb) func) const; void SetPassphraseCb(decltype(test_passphrase_cb) func) const;
}; };
} // namespace GpgFrontend } // namespace GpgFrontend
#endif // __SGPGMEPP_CONTEXT_H__ #endif // __SGPGMEPP_CONTEXT_H__

View File

@ -25,44 +25,121 @@
#ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H #ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
#define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H #define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
#include <map>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <shared_mutex>
#include <stdexcept>
#include <string>
#include <easyloggingpp/easylogging++.h> #include <easyloggingpp/easylogging++.h>
namespace GpgFrontend { namespace GpgFrontend {
template <typename T> class SingletonFunctionObject {
public: template <typename T>
static T &GetInstance() { class SingletonFunctionObject {
LOG(INFO) << "SingletonFunctionObject GetInstance Calling " public:
<< typeid(T).name(); static T& GetInstance(int channel = 0) {
std::lock_guard<std::mutex> guard(_instance_mutex); DLOG(INFO) << "SingletonFunctionObject GetInstance Calling "
if (_instance == nullptr) << typeid(T).name() << " channel " << channel;
_instance = std::make_unique<T>(); if (!channel) {
return *_instance; std::lock_guard<std::mutex> guard(_instance_mutex);
if (_instance == nullptr)
_instance = std::make_unique<T>();
return *_instance;
} else {
// read _instances_map
decltype(_instances_map.end()) _it;
{
std::shared_lock lock(_instances_mutex);
_it = _instances_map.find(channel);
}
if (_it != _instances_map.end())
return *_it->second;
else
return CreateInstance(channel);
}
} }
SingletonFunctionObject(T &&) = delete; static T& CreateInstance(int channel, std::unique_ptr<T> p_obj = nullptr) {
DLOG(INFO) << "SingletonFunctionObject CreateInstance Calling "
<< typeid(T).name() << " channel " << channel;
if (!channel)
return *_instance;
SingletonFunctionObject(const T &) = delete; // read _instances_map
decltype(_instances_map.end()) _it;
{
std::shared_lock lock(_instances_mutex);
_it = _instances_map.find(channel);
}
if (_it == _instances_map.end()) {
{
std::lock_guard<std::mutex> guard(_default_channel_mutex);
int tmp = channel;
std::swap(_default_channel, tmp);
if (p_obj == nullptr)
p_obj = std::make_unique<T>();
std::swap(_default_channel, tmp);
}
T* obj = p_obj.get();
void operator=(const T &) = delete; // change _instances_map
{
std::unique_lock lock(_instances_mutex);
_instances_map.insert({channel, std::move(p_obj)});
}
return *obj;
} else {
return *_it->second;
}
}
protected: static int GetDefaultChannel() { return _default_channel; }
SingletonFunctionObject() = default;
int GetChannel() const { return channel_; }
SingletonFunctionObject(T&&) = delete;
SingletonFunctionObject(const T&) = delete;
void operator=(const T&) = delete;
protected:
SingletonFunctionObject() {}
SingletonFunctionObject(int channel) : channel_(channel) {}
virtual ~SingletonFunctionObject() = default; virtual ~SingletonFunctionObject() = default;
private: private:
int channel_ = _default_channel;
static int _default_channel;
static std::mutex _default_channel_mutex;
static std::mutex _instance_mutex; static std::mutex _instance_mutex;
static std::shared_mutex _instances_mutex;
static std::unique_ptr<T> _instance; static std::unique_ptr<T> _instance;
static std::map<int, std::unique_ptr<T>> _instances_map;
}; };
template <typename T> std::mutex SingletonFunctionObject<T>::_instance_mutex; template <typename T>
int SingletonFunctionObject<T>::_default_channel = 0;
template <typename T>
std::mutex SingletonFunctionObject<T>::_default_channel_mutex;
template <typename T>
std::mutex SingletonFunctionObject<T>::_instance_mutex;
template <typename T>
std::shared_mutex SingletonFunctionObject<T>::_instances_mutex;
template <typename T> template <typename T>
std::unique_ptr<T> SingletonFunctionObject<T>::_instance = nullptr; std::unique_ptr<T> SingletonFunctionObject<T>::_instance = nullptr;
} // namespace GpgFrontend template <typename T>
std::map<int, std::unique_ptr<T>> SingletonFunctionObject<T>::_instances_map;
#endif // GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H } // namespace GpgFrontend
#endif // GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H

View File

@ -32,6 +32,7 @@ GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetKey(const std::string& fpr) {
gpgme_get_key(ctx, fpr.c_str(), &_p_key, 1); gpgme_get_key(ctx, fpr.c_str(), &_p_key, 1);
if (_p_key == nullptr) if (_p_key == nullptr)
DLOG(WARNING) << "GpgKeyGetter GetKey _p_key Null"; DLOG(WARNING) << "GpgKeyGetter GetKey _p_key Null";
assert(_p_key != nullptr);
return GpgKey(std::move(_p_key)); return GpgKey(std::move(_p_key));
} }

View File

@ -32,19 +32,19 @@
namespace GpgFrontend { namespace GpgFrontend {
class GpgKeyGetter : public SingletonFunctionObject<GpgKeyGetter> { class GpgKeyGetter : public SingletonFunctionObject<GpgKeyGetter> {
public:
GpgKeyGetter() = default;
public: GpgKey GetKey(const std::string& fpr);
GpgKey GetKey(const std::string &fpr);
GpgKey GetPubkey(const std::string &fpr); GpgKey GetPubkey(const std::string& fpr);
KeyListPtr FetchKey(); KeyListPtr FetchKey();
GpgKeyGetter() = default; private:
GpgContext& ctx =
private: GpgContext::GetInstance(SingletonFunctionObject::GetDefaultChannel());
GpgContext &ctx = GpgContext::GetInstance();
}; };
} // namespace GpgFrontend } // namespace GpgFrontend
#endif // GPGFRONTEND_ZH_CN_TS_GPGKEYGETTER_H #endif // GPGFRONTEND_ZH_CN_TS_GPGKEYGETTER_H

View File

@ -1,32 +1,62 @@
/**
* This file is part of GPGFrontend.
*
* GPGFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <https://www.gnu.org/licenses/>.
*
* The initial version of the source code is inherited from gpg4usb-team.
* Their source code version also complies with GNU General Public License.
*
* The source code version of this software was modified and released
* by Saturneric<eric@bktus.com> starting on May 12, 2021.
*
*/
#include "gpg/function/GpgKeyImportExportor.h" #include "gpg/function/GpgKeyImportExportor.h"
#include "GpgConstants.h" #include "GpgConstants.h"
#include <gpg-error.h>
/** /**
* Import key pair * Import key pair
* @param inBuffer input byte array * @param inBuffer input byte array
* @return Import information * @return Import information
*/ */
GpgFrontend::GpgImportInformation GpgFrontend::GpgImportInformation GpgFrontend::GpgKeyImportExportor::ImportKey(
GpgFrontend::GpgKeyImportExportor::ImportKey(StdBypeArrayPtr in_buffer) { StdBypeArrayPtr in_buffer) {
LOG(INFO) << "ImportKey Called in_buffer Size " << in_buffer->size(); DLOG(INFO) << "ImportKey called in_buffer Size " << in_buffer->size();
if (in_buffer->empty())
return GpgImportInformation();
GpgData data_in(in_buffer->data(), in_buffer->size()); GpgData data_in(in_buffer->data(), in_buffer->size());
DLOG(INFO) << "ImportKey gpgme_op_import";
auto err = check_gpg_error(gpgme_op_import(ctx, data_in)); auto err = check_gpg_error(gpgme_op_import(ctx, data_in));
assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR);
gpgme_import_result_t result; gpgme_import_result_t result;
DLOG(INFO) << "ImportKey gpgme_op_import_result";
result = gpgme_op_import_result(ctx); result = gpgme_op_import_result(ctx);
gpgme_import_status_t status = result->imports; gpgme_import_status_t status = result->imports;
auto import_info = std::make_unique<GpgImportInformation>(result); auto import_info = std::make_unique<GpgImportInformation>(result);
LOG(INFO) << "ImportKey import_information " << result->not_imported << " " DLOG(INFO) << "ImportKey import_information " << result->not_imported << " "
<< result->imported << " " << result->considered; << result->imported << " " << result->considered;
while (status != nullptr) { while (status != nullptr) {
GpgImportedKey key; GpgImportedKey key;
key.import_status = static_cast<int>(status->status); key.import_status = static_cast<int>(status->status);
key.fpr = status->fpr; key.fpr = status->fpr;
import_info->importedKeys.emplace_back(key); import_info->importedKeys.emplace_back(key);
status = status->next; status = status->next;
LOG(INFO) << "ImportKey Fpr " << key.fpr << " Status " << key.import_status; DLOG(INFO) << "ImportKey Fpr " << key.fpr << " Status "
<< key.import_status;
} }
return *import_info; return *import_info;
} }
@ -38,7 +68,8 @@ GpgFrontend::GpgKeyImportExportor::ImportKey(StdBypeArrayPtr in_buffer) {
* @return if success * @return if success
*/ */
bool GpgFrontend::GpgKeyImportExportor::ExportKeys( bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
KeyIdArgsListPtr &uid_list, BypeArrayPtr &out_buffer) const { KeyIdArgsListPtr& uid_list,
BypeArrayPtr& out_buffer) const {
if (uid_list->empty()) if (uid_list->empty())
return false; return false;
@ -49,8 +80,8 @@ bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
auto err = gpgme_op_export(ctx, (*uid_list)[i].c_str(), 0, data_out); auto err = gpgme_op_export(ctx, (*uid_list)[i].c_str(), 0, data_out);
assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR);
LOG(INFO) << "exportKeys read_bytes" DLOG(INFO) << "exportKeys read_bytes"
<< gpgme_data_seek(data_out, 0, SEEK_END); << gpgme_data_seek(data_out, 0, SEEK_END);
auto temp_out_buffer = data_out.Read2Buffer(); auto temp_out_buffer = data_out.Read2Buffer();
std::swap(out_buffer, temp_out_buffer); std::swap(out_buffer, temp_out_buffer);
@ -66,9 +97,10 @@ bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
* @return if success * @return if success
*/ */
bool GpgFrontend::GpgKeyImportExportor::ExportKeys( bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
KeyArgsList &keys, BypeArrayPtr &out_buffer) const { KeyArgsList& keys,
BypeArrayPtr& out_buffer) const {
KeyIdArgsListPtr key_ids = std::make_unique<std::vector<std::string>>(); KeyIdArgsListPtr key_ids = std::make_unique<std::vector<std::string>>();
for (const auto &key : keys) for (const auto& key : keys)
key_ids->push_back(key.id()); key_ids->push_back(key.id());
return ExportKeys(key_ids, out_buffer); return ExportKeys(key_ids, out_buffer);
} }
@ -80,9 +112,9 @@ bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
* @return if successful * @return if successful
*/ */
bool GpgFrontend::GpgKeyImportExportor::ExportSecretKey( bool GpgFrontend::GpgKeyImportExportor::ExportSecretKey(
const GpgKey &key, BypeArrayPtr out_buffer) const { const GpgKey& key,
BypeArrayPtr out_buffer) const {
LOG(INFO) << "Export Secret Key" << key.id().c_str(); DLOG(INFO) << "Export Secret Key" << key.id().c_str();
gpgme_key_t target_key[2] = {gpgme_key_t(key), nullptr}; gpgme_key_t target_key[2] = {gpgme_key_t(key), nullptr};

View File

@ -25,6 +25,7 @@
#ifndef _GPGKEYIMPORTEXPORTOR_H #ifndef _GPGKEYIMPORTEXPORTOR_H
#define _GPGKEYIMPORTEXPORTOR_H #define _GPGKEYIMPORTEXPORTOR_H
#include <string>
#include "gpg/GpgConstants.h" #include "gpg/GpgConstants.h"
#include "gpg/GpgContext.h" #include "gpg/GpgContext.h"
#include "gpg/GpgFunctionObject.h" #include "gpg/GpgFunctionObject.h"
@ -33,7 +34,7 @@
namespace GpgFrontend { namespace GpgFrontend {
class GpgImportedKey { class GpgImportedKey {
public: public:
std::string fpr; std::string fpr;
int import_status; int import_status;
}; };
@ -41,7 +42,7 @@ public:
typedef std::list<GpgImportedKey> GpgImportedKeyList; typedef std::list<GpgImportedKey> GpgImportedKeyList;
class GpgImportInformation { class GpgImportInformation {
public: public:
GpgImportInformation() = default; GpgImportInformation() = default;
explicit GpgImportInformation(gpgme_import_result_t result) { explicit GpgImportInformation(gpgme_import_result_t result) {
@ -93,19 +94,20 @@ public:
class GpgKeyImportExportor class GpgKeyImportExportor
: public SingletonFunctionObject<GpgKeyImportExportor> { : public SingletonFunctionObject<GpgKeyImportExportor> {
public: public:
GpgImportInformation ImportKey(StdBypeArrayPtr inBuffer); GpgImportInformation ImportKey(StdBypeArrayPtr inBuffer);
bool ExportKeys(KeyIdArgsListPtr &uid_list, BypeArrayPtr &out_buffer) const; bool ExportKeys(KeyIdArgsListPtr& uid_list, BypeArrayPtr& out_buffer) const;
bool ExportKeys(KeyArgsList &keys, BypeArrayPtr &outBuffer) const; bool ExportKeys(KeyArgsList& keys, BypeArrayPtr& outBuffer) const;
bool ExportSecretKey(const GpgKey &key, BypeArrayPtr outBuffer) const; bool ExportSecretKey(const GpgKey& key, BypeArrayPtr outBuffer) const;
private: private:
GpgContext &ctx = GpgContext::GetInstance(); GpgContext& ctx =
GpgContext::GetInstance(SingletonFunctionObject::GetDefaultChannel());
}; };
} // namespace GpgFrontend } // namespace GpgFrontend
#endif // _GPGKEYIMPORTEXPORTOR_H #endif // _GPGKEYIMPORTEXPORTOR_H

View File

@ -2,6 +2,7 @@ find_package(GTest REQUIRED)
# Set configure for test # Set configure for test
file(COPY ${CMAKE_SOURCE_DIR}/test/conf DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FOLLOW_SYMLINK_CHAIN) file(COPY ${CMAKE_SOURCE_DIR}/test/conf DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FOLLOW_SYMLINK_CHAIN)
file(COPY ${CMAKE_SOURCE_DIR}/test/data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FOLLOW_SYMLINK_CHAIN)
aux_source_directory(. TEST_SOURCE) aux_source_directory(. TEST_SOURCE)

View File

@ -28,7 +28,12 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <boost/date_time/gregorian/parsers.hpp> #include <boost/date_time/gregorian/parsers.hpp>
#include <boost/dll.hpp> #include <boost/dll.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <fstream>
#include <memory> #include <memory>
#include <string>
#include <vector>
#include "gpg/GpgConstants.h" #include "gpg/GpgConstants.h"
#include "gpg/function/GpgKeyGetter.h" #include "gpg/function/GpgKeyGetter.h"
@ -38,97 +43,19 @@
TEST(GpgKeyTest, GpgCoreTest) {} TEST(GpgKeyTest, GpgCoreTest) {}
class GpgCoreTest : public ::testing::Test { class GpgCoreTest : public ::testing::Test {
protected: protected:
GpgFrontend::StdBypeArrayPtr secret_key_ = std::make_unique<std::string>( std::vector<GpgFrontend::StdBypeArrayPtr> secret_keys_;
"-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
"lQVYBGE0XVEBDADHYmnEbRB8hxqyQmaLmIRU71PTMZc162qWoWTMaPd7a8gQcQwc" boost::filesystem::path parent_path =
"MUFYHp3mAmoHYUAKyT0lgpyj7UqGDdiAOt8z+nW6tR2Wu2xe6o0su/oK8qGtX37e" boost::dll::program_location().parent_path();
"bexiWcsMftrk/uR+l2G7JcCKMTAszLbyDgg1IaJ/SaVicKaO1CRjD5ZlNa2IQVOG"
"bw0va1CevF6yw5rvc5r300p/kwcKX4taUyPaCT10ZxZnpZUhdsAIX5DfvWURoZ0q" boost::filesystem::path config_path = parent_path / "conf" / "core.cfg";
"jy4JdQFlufhPzSJZ2VoCXn37FeXwEz1Vm8VzyVV70pPWN5osMcNBsRO4nr8cYIxo"
"1PiErm3VdDUHPZ8dKKMlrLaGh3De3ohK47GSLDqBGg/FNnekRwNqBT+HLvfk5Kko"
"lNsC7eyRSagI7IRY+KgjKNpT/9QUGYP9llTonQ2V58XarDFDy8SU/3yOqWaeu0Op"
"A/fpqkp7JF3mGLXzKOZ4ueEOMkh+DsAOPTOQTcbYvnCz8jvHUPlSUqU1Y/7xU6BW"
"rzgqajU563xoxCMAEQEAAQAL/2IGy5NsP8fJsOFlbf9B/AW6KM9TuVEkLiJitSke"
"jlZa1mDnA5o0yTimzODR3QlF0fO7ntl7TsH1n0crNX9N8oEeqZUjCKob+Zrs3H3a"
"6YNKaRzRL5HyH173YLIDCGG/w91NVhpp5DDNIC9WcretGHHu2HKWZb5xPiJIwJ8H"
"gdy+uFOeMo+Mt8HRlDCG0lQ3gUwq3Uzsz9rLEZITCXNeHulK07EQId7RdPGf7afw"
"PE0UU8WIXLoY7PxvT0GRXjj11AheEGNHcebirHbgbLWoevY/+h+r/yAdRns+S2l+"
"PsShh6ki8bH7InI7L79v+021l89FfTZYixwscvwLBN4QWp6FLwqwDJjEHnZRxjCX"
"Y5v7j9gHhh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oreTest() = default;
virtual ~GpgCoreTest() = default; virtual ~GpgCoreTest() = default;
virtual void SetUp() { virtual void SetUp() {
auto config_path = DLOG(INFO) << "SetUp called";
boost::dll::program_location().parent_path() / "conf" / "core.cfg";
using namespace libconfig; using namespace libconfig;
Config cfg; Config cfg;
ASSERT_NO_THROW(cfg.readFile(config_path.c_str())); ASSERT_NO_THROW(cfg.readFile(config_path.c_str()));
@ -137,12 +64,53 @@ class GpgCoreTest : public ::testing::Test {
ASSERT_TRUE(root.exists("independent_database")); ASSERT_TRUE(root.exists("independent_database"));
bool independent_database = true; bool independent_database = true;
ASSERT_TRUE(root.lookupValue("independent_database", independent_database)); ASSERT_TRUE(root.lookupValue("independent_database", independent_database));
if (independent_database)
GpgFrontend::GpgContext::GetInstance().SetPassphraseCb( DLOG(INFO) << "SetUp independent_database";
GpgFrontend::GpgContext::test_passphrase_cb); if (independent_database) {
GpgFrontend::GpgKeyImportExportor::GetInstance().ImportKey( ASSERT_TRUE(root.exists("independent_db_path"));
std::move(this->secret_key_)); std::string relative_db_path;
ASSERT_TRUE(root.lookupValue("independent_db_path", relative_db_path));
auto db_path = parent_path / relative_db_path;
if (!boost::filesystem::exists(db_path)) {
boost::filesystem::create_directory(db_path);
}
DLOG(INFO) << "GpgFrontend::GpgContext::CreateInstance";
GpgFrontend::GpgContext::CreateInstance(
1, std::make_unique<GpgFrontend::GpgContext>(true, db_path.c_str()));
DLOG(INFO) << "db_path " << db_path;
}
ASSERT_TRUE(root.exists("data_path"));
std::string relative_data_path;
ASSERT_TRUE(root.lookupValue("data_path", relative_data_path));
auto data_path = parent_path / relative_data_path;
ASSERT_TRUE(boost::filesystem::exists(data_path));
if (root.exists("load_keys.private_keys")) {
LOG(INFO) << "loading private keys";
auto& private_keys = root.lookup("load_keys.private_keys");
for (auto it = private_keys.begin(); it != private_keys.end(); it++) {
ASSERT_TRUE(it->exists("filename"));
std::string filename;
it->lookupValue("filename", filename);
auto data_file_path = data_path / filename;
DLOG(INFO) << "private file path" << data_file_path.string();
std::string data =
GpgFrontend::read_all_data_in_file(data_file_path.string());
secret_keys_.push_back(std::make_unique<std::string>(data));
}
LOG(INFO) << "loaded private keys";
}
GpgFrontend::GpgContext::GetInstance(1).SetPassphraseCb(
GpgFrontend::GpgContext::test_passphrase_cb);
for (auto& secret_key : secret_keys_) {
GpgFrontend::GpgKeyImportExportor::GetInstance(1).ImportKey(
std::move(secret_key));
}
} }
virtual void TearDown() {} virtual void TearDown() {}
@ -154,7 +122,11 @@ class GpgCoreTest : public ::testing::Test {
}; };
TEST_F(GpgCoreTest, CoreInitTest) { TEST_F(GpgCoreTest, CoreInitTest) {
auto& ctx = GpgFrontend::GpgContext::GetInstance(); auto& ctx = GpgFrontend::GpgContext::GetInstance(1);
DLOG(INFO) << "CoreInitTest ctx DatabasePath " << ctx.GetInfo().DatabasePath;
auto& ctx_default = GpgFrontend::GpgContext::GetInstance();
DLOG(INFO) << "CoreInitTest ctx_default DatabasePath "
<< ctx_default.GetInfo().DatabasePath;
ASSERT_TRUE(ctx.good()); ASSERT_TRUE(ctx.good());
} }
@ -171,7 +143,7 @@ TEST_F(GpgCoreTest, GpgDataTest) {
} }
TEST_F(GpgCoreTest, GpgKeyTest) { TEST_F(GpgCoreTest, GpgKeyTest) {
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey( auto key = GpgFrontend::GpgKeyGetter::GetInstance(1).GetKey(
"9490795B78F8AFE9F93BD09281704859182661FB"); "9490795B78F8AFE9F93BD09281704859182661FB");
ASSERT_TRUE(key.good()); ASSERT_TRUE(key.good());
ASSERT_TRUE(key.is_private_key()); ASSERT_TRUE(key.is_private_key());
@ -214,7 +186,7 @@ TEST_F(GpgCoreTest, GpgKeyTest) {
} }
TEST_F(GpgCoreTest, GpgSubKeyTest) { TEST_F(GpgCoreTest, GpgSubKeyTest) {
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey( auto key = GpgFrontend::GpgKeyGetter::GetInstance(1).GetKey(
"9490795B78F8AFE9F93BD09281704859182661FB"); "9490795B78F8AFE9F93BD09281704859182661FB");
auto sub_keys = key.subKeys(); auto sub_keys = key.subKeys();
ASSERT_EQ(sub_keys->size(), 2); ASSERT_EQ(sub_keys->size(), 2);
@ -244,7 +216,7 @@ TEST_F(GpgCoreTest, GpgSubKeyTest) {
} }
TEST_F(GpgCoreTest, GpgUIDTest) { TEST_F(GpgCoreTest, GpgUIDTest) {
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey( auto key = GpgFrontend::GpgKeyGetter::GetInstance(1).GetKey(
"9490795B78F8AFE9F93BD09281704859182661FB"); "9490795B78F8AFE9F93BD09281704859182661FB");
auto uids = key.uids(); auto uids = key.uids();
ASSERT_EQ(uids->size(), 1); ASSERT_EQ(uids->size(), 1);
@ -259,7 +231,7 @@ TEST_F(GpgCoreTest, GpgUIDTest) {
} }
TEST_F(GpgCoreTest, GpgKeySignatureTest) { TEST_F(GpgCoreTest, GpgKeySignatureTest) {
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey( auto key = GpgFrontend::GpgKeyGetter::GetInstance(1).GetKey(
"9490795B78F8AFE9F93BD09281704859182661FB"); "9490795B78F8AFE9F93BD09281704859182661FB");
auto uids = key.uids(); auto uids = key.uids();
ASSERT_EQ(uids->size(), 1); ASSERT_EQ(uids->size(), 1);
@ -283,10 +255,10 @@ TEST_F(GpgCoreTest, GpgKeySignatureTest) {
} }
TEST_F(GpgCoreTest, GpgKeyGetterTest) { TEST_F(GpgCoreTest, GpgKeyGetterTest) {
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey( auto key = GpgFrontend::GpgKeyGetter::GetInstance(1).GetKey(
"9490795B78F8AFE9F93BD09281704859182661FB"); "9490795B78F8AFE9F93BD09281704859182661FB");
ASSERT_TRUE(key.good()); ASSERT_TRUE(key.good());
auto keys = GpgFrontend::GpgKeyGetter::GetInstance().FetchKey(); auto keys = GpgFrontend::GpgKeyGetter::GetInstance(1).FetchKey();
ASSERT_GE(keys->size(), 1); ASSERT_GE(keys->size(), 1);
ASSERT_TRUE(find(keys->begin(), keys->end(), key) != keys->end()); ASSERT_TRUE(find(keys->begin(), keys->end(), key) != keys->end());

View File

@ -1,7 +1,9 @@
# Example application configuration file # core test configuration file
version = "1.0"; version = "1.0";
independent_database = true; independent_database = true;
load_keys: independent_db_path = "db"
data_path = "data"
load_keys =
{ {
private_keys = ({ private_keys = ({
filename = "pv1.key"; filename = "pv1.key";

82
test/data/pv1.key Normal file
View File

@ -0,0 +1,82 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQVYBGE0XVEBDADHYmnEbRB8hxqyQmaLmIRU71PTMZc162qWoWTMaPd7a8gQcQwc
MUFYHp3mAmoHYUAKyT0lgpyj7UqGDdiAOt8z+nW6tR2Wu2xe6o0su/oK8qGtX37e
bexiWcsMftrk/uR+l2G7JcCKMTAszLbyDgg1IaJ/SaVicKaO1CRjD5ZlNa2IQVOG
bw0va1CevF6yw5rvc5r300p/kwcKX4taUyPaCT10ZxZnpZUhdsAIX5DfvWURoZ0q
jy4JdQFlufhPzSJZ2VoCXn37FeXwEz1Vm8VzyVV70pPWN5osMcNBsRO4nr8cYIxo
1PiErm3VdDUHPZ8dKKMlrLaGh3De3ohK47GSLDqBGg/FNnekRwNqBT+HLvfk5Kko
lNsC7eyRSagI7IRY+KgjKNpT/9QUGYP9llTonQ2V58XarDFDy8SU/3yOqWaeu0Op
A/fpqkp7JF3mGLXzKOZ4ueEOMkh+DsAOPTOQTcbYvnCz8jvHUPlSUqU1Y/7xU6BW
rzgqajU563xoxCMAEQEAAQAL/2IGy5NsP8fJsOFlbf9B/AW6KM9TuVEkLiJitSke
jlZa1mDnA5o0yTimzODR3QlF0fO7ntl7TsH1n0crNX9N8oEeqZUjCKob+Zrs3H3a
6YNKaRzRL5HyH173YLIDCGG/w91NVhpp5DDNIC9WcretGHHu2HKWZb5xPiJIwJ8H
gdy+uFOeMo+Mt8HRlDCG0lQ3gUwq3Uzsz9rLEZITCXNeH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