aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/GpgKeyImportExportor.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-09-10 23:58:09 +0000
committerSaturneric <[email protected]>2021-09-10 16:06:21 +0000
commit4e076fa1982812ea7d1222c7e981879799ca8853 (patch)
tree1b96ae4a6296ca0f7b9df8ce3a3c7339643bf1f0 /src/gpg/function/GpgKeyImportExportor.cpp
parentAdjust the code structure. (diff)
downloadGpgFrontend-4e076fa1982812ea7d1222c7e981879799ca8853.tar.gz
GpgFrontend-4e076fa1982812ea7d1222c7e981879799ca8853.zip
Continue to optimize and improve the code.
Diffstat (limited to 'src/gpg/function/GpgKeyImportExportor.cpp')
-rw-r--r--src/gpg/function/GpgKeyImportExportor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gpg/function/GpgKeyImportExportor.cpp b/src/gpg/function/GpgKeyImportExportor.cpp
index 37b12650..79d0c36a 100644
--- a/src/gpg/function/GpgKeyImportExportor.cpp
+++ b/src/gpg/function/GpgKeyImportExportor.cpp
@@ -1,5 +1,6 @@
#include "gpg/function/GpgKeyImportExportor.h"
#include "GpgConstants.h"
+#include <gpg-error.h>
/**
* Import key pair
@@ -51,7 +52,7 @@ bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
LOG(INFO) << "exportKeys read_bytes"
<< gpgme_data_seek(data_out, 0, SEEK_END);
- auto temp_out_buffer = std::move(data_out.Read2Buffer());
+ auto temp_out_buffer = data_out.Read2Buffer();
std::swap(out_buffer, temp_out_buffer);
}
@@ -88,10 +89,11 @@ bool GpgFrontend::GpgKeyImportExportor::ExportSecretKey(
GpgData data_out;
// export private key to outBuffer
- gpgme_error_t error =
+ gpgme_error_t err =
gpgme_op_export_keys(ctx, target_key, GPGME_EXPORT_MODE_SECRET, data_out);
- auto temp_out_buffer = std::move(data_out.Read2Buffer());
+ auto temp_out_buffer = data_out.Read2Buffer();
std::swap(out_buffer, temp_out_buffer);
- return true;
+
+ return check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR;
}