aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/GpgKeyManager.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-10-02 14:08:50 +0000
committerSaturneric <[email protected]>2021-10-02 14:16:27 +0000
commit3c65d087eeee687ac01af2e80f3dd538f9a2c230 (patch)
tree1e860dc6343c1897e2224a002f2ca44c574381b3 /src/gpg/function/GpgKeyManager.cpp
parentThe basic functions of the core pass the test. (diff)
downloadGpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.tar.gz
GpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.zip
UI Framework Modified.
Diffstat (limited to '')
-rw-r--r--src/gpg/function/GpgKeyManager.cpp41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/gpg/function/GpgKeyManager.cpp b/src/gpg/function/GpgKeyManager.cpp
index a6697bc4..361c00bd 100644
--- a/src/gpg/function/GpgKeyManager.cpp
+++ b/src/gpg/function/GpgKeyManager.cpp
@@ -23,14 +23,16 @@
*/
#include "gpg/function/GpgKeyManager.h"
-#include "gpg/function/BasicOperator.h"
-#include "gpg/function/GpgKeyGetter.h"
#include <boost/date_time/posix_time/conversion.hpp>
#include <string>
+#include "gpg/function/BasicOperator.h"
+#include "gpg/function/GpgKeyGetter.h"
bool GpgFrontend::GpgKeyManager::signKey(
- const GpgFrontend::GpgKey &target, GpgFrontend::KeyArgsList &keys,
- const std::string &uid, std::unique_ptr<boost::gregorian::date> &expires) {
+ const GpgFrontend::GpgKey& target,
+ GpgFrontend::KeyArgsList& keys,
+ const std::string& uid,
+ const std::unique_ptr<boost::gregorian::date>& expires) {
using namespace boost::posix_time;
BasicOperator::GetInstance().SetSigners(keys);
@@ -50,21 +52,26 @@ bool GpgFrontend::GpgKeyManager::signKey(
}
bool GpgFrontend::GpgKeyManager::revSign(
- const GpgFrontend::GpgKey &key,
- const GpgFrontend::GpgKeySignature &signature) {
-
- auto &key_getter = GpgKeyGetter::GetInstance();
- auto signing_key = key_getter.GetKey(signature.keyid());
-
- auto err = check_gpg_error(gpgme_op_revsig(ctx, gpgme_key_t(key),
- gpgme_key_t(signing_key),
- signature.uid().data(), 0));
- return check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR;
+ const GpgFrontend::GpgKey& key,
+ const GpgFrontend::SignIdArgsListPtr& signature_id) {
+ auto& key_getter = GpgKeyGetter::GetInstance();
+
+ for (const auto& sign_id : *signature_id) {
+ auto signing_key = key_getter.GetKey(sign_id.first);
+ assert(signing_key.good());
+ auto err = check_gpg_error(gpgme_op_revsig(ctx, gpgme_key_t(key),
+ gpgme_key_t(signing_key),
+ sign_id.second.c_str(), 0));
+ if (check_gpg_error_2_err_code(err) != GPG_ERR_NO_ERROR)
+ return false;
+ }
+ return true;
}
bool GpgFrontend::GpgKeyManager::setExpire(
- const GpgFrontend::GpgKey &key, std::unique_ptr<GpgSubKey> &subkey,
- std::unique_ptr<boost::gregorian::date> &expires) {
+ const GpgFrontend::GpgKey& key,
+ std::unique_ptr<GpgSubKey>& subkey,
+ std::unique_ptr<boost::gregorian::date>& expires) {
using namespace boost::posix_time;
unsigned long expires_time = 0;
@@ -72,7 +79,7 @@ bool GpgFrontend::GpgKeyManager::setExpire(
if (expires != nullptr)
expires_time = to_time_t(ptime(*expires));
- const char *sub_fprs = nullptr;
+ const char* sub_fprs = nullptr;
if (subkey != nullptr)
sub_fprs = subkey->fpr().c_str();