aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg/function')
-rw-r--r--src/gpg/function/BasicOperator.cpp16
-rw-r--r--src/gpg/function/GpgKeyGetter.cpp15
-rw-r--r--src/gpg/function/GpgKeyGetter.h4
3 files changed, 27 insertions, 8 deletions
diff --git a/src/gpg/function/BasicOperator.cpp b/src/gpg/function/BasicOperator.cpp
index 5f6ffb85..f91282c4 100644
--- a/src/gpg/function/BasicOperator.cpp
+++ b/src/gpg/function/BasicOperator.cpp
@@ -48,7 +48,7 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Encrypt(
auto temp_data_out = data_out.Read2Buffer();
std::swap(temp_data_out, out_buffer);
- auto temp_result = GpgEncrResult(gpgme_op_encrypt_result(ctx));
+ auto temp_result = _new_result(gpgme_op_encrypt_result(ctx));
std::swap(result, temp_result);
return err;
@@ -65,7 +65,7 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Decrypt(
auto temp_data_out = data_out.Read2Buffer();
std::swap(temp_data_out, out_buffer);
- auto temp_result = GpgDecrResult(gpgme_op_decrypt_result(ctx));
+ auto temp_result = _new_result(gpgme_op_decrypt_result(ctx));
std::swap(result, temp_result);
return err;
@@ -86,7 +86,7 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Verify(
} else
err = check_gpg_error(gpgme_op_verify(ctx, data_in, nullptr, data_out));
- auto temp_result = GpgVerifyResult(gpgme_op_verify_result(ctx));
+ auto temp_result = _new_result(gpgme_op_verify_result(ctx));
std::swap(result, temp_result);
return err;
@@ -122,7 +122,7 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Sign(KeyListPtr keys,
auto temp_data_out = data_out.Read2Buffer();
std::swap(temp_data_out, out_buffer);
- auto temp_result = GpgSignResult(gpgme_op_sign_result(ctx));
+ auto temp_result = _new_result(gpgme_op_sign_result(ctx));
std::swap(result, temp_result);
@@ -141,10 +141,10 @@ gpgme_error_t GpgFrontend::BasicOperator::DecryptVerify(
auto temp_data_out = data_out.Read2Buffer();
std::swap(temp_data_out, out_buffer);
- auto temp_decr_result = GpgDecrResult(gpgme_op_decrypt_result(ctx));
+ auto temp_decr_result = _new_result(gpgme_op_decrypt_result(ctx));
std::swap(decrypt_result, temp_decr_result);
- auto temp_verify_result = GpgVerifyResult(gpgme_op_verify_result(ctx));
+ auto temp_verify_result = _new_result(gpgme_op_verify_result(ctx));
std::swap(verify_result, temp_verify_result);
return err;
@@ -176,9 +176,9 @@ gpgme_error_t GpgFrontend::BasicOperator::EncryptSign(
auto temp_data_out = data_out.Read2Buffer();
std::swap(temp_data_out, out_buffer);
- auto temp_encr_result = GpgEncrResult(gpgme_op_encrypt_result(ctx));
+ auto temp_encr_result = _new_result(gpgme_op_encrypt_result(ctx));
swap(encr_result, temp_encr_result);
- auto temp_sign_result = GpgSignResult(gpgme_op_sign_result(ctx));
+ auto temp_sign_result = _new_result(gpgme_op_sign_result(ctx));
swap(sign_result, temp_sign_result);
return err;
diff --git a/src/gpg/function/GpgKeyGetter.cpp b/src/gpg/function/GpgKeyGetter.cpp
index be27d69e..26973eda 100644
--- a/src/gpg/function/GpgKeyGetter.cpp
+++ b/src/gpg/function/GpgKeyGetter.cpp
@@ -67,9 +67,24 @@ GpgFrontend::KeyLinkListPtr GpgFrontend::GpgKeyGetter::FetchKey() {
return keys_list;
}
+
GpgFrontend::KeyListPtr GpgFrontend::GpgKeyGetter::GetKeys(
const KeyIdArgsListPtr& ids) {
auto keys = std::make_unique<KeyArgsList>();
for (const auto& id : *ids) keys->push_back(GetKey(id));
return keys;
}
+
+GpgFrontend::KeyLinkListPtr GpgFrontend::GpgKeyGetter::GetKeysCopy(
+ const GpgFrontend::KeyLinkListPtr& keys) {
+ auto keys_copy = std::make_unique<GpgKeyLinkList>();
+ for (const auto& key : *keys) keys_copy->push_back(key.copy());
+ return keys_copy;
+}
+
+GpgFrontend::KeyListPtr GpgFrontend::GpgKeyGetter::GetKeysCopy(
+ const GpgFrontend::KeyListPtr& keys) {
+ auto keys_copy = std::make_unique<KeyArgsList>();
+ for (const auto& key : *keys) keys_copy->push_back(key.copy());
+ return keys_copy;
+}
diff --git a/src/gpg/function/GpgKeyGetter.h b/src/gpg/function/GpgKeyGetter.h
index c8f5d73a..3af51815 100644
--- a/src/gpg/function/GpgKeyGetter.h
+++ b/src/gpg/function/GpgKeyGetter.h
@@ -43,6 +43,10 @@ class GpgKeyGetter : public SingletonFunctionObject<GpgKeyGetter> {
KeyLinkListPtr FetchKey();
+ static KeyListPtr GetKeysCopy(const KeyListPtr& keys);
+
+ static KeyLinkListPtr GetKeysCopy(const KeyLinkListPtr& keys);
+
private:
GpgContext& ctx =
GpgContext::GetInstance(SingletonFunctionObject::GetDefaultChannel());