aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg')
-rw-r--r--src/gpg/GpgConstants.cpp4
-rw-r--r--src/gpg/GpgConstants.h4
-rw-r--r--src/gpg/GpgContext.cpp15
-rw-r--r--src/gpg/GpgContext.h19
-rw-r--r--src/gpg/GpgFunctionObject.h17
-rw-r--r--src/gpg/GpgGenKeyInfo.cpp4
-rw-r--r--src/gpg/GpgGenKeyInfo.h4
-rw-r--r--src/gpg/GpgInfo.cpp4
-rw-r--r--src/gpg/GpgInfo.h4
-rw-r--r--src/gpg/GpgModel.h10
-rw-r--r--src/gpg/function/BasicOperator.cpp37
-rw-r--r--src/gpg/function/BasicOperator.h31
-rw-r--r--src/gpg/function/GpgCommandExecutor.cpp4
-rw-r--r--src/gpg/function/GpgCommandExecutor.h16
-rw-r--r--src/gpg/function/GpgFileOpera.cpp4
-rw-r--r--src/gpg/function/GpgFileOpera.h4
-rw-r--r--src/gpg/function/GpgKeyGetter.cpp4
-rw-r--r--src/gpg/function/GpgKeyGetter.h4
-rw-r--r--src/gpg/function/GpgKeyImportExportor.cpp22
-rw-r--r--src/gpg/function/GpgKeyImportExportor.h47
-rw-r--r--src/gpg/function/GpgKeyManager.cpp21
-rw-r--r--src/gpg/function/GpgKeyManager.h11
-rw-r--r--src/gpg/function/GpgKeyOpera.cpp4
-rw-r--r--src/gpg/function/GpgKeyOpera.h4
-rw-r--r--src/gpg/function/UidOperator.cpp4
-rw-r--r--src/gpg/function/UidOperator.h10
-rw-r--r--src/gpg/model/GpgData.cpp4
-rw-r--r--src/gpg/model/GpgData.h7
-rw-r--r--src/gpg/model/GpgKey.cpp8
-rw-r--r--src/gpg/model/GpgKey.h13
-rw-r--r--src/gpg/model/GpgKeySignature.cpp8
-rw-r--r--src/gpg/model/GpgKeySignature.h16
-rw-r--r--src/gpg/model/GpgSubKey.cpp7
-rw-r--r--src/gpg/model/GpgSubKey.h8
-rw-r--r--src/gpg/model/GpgUID.cpp7
-rw-r--r--src/gpg/model/GpgUID.h16
-rw-r--r--src/gpg/result_analyse/DecryptResultAnalyse.cpp28
-rw-r--r--src/gpg/result_analyse/DecryptResultAnalyse.h14
-rw-r--r--src/gpg/result_analyse/EncryptResultAnalyse.cpp19
-rw-r--r--src/gpg/result_analyse/EncryptResultAnalyse.h14
-rw-r--r--src/gpg/result_analyse/ResultAnalyse.cpp11
-rw-r--r--src/gpg/result_analyse/ResultAnalyse.h8
-rw-r--r--src/gpg/result_analyse/SignResultAnalyse.cpp53
-rw-r--r--src/gpg/result_analyse/SignResultAnalyse.h14
-rw-r--r--src/gpg/result_analyse/VerifyResultAnalyse.cpp203
-rw-r--r--src/gpg/result_analyse/VerifyResultAnalyse.h14
46 files changed, 366 insertions, 418 deletions
diff --git a/src/gpg/GpgConstants.cpp b/src/gpg/GpgConstants.cpp
index 497f7e0c..aa56fe10 100644
--- a/src/gpg/GpgConstants.cpp
+++ b/src/gpg/GpgConstants.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/GpgConstants.h b/src/gpg/GpgConstants.h
index da8860e8..4804924a 100644
--- a/src/gpg/GpgConstants.h
+++ b/src/gpg/GpgConstants.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/GpgContext.cpp b/src/gpg/GpgContext.cpp
index 1372fd73..5d901c3f 100644
--- a/src/gpg/GpgContext.cpp
+++ b/src/gpg/GpgContext.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -26,6 +26,7 @@
#include <gpg-error.h>
#include <gpgme.h>
+
#include <functional>
#include <string>
@@ -43,8 +44,7 @@ namespace GpgFrontend {
* Constructor
* Set up gpgme-context, set paths to app-run path
*/
-GpgContext::GpgContext(bool independent_database,
- std::string db_path,
+GpgContext::GpgContext(bool independent_database, std::string db_path,
int channel)
: SingletonFunctionObject<GpgContext>(channel) {
static bool _first = true;
@@ -80,8 +80,7 @@ GpgContext::GpgContext(bool independent_database,
if (engineInfo->protocol == GPGME_PROTOCOL_CMS &&
strcmp(engineInfo->version, "1.0.0") != 0)
find_cms = true;
- if (engineInfo->protocol == GPGME_PROTOCOL_ASSUAN)
- find_assuan = true;
+ if (engineInfo->protocol == GPGME_PROTOCOL_ASSUAN) find_assuan = true;
engineInfo = engineInfo->next;
}
@@ -115,9 +114,7 @@ GpgContext::GpgContext(bool independent_database,
}
}
-bool GpgContext::good() const {
- return good_;
-}
+bool GpgContext::good() const { return good_; }
void GpgContext::SetPassphraseCb(decltype(test_passphrase_cb) cb) const {
gpgme_set_passphrase_cb(*this, cb, nullptr);
diff --git a/src/gpg/GpgContext.h b/src/gpg/GpgContext.h
index 0aa41f2f..7df90060 100644
--- a/src/gpg/GpgContext.h
+++ b/src/gpg/GpgContext.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -37,8 +37,7 @@ namespace GpgFrontend {
class GpgContext : public SingletonFunctionObject<GpgContext> {
public:
GpgContext(bool independent_database = false,
- std::string path = std::string(),
- int channel = 0);
+ std::string path = std::string(), int channel = 0);
~GpgContext() override = default;
@@ -55,8 +54,7 @@ class GpgContext : public SingletonFunctionObject<GpgContext> {
struct _ctx_ref_deletor {
void operator()(gpgme_ctx_t _ctx) {
- if (_ctx != nullptr)
- gpgme_release(_ctx);
+ if (_ctx != nullptr) gpgme_release(_ctx);
}
};
@@ -66,11 +64,9 @@ class GpgContext : public SingletonFunctionObject<GpgContext> {
bool good_ = true;
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* uid_hint,
const char* passphrase_info,
- int last_was_bad,
- int fd) {
+ int last_was_bad, int fd) {
LOG(INFO) << "test_passphrase_cb Called";
size_t res;
char pass[] = "abcdefg\n";
@@ -84,8 +80,7 @@ class GpgContext : public SingletonFunctionObject<GpgContext> {
do {
res = gpgme_io_write(fd, &pass[off], pass_len - off);
- if (res > 0)
- off += res;
+ if (res > 0) off += res;
} while (res > 0 && off != pass_len);
return off == pass_len ? 0 : gpgme_error_from_errno(errno);
diff --git a/src/gpg/GpgFunctionObject.h b/src/gpg/GpgFunctionObject.h
index a8746edf..6f1d60af 100644
--- a/src/gpg/GpgFunctionObject.h
+++ b/src/gpg/GpgFunctionObject.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -25,6 +25,8 @@
#ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
#define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
+#include <easyloggingpp/easylogging++.h>
+
#include <map>
#include <memory>
#include <mutex>
@@ -32,8 +34,6 @@
#include <stdexcept>
#include <string>
-#include <easyloggingpp/easylogging++.h>
-
namespace GpgFrontend {
template <typename T>
@@ -42,8 +42,7 @@ class SingletonFunctionObject {
static T& GetInstance(int channel = 0) {
if (!channel) {
std::lock_guard<std::mutex> guard(_instance_mutex);
- if (_instance == nullptr)
- _instance = std::make_unique<T>();
+ if (_instance == nullptr) _instance = std::make_unique<T>();
return *_instance;
} else {
// read _instances_map
@@ -60,8 +59,7 @@ class SingletonFunctionObject {
}
static T& CreateInstance(int channel, std::unique_ptr<T> p_obj = nullptr) {
- if (!channel)
- return *_instance;
+ if (!channel) return *_instance;
// read _instances_map
decltype(_instances_map.end()) _it;
@@ -74,8 +72,7 @@ class SingletonFunctionObject {
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>();
+ if (p_obj == nullptr) p_obj = std::make_unique<T>();
std::swap(_default_channel, tmp);
}
T* obj = p_obj.get();
diff --git a/src/gpg/GpgGenKeyInfo.cpp b/src/gpg/GpgGenKeyInfo.cpp
index 79d6617c..07708433 100644
--- a/src/gpg/GpgGenKeyInfo.cpp
+++ b/src/gpg/GpgGenKeyInfo.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/GpgGenKeyInfo.h b/src/gpg/GpgGenKeyInfo.h
index cb627555..53b0c9f1 100644
--- a/src/gpg/GpgGenKeyInfo.h
+++ b/src/gpg/GpgGenKeyInfo.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/GpgInfo.cpp b/src/gpg/GpgInfo.cpp
index 00a15ef9..392dcf08 100644
--- a/src/gpg/GpgInfo.cpp
+++ b/src/gpg/GpgInfo.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/GpgInfo.h b/src/gpg/GpgInfo.h
index dbcf3b40..27e13112 100644
--- a/src/gpg/GpgInfo.h
+++ b/src/gpg/GpgInfo.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/GpgModel.h b/src/gpg/GpgModel.h
index 7b77d678..a9351e50 100644
--- a/src/gpg/GpgModel.h
+++ b/src/gpg/GpgModel.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -25,12 +25,12 @@
#ifndef GPGFRONTEND_ZH_CN_TS_GPGMODEL_H
#define GPGFRONTEND_ZH_CN_TS_GPGMODEL_H
-#include "gpg/model/GpgData.h"
-#include "gpg/model/GpgKey.h"
-
#include <list>
#include <utility>
+#include "gpg/model/GpgData.h"
+#include "gpg/model/GpgKey.h"
+
namespace GpgFrontend {
using KeyId = std::string;
diff --git a/src/gpg/function/BasicOperator.cpp b/src/gpg/function/BasicOperator.cpp
index 0e44c9e0..e92d4cfe 100644
--- a/src/gpg/function/BasicOperator.cpp
+++ b/src/gpg/function/BasicOperator.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -23,20 +23,19 @@
*/
#include "gpg/function/BasicOperator.h"
+
#include <vector>
+
#include "gpg/function/GpgKeyGetter.h"
GpgFrontend::GpgError GpgFrontend::BasicOperator::Encrypt(
- GpgFrontend::KeyArgsList&& keys,
- GpgFrontend::BypeArrayRef in_buffer,
- GpgFrontend::ByteArrayPtr& out_buffer,
- GpgFrontend::GpgEncrResult& result) {
+ GpgFrontend::KeyArgsList&& keys, GpgFrontend::BypeArrayRef in_buffer,
+ GpgFrontend::ByteArrayPtr& out_buffer, GpgFrontend::GpgEncrResult& result) {
// gpgme_encrypt_result_t e_result;
gpgme_key_t recipients[keys.size() + 1];
int index = 0;
- for (const auto& key : keys)
- recipients[index++] = gpgme_key_t(key);
+ for (const auto& key : keys) recipients[index++] = gpgme_key_t(key);
// Last entry data_in array has to be nullptr
recipients[keys.size()] = nullptr;
@@ -56,8 +55,7 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Encrypt(
}
GpgFrontend::GpgError GpgFrontend::BasicOperator::Decrypt(
- BypeArrayRef in_buffer,
- GpgFrontend::ByteArrayPtr& out_buffer,
+ BypeArrayRef in_buffer, GpgFrontend::ByteArrayPtr& out_buffer,
GpgFrontend::GpgDecrResult& result) {
gpgme_error_t err;
@@ -74,8 +72,7 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Decrypt(
}
GpgFrontend::GpgError GpgFrontend::BasicOperator::Verify(
- BypeArrayRef& in_buffer,
- ByteArrayPtr& sig_buffer,
+ BypeArrayRef& in_buffer, ByteArrayPtr& sig_buffer,
GpgVerifyResult& result) const {
gpgme_error_t err;
@@ -131,10 +128,8 @@ GpgFrontend::GpgError GpgFrontend::BasicOperator::Sign(KeyArgsList&& keys,
}
gpgme_error_t GpgFrontend::BasicOperator::DecryptVerify(
- BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
- GpgDecrResult& decrypt_result,
- GpgVerifyResult& verify_result) {
+ BypeArrayRef in_buffer, ByteArrayPtr& out_buffer,
+ GpgDecrResult& decrypt_result, GpgVerifyResult& verify_result) {
gpgme_error_t err;
GpgData data_in(in_buffer.data(), in_buffer.size()), data_out;
@@ -154,11 +149,8 @@ gpgme_error_t GpgFrontend::BasicOperator::DecryptVerify(
}
gpgme_error_t GpgFrontend::BasicOperator::EncryptSign(
- KeyArgsList&& keys,
- KeyArgsList&& signers,
- BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
- GpgEncrResult& encr_result,
+ KeyArgsList&& keys, KeyArgsList&& signers, BypeArrayRef in_buffer,
+ ByteArrayPtr& out_buffer, GpgEncrResult& encr_result,
GpgSignResult& sign_result) {
gpgme_error_t err;
SetSigners(signers);
@@ -168,8 +160,7 @@ gpgme_error_t GpgFrontend::BasicOperator::EncryptSign(
// set key for user
int index = 0;
- for (const auto& key : keys)
- recipients[index++] = gpgme_key_t(key);
+ for (const auto& key : keys) recipients[index++] = gpgme_key_t(key);
// Last entry dataIn array has to be nullptr
recipients[keys.size()] = nullptr;
diff --git a/src/gpg/function/BasicOperator.h b/src/gpg/function/BasicOperator.h
index e8fa943d..e83ade70 100644
--- a/src/gpg/function/BasicOperator.h
+++ b/src/gpg/function/BasicOperator.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -34,35 +34,26 @@ namespace GpgFrontend {
class BasicOperator : public SingletonFunctionObject<BasicOperator> {
public:
- gpg_error_t Encrypt(KeyArgsList&& keys,
- BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
- GpgEncrResult& result);
+ gpg_error_t Encrypt(KeyArgsList&& keys, BypeArrayRef in_buffer,
+ ByteArrayPtr& out_buffer, GpgEncrResult& result);
- gpgme_error_t EncryptSign(KeyArgsList&& keys,
- KeyArgsList&& signers,
- BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
+ gpgme_error_t EncryptSign(KeyArgsList&& keys, KeyArgsList&& signers,
+ BypeArrayRef in_buffer, ByteArrayPtr& out_buffer,
GpgEncrResult& encr_result,
GpgSignResult& sign_result);
- gpgme_error_t Decrypt(BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
+ gpgme_error_t Decrypt(BypeArrayRef in_buffer, ByteArrayPtr& out_buffer,
GpgDecrResult& result);
- gpgme_error_t DecryptVerify(BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
+ gpgme_error_t DecryptVerify(BypeArrayRef in_buffer, ByteArrayPtr& out_buffer,
GpgDecrResult& decrypt_result,
GpgVerifyResult& verify_result);
- gpgme_error_t Verify(BypeArrayRef in_buffer,
- ByteArrayPtr& sig_buffer,
+ gpgme_error_t Verify(BypeArrayRef in_buffer, ByteArrayPtr& sig_buffer,
GpgVerifyResult& result) const;
- gpg_error_t Sign(KeyArgsList&& key_fprs,
- BypeArrayRef in_buffer,
- ByteArrayPtr& out_buffer,
- gpgme_sig_mode_t mode,
+ gpg_error_t Sign(KeyArgsList&& key_fprs, BypeArrayRef in_buffer,
+ ByteArrayPtr& out_buffer, gpgme_sig_mode_t mode,
GpgSignResult& result);
void SetSigners(KeyArgsList& keys);
diff --git a/src/gpg/function/GpgCommandExecutor.cpp b/src/gpg/function/GpgCommandExecutor.cpp
index efe1446f..a494d4a8 100644
--- a/src/gpg/function/GpgCommandExecutor.cpp
+++ b/src/gpg/function/GpgCommandExecutor.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/GpgCommandExecutor.h b/src/gpg/function/GpgCommandExecutor.h
index 01904fd3..a6eaaf4a 100644
--- a/src/gpg/function/GpgCommandExecutor.h
+++ b/src/gpg/function/GpgCommandExecutor.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -25,23 +25,23 @@
#ifndef GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
#define GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
+#include <boost/process.hpp>
+
#include "gpg/GpgContext.h"
#include "gpg/GpgFunctionObject.h"
-#include <boost/process.hpp>
-
namespace GpgFrontend {
class GpgCommandExecutor : public SingletonFunctionObject<GpgCommandExecutor> {
-public:
+ public:
void Execute(StringArgsRef arguments,
const std::function<void(boost::process::async_pipe &in,
boost::process::async_pipe &out)>
&interact_func);
-private:
+ private:
GpgContext &ctx = GpgContext::GetInstance();
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
+#endif // GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
diff --git a/src/gpg/function/GpgFileOpera.cpp b/src/gpg/function/GpgFileOpera.cpp
index ae912ada..67504c0d 100644
--- a/src/gpg/function/GpgFileOpera.cpp
+++ b/src/gpg/function/GpgFileOpera.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/GpgFileOpera.h b/src/gpg/function/GpgFileOpera.h
index ff57b2c0..5b467357 100644
--- a/src/gpg/function/GpgFileOpera.h
+++ b/src/gpg/function/GpgFileOpera.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/GpgKeyGetter.cpp b/src/gpg/function/GpgKeyGetter.cpp
index 18fbe649..be27d69e 100644
--- a/src/gpg/function/GpgKeyGetter.cpp
+++ b/src/gpg/function/GpgKeyGetter.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/GpgKeyGetter.h b/src/gpg/function/GpgKeyGetter.h
index 8eab4e10..c8f5d73a 100644
--- a/src/gpg/function/GpgKeyGetter.h
+++ b/src/gpg/function/GpgKeyGetter.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/GpgKeyImportExportor.cpp b/src/gpg/function/GpgKeyImportExportor.cpp
index bdfc25bd..f4b88c60 100644
--- a/src/gpg/function/GpgKeyImportExportor.cpp
+++ b/src/gpg/function/GpgKeyImportExportor.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -33,8 +33,7 @@
*/
GpgFrontend::GpgImportInformation GpgFrontend::GpgKeyImportExportor::ImportKey(
StdBypeArrayPtr in_buffer) {
- if (in_buffer->empty())
- return GpgImportInformation();
+ if (in_buffer->empty()) return GpgImportInformation();
GpgData data_in(in_buffer->data(), in_buffer->size());
auto err = check_gpg_error(gpgme_op_import(ctx, data_in));
@@ -60,10 +59,8 @@ GpgFrontend::GpgImportInformation GpgFrontend::GpgKeyImportExportor::ImportKey(
* @return if success
*/
bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
- KeyIdArgsListPtr& uid_list,
- ByteArrayPtr& out_buffer) const {
- if (uid_list->empty())
- return false;
+ KeyIdArgsListPtr& uid_list, ByteArrayPtr& out_buffer) const {
+ if (uid_list->empty()) return false;
// Alleviate another crash problem caused by an unknown array out-of-bounds
// access
@@ -89,11 +86,9 @@ bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
* @return if success
*/
bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
- const KeyArgsList& keys,
- ByteArrayPtr& out_buffer) const {
+ const KeyArgsList& keys, ByteArrayPtr& out_buffer) const {
KeyIdArgsListPtr key_ids = std::make_unique<std::vector<std::string>>();
- for (const auto& key : keys)
- key_ids->push_back(key.id());
+ for (const auto& key : keys) key_ids->push_back(key.id());
return ExportKeys(key_ids, out_buffer);
}
@@ -104,8 +99,7 @@ bool GpgFrontend::GpgKeyImportExportor::ExportKeys(
* @return if successful
*/
bool GpgFrontend::GpgKeyImportExportor::ExportSecretKey(
- const GpgKey& key,
- ByteArrayPtr& out_buffer) const {
+ const GpgKey& key, ByteArrayPtr& out_buffer) const {
DLOG(INFO) << "Export Secret Key" << key.id().c_str();
gpgme_key_t target_key[2] = {gpgme_key_t(key), nullptr};
diff --git a/src/gpg/function/GpgKeyImportExportor.h b/src/gpg/function/GpgKeyImportExportor.h
index d71daddb..bceb87ef 100644
--- a/src/gpg/function/GpgKeyImportExportor.h
+++ b/src/gpg/function/GpgKeyImportExportor.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -26,6 +26,7 @@
#define _GPGKEYIMPORTEXPORTOR_H
#include <string>
+
#include "gpg/GpgConstants.h"
#include "gpg/GpgContext.h"
#include "gpg/GpgFunctionObject.h"
@@ -46,34 +47,20 @@ class GpgImportInformation {
GpgImportInformation() = default;
explicit GpgImportInformation(gpgme_import_result_t result) {
- if (result->unchanged)
- unchanged = result->unchanged;
- if (result->considered)
- considered = result->considered;
- if (result->no_user_id)
- no_user_id = result->no_user_id;
- if (result->imported)
- imported = result->imported;
- if (result->imported_rsa)
- imported_rsa = result->imported_rsa;
- if (result->unchanged)
- unchanged = result->unchanged;
- if (result->new_user_ids)
- new_user_ids = result->new_user_ids;
- if (result->new_sub_keys)
- new_sub_keys = result->new_sub_keys;
- if (result->new_signatures)
- new_signatures = result->new_signatures;
- if (result->new_revocations)
- new_revocations = result->new_revocations;
- if (result->secret_read)
- secret_read = result->secret_read;
- if (result->secret_imported)
- secret_imported = result->secret_imported;
- if (result->secret_unchanged)
- secret_unchanged = result->secret_unchanged;
- if (result->not_imported)
- not_imported = result->not_imported;
+ if (result->unchanged) unchanged = result->unchanged;
+ if (result->considered) considered = result->considered;
+ if (result->no_user_id) no_user_id = result->no_user_id;
+ if (result->imported) imported = result->imported;
+ if (result->imported_rsa) imported_rsa = result->imported_rsa;
+ if (result->unchanged) unchanged = result->unchanged;
+ if (result->new_user_ids) new_user_ids = result->new_user_ids;
+ if (result->new_sub_keys) new_sub_keys = result->new_sub_keys;
+ if (result->new_signatures) new_signatures = result->new_signatures;
+ if (result->new_revocations) new_revocations = result->new_revocations;
+ if (result->secret_read) secret_read = result->secret_read;
+ if (result->secret_imported) secret_imported = result->secret_imported;
+ if (result->secret_unchanged) secret_unchanged = result->secret_unchanged;
+ if (result->not_imported) not_imported = result->not_imported;
}
int considered = 0;
diff --git a/src/gpg/function/GpgKeyManager.cpp b/src/gpg/function/GpgKeyManager.cpp
index 361c00bd..9e24b3d6 100644
--- a/src/gpg/function/GpgKeyManager.cpp
+++ b/src/gpg/function/GpgKeyManager.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -23,14 +23,15 @@
*/
#include "gpg/function/GpgKeyManager.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 GpgFrontend::GpgKey& target, GpgFrontend::KeyArgsList& keys,
const std::string& uid,
const std::unique_ptr<boost::gregorian::date>& expires) {
using namespace boost::posix_time;
@@ -62,27 +63,23 @@ bool GpgFrontend::GpgKeyManager::revSign(
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;
+ 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,
+ 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;
- if (expires != nullptr)
- expires_time = to_time_t(ptime(*expires));
+ if (expires != nullptr) expires_time = to_time_t(ptime(*expires));
const char* sub_fprs = nullptr;
- if (subkey != nullptr)
- sub_fprs = subkey->fpr().c_str();
+ if (subkey != nullptr) sub_fprs = subkey->fpr().c_str();
auto err = check_gpg_error(
gpgme_op_setexpire(ctx, gpgme_key_t(key), expires_time, sub_fprs, 0));
diff --git a/src/gpg/function/GpgKeyManager.h b/src/gpg/function/GpgKeyManager.h
index f50c8dcc..2b07425c 100644
--- a/src/gpg/function/GpgKeyManager.h
+++ b/src/gpg/function/GpgKeyManager.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -40,16 +40,13 @@ class GpgKeyManager : public SingletonFunctionObject<GpgKeyManager> {
* @param expires expire date and time of the signature
* @return if successful
*/
- bool signKey(const GpgKey& target,
- KeyArgsList& keys,
- const std::string& uid,
+ bool signKey(const GpgKey& target, KeyArgsList& keys, const std::string& uid,
const std::unique_ptr<boost::gregorian::date>& expires);
bool revSign(const GpgFrontend::GpgKey& key,
const GpgFrontend::SignIdArgsListPtr& signature_id);
- bool setExpire(const GpgKey& key,
- std::unique_ptr<GpgSubKey>& subkey,
+ bool setExpire(const GpgKey& key, std::unique_ptr<GpgSubKey>& subkey,
std::unique_ptr<boost::gregorian::date>& expires);
private:
diff --git a/src/gpg/function/GpgKeyOpera.cpp b/src/gpg/function/GpgKeyOpera.cpp
index c7775d10..2406cbb9 100644
--- a/src/gpg/function/GpgKeyOpera.cpp
+++ b/src/gpg/function/GpgKeyOpera.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/GpgKeyOpera.h b/src/gpg/function/GpgKeyOpera.h
index 54f7f3e6..d9573bd7 100644
--- a/src/gpg/function/GpgKeyOpera.h
+++ b/src/gpg/function/GpgKeyOpera.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/UidOperator.cpp b/src/gpg/function/UidOperator.cpp
index 69caf458..d7acc3b1 100644
--- a/src/gpg/function/UidOperator.cpp
+++ b/src/gpg/function/UidOperator.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/function/UidOperator.h b/src/gpg/function/UidOperator.h
index e3068b1f..7d5df254 100644
--- a/src/gpg/function/UidOperator.h
+++ b/src/gpg/function/UidOperator.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -48,10 +48,8 @@ class UidOperator : public SingletonFunctionObject<UidOperator> {
* @param email
* @return
*/
- bool addUID(const GpgKey& key,
- const std::string& name,
- const std::string& comment,
- const std::string& email);
+ bool addUID(const GpgKey& key, const std::string& name,
+ const std::string& comment, const std::string& email);
/**
* Revoke(Delete) UID from certain key pair
diff --git a/src/gpg/model/GpgData.cpp b/src/gpg/model/GpgData.cpp
index 1ffff0c5..23cdaf2d 100644
--- a/src/gpg/model/GpgData.cpp
+++ b/src/gpg/model/GpgData.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
diff --git a/src/gpg/model/GpgData.h b/src/gpg/model/GpgData.h
index 30a1c496..e3202af6 100644
--- a/src/gpg/model/GpgData.h
+++ b/src/gpg/model/GpgData.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -42,8 +42,7 @@ class GpgData {
private:
struct __data_ref_deletor {
void operator()(gpgme_data_t _data) {
- if (_data != nullptr)
- gpgme_data_release(_data);
+ if (_data != nullptr) gpgme_data_release(_data);
}
};
diff --git a/src/gpg/model/GpgKey.cpp b/src/gpg/model/GpgKey.cpp
index a0511051..c14edd2d 100644
--- a/src/gpg/model/GpgKey.cpp
+++ b/src/gpg/model/GpgKey.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -44,8 +44,8 @@ GpgFrontend::GpgKey::subKeys() const {
return p_keys;
}
-std::unique_ptr<std::vector<GpgFrontend::GpgUID>>
-GpgFrontend::GpgKey::uids() const {
+std::unique_ptr<std::vector<GpgFrontend::GpgUID>> GpgFrontend::GpgKey::uids()
+ const {
auto p_uids = std::make_unique<std::vector<GpgUID>>();
auto uid_next = _key_ref->uids;
while (uid_next != nullptr) {
diff --git a/src/gpg/model/GpgKey.h b/src/gpg/model/GpgKey.h
index ecebf3b2..53c074e8 100644
--- a/src/gpg/model/GpgKey.h
+++ b/src/gpg/model/GpgKey.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -25,12 +25,12 @@
#ifndef GPGFRONTEND_GPGKEY_H
#define GPGFRONTEND_GPGKEY_H
-#include "GpgSubKey.h"
-#include "GpgUID.h"
-
#include <boost/date_time.hpp>
#include <boost/date_time/posix_time/conversion.hpp>
+#include "GpgSubKey.h"
+#include "GpgUID.h"
+
namespace GpgFrontend {
class GpgKey {
@@ -148,8 +148,7 @@ class GpgKey {
private:
struct _key_ref_deletor {
void operator()(gpgme_key_t _key) {
- if (_key != nullptr)
- gpgme_key_unref(_key);
+ if (_key != nullptr) gpgme_key_unref(_key);
}
};
diff --git a/src/gpg/model/GpgKeySignature.cpp b/src/gpg/model/GpgKeySignature.cpp
index d7e7c53e..8f937198 100644
--- a/src/gpg/model/GpgKeySignature.cpp
+++ b/src/gpg/model/GpgKeySignature.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -24,5 +24,5 @@
#include "gpg/model/GpgKeySignature.h"
-GpgFrontend::GpgKeySignature::GpgKeySignature(gpgme_key_sig_t sig) : _signature_ref(sig,
- [&](gpgme_key_sig_t signature) {}) {}
+GpgFrontend::GpgKeySignature::GpgKeySignature(gpgme_key_sig_t sig)
+ : _signature_ref(sig, [&](gpgme_key_sig_t signature) {}) {}
diff --git a/src/gpg/model/GpgKeySignature.h b/src/gpg/model/GpgKeySignature.h
index 9de6b074..70eaeb1c 100644
--- a/src/gpg/model/GpgKeySignature.h
+++ b/src/gpg/model/GpgKeySignature.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -25,15 +25,15 @@
#ifndef GPGFRONTEND_GPGKEYSIGNATURE_H
#define GPGFRONTEND_GPGKEYSIGNATURE_H
-#include "gpg/GpgConstants.h"
-
#include <boost/date_time.hpp>
#include <string>
+#include "gpg/GpgConstants.h"
+
namespace GpgFrontend {
class GpgKeySignature {
-public:
+ public:
[[nodiscard]] bool revoked() const { return _signature_ref->revoked; }
[[nodiscard]] bool expired() const { return _signature_ref->expired; }
[[nodiscard]] bool invalid() const { return _signature_ref->invalid; }
@@ -72,7 +72,7 @@ public:
GpgKeySignature &operator=(const GpgKeySignature &) = delete;
-private:
+ private:
using KeySignatrueRefHandler =
std::unique_ptr<struct _gpgme_key_sig,
std::function<void(gpgme_key_sig_t)>>;
@@ -80,6 +80,6 @@ private:
KeySignatrueRefHandler _signature_ref = nullptr;
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_GPGKEYSIGNATURE_H
+#endif // GPGFRONTEND_GPGKEYSIGNATURE_H
diff --git a/src/gpg/model/GpgSubKey.cpp b/src/gpg/model/GpgSubKey.cpp
index 87476d56..83fbcaa2 100644
--- a/src/gpg/model/GpgSubKey.cpp
+++ b/src/gpg/model/GpgSubKey.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -23,4 +23,5 @@
*/
#include "gpg/model/GpgSubKey.h"
-GpgFrontend::GpgSubKey::GpgSubKey(gpgme_subkey_t subkey) : _subkey_ref(subkey, [&](gpgme_subkey_t subkey) {}) {}
+GpgFrontend::GpgSubKey::GpgSubKey(gpgme_subkey_t subkey)
+ : _subkey_ref(subkey, [&](gpgme_subkey_t subkey) {}) {}
diff --git a/src/gpg/model/GpgSubKey.h b/src/gpg/model/GpgSubKey.h
index edb52f44..5f65c507 100644
--- a/src/gpg/model/GpgSubKey.h
+++ b/src/gpg/model/GpgSubKey.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -24,11 +24,11 @@
#ifndef GPGFRONTEND_GPGSUBKEY_H
#define GPGFRONTEND_GPGSUBKEY_H
-#include "gpg/GpgConstants.h"
-
#include <boost/date_time.hpp>
#include <string>
+#include "gpg/GpgConstants.h"
+
namespace GpgFrontend {
class GpgSubKey {
diff --git a/src/gpg/model/GpgUID.cpp b/src/gpg/model/GpgUID.cpp
index ae58daf1..c0a63bab 100644
--- a/src/gpg/model/GpgUID.cpp
+++ b/src/gpg/model/GpgUID.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -24,4 +24,5 @@
#include "gpg/model/GpgUID.h"
-GpgFrontend::GpgUID::GpgUID(gpgme_user_id_t uid) : _uid_ref(uid, [&](gpgme_user_id_t uid) {}) {} \ No newline at end of file
+GpgFrontend::GpgUID::GpgUID(gpgme_user_id_t uid)
+ : _uid_ref(uid, [&](gpgme_user_id_t uid) {}) {} \ No newline at end of file
diff --git a/src/gpg/model/GpgUID.h b/src/gpg/model/GpgUID.h
index dbe084b8..66dba321 100644
--- a/src/gpg/model/GpgUID.h
+++ b/src/gpg/model/GpgUID.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -30,7 +30,7 @@
namespace GpgFrontend {
class GpgUID {
-public:
+ public:
[[nodiscard]] std::string name() const { return _uid_ref->name; }
[[nodiscard]] std::string email() const { return _uid_ref->email; }
@@ -43,8 +43,8 @@ public:
[[nodiscard]] bool invalid() const { return _uid_ref->invalid; }
- [[nodiscard]] std::unique_ptr<std::vector<GpgKeySignature>>
- signatures() const {
+ [[nodiscard]] std::unique_ptr<std::vector<GpgKeySignature>> signatures()
+ const {
auto sigs = std::make_unique<std::vector<GpgKeySignature>>();
auto sig_next = _uid_ref->signatures;
while (sig_next != nullptr) {
@@ -69,13 +69,13 @@ public:
GpgUID &operator=(const GpgUID &) = delete;
-private:
+ private:
using UidRefHandler = std::unique_ptr<struct _gpgme_user_id,
std::function<void(gpgme_user_id_t)>>;
UidRefHandler _uid_ref = nullptr;
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_GPGUID_H \ No newline at end of file
+#endif // GPGFRONTEND_GPGUID_H \ No newline at end of file
diff --git a/src/gpg/result_analyse/DecryptResultAnalyse.cpp b/src/gpg/result_analyse/DecryptResultAnalyse.cpp
index 8ecb92b9..4ff32c59 100644
--- a/src/gpg/result_analyse/DecryptResultAnalyse.cpp
+++ b/src/gpg/result_analyse/DecryptResultAnalyse.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -23,6 +23,7 @@
*/
#include "gpg/result_analyse/DecryptResultAnalyse.h"
+
#include "gpg/function/GpgKeyGetter.h"
GpgFrontend::DecryptResultAnalyse::DecryptResultAnalyse(GpgError error,
@@ -30,16 +31,16 @@ GpgFrontend::DecryptResultAnalyse::DecryptResultAnalyse(GpgError error,
: error(error), result(std::move(result)) {}
void GpgFrontend::DecryptResultAnalyse::do_analyse() {
- stream << "[#] Decrypt Operation ";
+ stream << "[#]" << _("Decrypt Operation");
if (gpgme_err_code(error) == GPG_ERR_NO_ERROR) {
- stream << "[Success]" << std::endl;
+ stream << "[" << _("Success") << "]" << std::endl;
} else {
- stream << "[Failed] " << gpgme_strerror(error) << std::endl;
+ stream << "[" << _("Failed") << "] " << gpgme_strerror(error) << std::endl;
setStatus(-1);
if (result != nullptr && result->unsupported_algorithm != nullptr) {
stream << "------------>" << std::endl;
- stream << "Unsupported Algo: " << result->unsupported_algorithm
+ stream << _("Unsupported Algo") << ": " << result->unsupported_algorithm
<< std::endl;
}
}
@@ -47,13 +48,12 @@ void GpgFrontend::DecryptResultAnalyse::do_analyse() {
if (result != nullptr && result->recipients != nullptr) {
stream << "------------>" << std::endl;
if (result->file_name != nullptr) {
- stream << "File Name: " << result->file_name << std::endl;
+ stream << _("File Name") << ": " << result->file_name << std::endl;
stream << std::endl;
}
auto reci = result->recipients;
- if (reci != nullptr)
- stream << "Recipient(s): " << std::endl;
+ if (reci != nullptr) stream << _("Recipient(s)") << ": " << std::endl;
while (reci != nullptr) {
print_reci(stream, reci);
reci = reci->next;
@@ -67,7 +67,7 @@ void GpgFrontend::DecryptResultAnalyse::do_analyse() {
bool GpgFrontend::DecryptResultAnalyse::print_reci(std::stringstream &stream,
gpgme_recipient_t reci) {
bool keyFound = true;
- stream << " {>} Recipient: ";
+ stream << " {>} " << _("Recipient") << ": ";
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey(reci->keyid);
if (key.good()) {
@@ -76,16 +76,16 @@ bool GpgFrontend::DecryptResultAnalyse::print_reci(std::stringstream &stream,
stream << "<" << key.email().c_str() << ">";
}
} else {
- stream << "<Unknown>";
+ stream << "<" << _("Unknown") << ">";
setStatus(0);
keyFound = false;
}
stream << std::endl;
- stream << " Keu ID: " << key.id().c_str() << std::endl;
- stream << " Public Algo: " << gpgme_pubkey_algo_name(reci->pubkey_algo)
- << std::endl;
+ stream << " " << _("Keu ID") << ": " << key.id().c_str() << std::endl;
+ stream << " " << _("Public Algo") << ": "
+ << gpgme_pubkey_algo_name(reci->pubkey_algo) << std::endl;
return keyFound;
}
diff --git a/src/gpg/result_analyse/DecryptResultAnalyse.h b/src/gpg/result_analyse/DecryptResultAnalyse.h
index 44640f7a..0864c23b 100644
--- a/src/gpg/result_analyse/DecryptResultAnalyse.h
+++ b/src/gpg/result_analyse/DecryptResultAnalyse.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -31,19 +31,19 @@
namespace GpgFrontend {
class DecryptResultAnalyse : public ResultAnalyse {
-public:
+ public:
explicit DecryptResultAnalyse(GpgError error, GpgDecrResult result);
-protected:
+ protected:
void do_analyse() final;
-private:
+ private:
bool print_reci(std::stringstream &stream, gpgme_recipient_t reci);
GpgError error;
GpgDecrResult result;
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_DECRYPTRESULTANALYSE_H
+#endif // GPGFRONTEND_DECRYPTRESULTANALYSE_H
diff --git a/src/gpg/result_analyse/EncryptResultAnalyse.cpp b/src/gpg/result_analyse/EncryptResultAnalyse.cpp
index 6659f1df..df240a1d 100644
--- a/src/gpg/result_analyse/EncryptResultAnalyse.cpp
+++ b/src/gpg/result_analyse/EncryptResultAnalyse.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -29,25 +29,26 @@ GpgFrontend::EncryptResultAnalyse::EncryptResultAnalyse(GpgError error,
: error(error), result(std::move(result)) {}
void GpgFrontend::EncryptResultAnalyse::do_analyse() {
- LOG(INFO) << "Start Encrypt Result Analyse";
+ LOG(INFO) << _("Start Encrypt Result Analyse");
- stream << "[#] Encrypt Operation ";
+ stream << "[#] " << _("Encrypt Operation") << " ";
if (gpgme_err_code(error) == GPG_ERR_NO_ERROR)
- stream << "[Success]" << std::endl;
+ stream << "[" << _("Success") << "]" << std::endl;
else {
- stream << "[Failed] " << gpgme_strerror(error) << std::endl;
+ stream << "[" << _("Failed") << "] " << gpgme_strerror(error) << std::endl;
setStatus(-1);
}
if (!~status) {
stream << "------------>" << std::endl;
if (result != nullptr) {
- stream << "Invalid Recipients: " << std::endl;
+ stream << _("Invalid Recipients") << ": " << std::endl;
auto inv_reci = result->invalid_recipients;
while (inv_reci != nullptr) {
- stream << "Fingerprint: " << inv_reci->fpr << std::endl;
- stream << "Reason: " << gpgme_strerror(inv_reci->reason) << std::endl;
+ stream << _("Fingerprint") << ": " << inv_reci->fpr << std::endl;
+ stream << _("Reason") << ": " << gpgme_strerror(inv_reci->reason)
+ << std::endl;
stream << std::endl;
inv_reci = inv_reci->next;
diff --git a/src/gpg/result_analyse/EncryptResultAnalyse.h b/src/gpg/result_analyse/EncryptResultAnalyse.h
index 9b6bc788..e0a411d1 100644
--- a/src/gpg/result_analyse/EncryptResultAnalyse.h
+++ b/src/gpg/result_analyse/EncryptResultAnalyse.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -30,16 +30,16 @@
namespace GpgFrontend {
class EncryptResultAnalyse : public ResultAnalyse {
-public:
+ public:
explicit EncryptResultAnalyse(GpgError error, GpgEncrResult result);
-protected:
+ protected:
void do_analyse() final;
-private:
+ private:
GpgError error;
GpgEncrResult result;
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_ENCRYPTRESULTANALYSE_H
+#endif // GPGFRONTEND_ENCRYPTRESULTANALYSE_H
diff --git a/src/gpg/result_analyse/ResultAnalyse.cpp b/src/gpg/result_analyse/ResultAnalyse.cpp
index 3005ea1f..821da2ee 100644
--- a/src/gpg/result_analyse/ResultAnalyse.cpp
+++ b/src/gpg/result_analyse/ResultAnalyse.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -28,13 +28,10 @@ const std::string GpgFrontend::ResultAnalyse::getResultReport() const {
return stream.str();
}
-int GpgFrontend::ResultAnalyse::getStatus() const {
- return status;
-}
+int GpgFrontend::ResultAnalyse::getStatus() const { return status; }
void GpgFrontend::ResultAnalyse::setStatus(int mStatus) {
- if (mStatus < status)
- status = mStatus;
+ if (mStatus < status) status = mStatus;
}
void GpgFrontend::ResultAnalyse::analyse() {
diff --git a/src/gpg/result_analyse/ResultAnalyse.h b/src/gpg/result_analyse/ResultAnalyse.h
index d187cd8a..33341b44 100644
--- a/src/gpg/result_analyse/ResultAnalyse.h
+++ b/src/gpg/result_analyse/ResultAnalyse.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -24,10 +24,10 @@
#ifndef GPGFRONTEND_RESULTANALYSE_H
#define GPGFRONTEND_RESULTANALYSE_H
-#include "gpg/GpgConstants.h"
-
#include <sstream>
#include <string>
+
+#include "gpg/GpgConstants.h"
namespace GpgFrontend {
class ResultAnalyse {
diff --git a/src/gpg/result_analyse/SignResultAnalyse.cpp b/src/gpg/result_analyse/SignResultAnalyse.cpp
index fcad9060..770594ca 100644
--- a/src/gpg/result_analyse/SignResultAnalyse.cpp
+++ b/src/gpg/result_analyse/SignResultAnalyse.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -23,6 +23,7 @@
*/
#include "gpg/result_analyse/SignResultAnalyse.h"
+
#include "gpg/function/GpgKeyGetter.h"
GpgFrontend::SignResultAnalyse::SignResultAnalyse(GpgError error,
@@ -30,53 +31,52 @@ GpgFrontend::SignResultAnalyse::SignResultAnalyse(GpgError error,
: error(error), result(std::move(result)) {}
void GpgFrontend::SignResultAnalyse::do_analyse() {
- LOG(INFO) << "Start Sign Result Analyse";
+ LOG(INFO) << _("Start Sign Result Analyse");
- stream << "[#] Sign Operation ";
+ stream << "[#] " << _("Sign Operation") << " ";
if (gpgme_err_code(error) == GPG_ERR_NO_ERROR)
- stream << "[Success]" << std::endl;
+ stream << "[" << _("Success") << "]" << std::endl;
else {
- stream << "[Failed] " << gpgme_strerror(error) << std::endl;
+ stream << "[" << _("Failed") << "] " << gpgme_strerror(error) << std::endl;
setStatus(-1);
}
if (result != nullptr &&
(result->signatures != nullptr || result->invalid_signers != nullptr)) {
-
- LOG(INFO) << "Sign Result Analyse Getting Result";
+ LOG(INFO) << _("Sign Result Analyse Getting Result");
stream << "------------>" << std::endl;
auto new_sign = result->signatures;
while (new_sign != nullptr) {
- stream << "[>] New Signature: " << std::endl;
+ stream << "[>]" << _("New Signature") << ": " << std::endl;
- LOG(INFO) << "Signers Fingerprint: " << new_sign->fpr;
+ LOG(INFO) << _("Signers Fingerprint") << ": " << new_sign->fpr;
- stream << " Sign Mode: ";
+ stream << " " << _("Sign Mode") << ": ";
if (new_sign->type == GPGME_SIG_MODE_NORMAL)
- stream << "Normal";
+ stream << _("Normal");
else if (new_sign->type == GPGME_SIG_MODE_CLEAR)
- stream << "Clear";
+ stream << _("Clear");
else if (new_sign->type == GPGME_SIG_MODE_DETACH)
- stream << "Detach";
+ stream << _("Detach");
stream << std::endl;
auto singerKey =
GpgFrontend::GpgKeyGetter::GetInstance().GetKey(new_sign->fpr);
if (singerKey.good()) {
- stream << " Signer: " << singerKey.uids()->front().uid()
- << std::endl;
+ stream << " " << _("Signer") << ": "
+ << singerKey.uids()->front().uid() << std::endl;
} else {
- stream << " Signer: "
+ stream << " " << _("Signer") << ": "
<< "<unknown>" << std::endl;
}
- stream << " Public Key Algo: "
+ stream << " " << _("Public Key Algo") << ": "
<< gpgme_pubkey_algo_name(new_sign->pubkey_algo) << std::endl;
- stream << " Hash Algo: " << gpgme_hash_algo_name(new_sign->hash_algo)
- << std::endl;
- stream << " Date & Time: "
+ stream << " " << _("Hash Algo") << ": "
+ << gpgme_hash_algo_name(new_sign->hash_algo) << std::endl;
+ stream << " " << _("Date & Time") << ": "
<< boost::posix_time::to_iso_string(
boost::posix_time::from_time_t(new_sign->timestamp))
<< std::endl;
@@ -86,19 +86,20 @@ void GpgFrontend::SignResultAnalyse::do_analyse() {
new_sign = new_sign->next;
}
- LOG(INFO) << "Sign Result Analyse Getting Invalid Signer";
+ LOG(INFO) << _("Sign Result Analyse Getting Invalid Signer");
auto invalid_signer = result->invalid_signers;
if (invalid_signer != nullptr)
- stream << "Invalid Signers: " << std::endl;
+ stream << _("Invalid Signers") << ": " << std::endl;
while (invalid_signer != nullptr) {
setStatus(0);
- stream << "[>] Signer: " << std::endl;
- stream << " Fingerprint: " << invalid_signer->fpr << std::endl;
- stream << " Reason: " << gpgme_strerror(invalid_signer->reason)
+ stream << "[>] " << _("Signer") << ": " << std::endl;
+ stream << " " << _("Fingerprint") << ": " << invalid_signer->fpr
<< std::endl;
+ stream << " " << _("Reason") << ": "
+ << gpgme_strerror(invalid_signer->reason) << std::endl;
stream << std::endl;
invalid_signer = invalid_signer->next;
diff --git a/src/gpg/result_analyse/SignResultAnalyse.h b/src/gpg/result_analyse/SignResultAnalyse.h
index 4a1234fe..988ddf99 100644
--- a/src/gpg/result_analyse/SignResultAnalyse.h
+++ b/src/gpg/result_analyse/SignResultAnalyse.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -30,18 +30,18 @@
namespace GpgFrontend {
class SignResultAnalyse : public ResultAnalyse {
-public:
+ public:
explicit SignResultAnalyse(GpgError error, GpgSignResult result);
-protected:
+ protected:
void do_analyse();
-private:
+ private:
GpgError error;
GpgSignResult result;
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_SIGNRESULTANALYSE_H
+#endif // GPGFRONTEND_SIGNRESULTANALYSE_H
diff --git a/src/gpg/result_analyse/VerifyResultAnalyse.cpp b/src/gpg/result_analyse/VerifyResultAnalyse.cpp
index 598329dd..849c2051 100644
--- a/src/gpg/result_analyse/VerifyResultAnalyse.cpp
+++ b/src/gpg/result_analyse/VerifyResultAnalyse.cpp
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -23,6 +23,7 @@
*/
#include "gpg/result_analyse/VerifyResultAnalyse.h"
+
#include "GpgFrontend.h"
#include "gpg/GpgConstants.h"
#include "gpg/function/GpgKeyGetter.h"
@@ -32,14 +33,14 @@ GpgFrontend::VerifyResultAnalyse::VerifyResultAnalyse(GpgError error,
: error(error), result(std::move(result)) {}
void GpgFrontend::VerifyResultAnalyse::do_analyse() {
- LOG(INFO) << "Verify Result Analyse Started";
+ LOG(INFO) << _("Verify Result Analyse Started");
- stream << "[#] Verify Operation ";
+ stream << "[#] " << _("Verify Operation") << " ";
if (gpgme_err_code(error) == GPG_ERR_NO_ERROR)
- stream << "[Success]" << std::endl;
+ stream << "[" << _("Success") << "]" << std::endl;
else {
- stream << "[Failed] " << gpgme_strerror(error) << std::endl;
+ stream << "[" << _("Failed") << "] " << gpgme_strerror(error) << std::endl;
setStatus(-1);
}
@@ -48,105 +49,108 @@ void GpgFrontend::VerifyResultAnalyse::do_analyse() {
auto sign = result->signatures;
if (sign == nullptr) {
- stream << "[>] Not Signature Found" << std::endl;
+ stream << "[>] " << _("Not Signature Found") << std::endl;
setStatus(0);
return;
}
- stream << "[>] Signed On "
+ stream << "[>] " << _("Signed On") << " "
<< boost::posix_time::to_iso_string(
boost::posix_time::from_time_t(sign->timestamp))
<< std::endl;
- stream << std::endl << "[>] Signatures:" << std::endl;
+ stream << std::endl << "[>] " << _("Signatures") << ":" << std::endl;
bool canContinue = true;
while (sign && canContinue) {
switch (gpg_err_code(sign->status)) {
- case GPG_ERR_BAD_SIGNATURE:
- stream << "One or More Bad Signatures." << std::endl;
- canContinue = false;
- setStatus(-1);
- break;
- case GPG_ERR_NO_ERROR:
- stream << "A ";
- if (sign->summary & GPGME_SIGSUM_GREEN) {
- stream << "Good ";
- }
- if (sign->summary & GPGME_SIGSUM_RED) {
- stream << "Bad ";
- }
- if (sign->summary & GPGME_SIGSUM_SIG_EXPIRED) {
- stream << "Expired ";
- }
- if (sign->summary & GPGME_SIGSUM_KEY_MISSING) {
- stream << "Missing Key's ";
- }
- if (sign->summary & GPGME_SIGSUM_KEY_REVOKED) {
- stream << "Revoked Key's ";
- }
- if (sign->summary & GPGME_SIGSUM_KEY_EXPIRED) {
- stream << "Expired Key's ";
- }
- if (sign->summary & GPGME_SIGSUM_CRL_MISSING) {
- stream << "Missing CRL's ";
- }
-
- if (sign->summary & GPGME_SIGSUM_VALID) {
- stream << "Signature Fully Valid." << std::endl;
- } else {
- stream << "Signature Not Fully Valid." << std::endl;
- }
-
- if (!(sign->status & GPGME_SIGSUM_KEY_MISSING)) {
- if (!print_signer(stream, sign))
+ case GPG_ERR_BAD_SIGNATURE:
+ stream << _("One or More Bad Signatures.") << std::endl;
+ canContinue = false;
+ setStatus(-1);
+ break;
+ case GPG_ERR_NO_ERROR:
+ stream << _("A") << " ";
+ if (sign->summary & GPGME_SIGSUM_GREEN) {
+ stream << _("Good") << " ";
+ }
+ if (sign->summary & GPGME_SIGSUM_RED) {
+ stream << _("Bad") << " ";
+ }
+ if (sign->summary & GPGME_SIGSUM_SIG_EXPIRED) {
+ stream << _("Expired") << " ";
+ }
+ if (sign->summary & GPGME_SIGSUM_KEY_MISSING) {
+ stream << _("Missing Key's") << " ";
+ }
+ if (sign->summary & GPGME_SIGSUM_KEY_REVOKED) {
+ stream << _("Revoked Key's") << " ";
+ }
+ if (sign->summary & GPGME_SIGSUM_KEY_EXPIRED) {
+ stream << _("Expired Key's") << " ";
+ }
+ if (sign->summary & GPGME_SIGSUM_CRL_MISSING) {
+ stream << _("Missing CRL's") << " ";
+ }
+
+ if (sign->summary & GPGME_SIGSUM_VALID) {
+ stream << _("Signature Fully Valid.") << std::endl;
+ } else {
+ stream << _("Signature Not Fully Valid.") << std::endl;
+ }
+
+ if (!(sign->status & GPGME_SIGSUM_KEY_MISSING)) {
+ if (!print_signer(stream, sign)) setStatus(0);
+ } else {
+ stream << _("Key is NOT present with ID 0x") << sign->fpr
+ << std::endl;
+ }
+
+ setStatus(1);
+
+ break;
+ case GPG_ERR_NO_PUBKEY:
+ stream << _("A signature could NOT be verified due to a Missing Key")
+ << std::endl;
+ setStatus(-1);
+ break;
+ case GPG_ERR_CERT_REVOKED:
+ stream << _("A signature is valid but the key used to verify the "
+ "signature has been revoked")
+ << std::endl;
+ if (!print_signer(stream, sign)) {
+ setStatus(0);
+ }
+ setStatus(-1);
+ break;
+ case GPG_ERR_SIG_EXPIRED:
+ stream << _("A signature is valid but expired") << std::endl;
+ if (!print_signer(stream, sign)) {
+ setStatus(0);
+ }
+ setStatus(-1);
+ break;
+ case GPG_ERR_KEY_EXPIRED:
+ stream << _("A signature is valid but the key used to "
+ "verify the signature has expired.")
+ << std::endl;
+ if (!print_signer(stream, sign)) {
setStatus(0);
- } else {
- stream << "Key is NOT present with ID 0x" << sign->fpr << std::endl;
- }
-
- setStatus(1);
-
- break;
- case GPG_ERR_NO_PUBKEY:
- stream << "A signature could NOT be verified due to a Missing "
- "Key\n";
- setStatus(-1);
- break;
- case GPG_ERR_CERT_REVOKED:
- stream << "A signature is valid but the key used to "
- "verify the signature has been revoked\n";
- if (!print_signer(stream, sign)) {
- setStatus(0);
- }
- setStatus(-1);
- break;
- case GPG_ERR_SIG_EXPIRED:
- stream << "A signature is valid but expired\n";
- if (!print_signer(stream, sign)) {
- setStatus(0);
- }
- setStatus(-1);
- break;
- case GPG_ERR_KEY_EXPIRED:
- stream << "A signature is valid but the key used to "
- "verify the signature has expired.\n";
- if (!print_signer(stream, sign)) {
- setStatus(0);
- }
- break;
- case GPG_ERR_GENERAL:
- stream << "There was some other error which prevented "
- "the signature verification.\n";
- status = -1;
- canContinue = false;
- break;
- default:
- auto fpr = std::string(sign->fpr);
- stream << "Error for key with fingerprint "
- << GpgFrontend::beautify_fingerprint(fpr);
- setStatus(-1);
+ }
+ break;
+ case GPG_ERR_GENERAL:
+ stream << _("There was some other error which prevented "
+ "the signature verification.")
+ << std::endl;
+ status = -1;
+ canContinue = false;
+ break;
+ default:
+ auto fpr = std::string(sign->fpr);
+ stream << _("Error for key with fingerprint") << " "
+ << GpgFrontend::beautify_fingerprint(fpr);
+ setStatus(-1);
}
stream << std::endl;
sign = sign->next;
@@ -161,18 +165,19 @@ bool GpgFrontend::VerifyResultAnalyse::print_signer(std::stringstream &stream,
auto key = GpgFrontend::GpgKeyGetter::GetInstance().GetKey(sign->fpr);
if (!key.good()) {
- stream << " Signed By: "
- << "<unknown>" << std::endl;
+ stream << " " << _("Signed By") << ": "
+ << "<" << _("Unknown") << ">" << std::endl;
setStatus(0);
keyFound = false;
} else {
- stream << " Signed By: " << key.uids()->front().uid() << std::endl;
+ stream << " " << _("Signed By") << ": " << key.uids()->front().uid()
+ << std::endl;
}
- stream << " Public Key Algo: " << gpgme_pubkey_algo_name(sign->pubkey_algo)
- << std::endl;
- stream << " Hash Algo: " << gpgme_hash_algo_name(sign->hash_algo)
- << std::endl;
- stream << " Date & Time: "
+ stream << " " << _("Public Key Algo") << ": "
+ << gpgme_pubkey_algo_name(sign->pubkey_algo) << std::endl;
+ stream << " " << _("Hash Algo") << ": "
+ << gpgme_hash_algo_name(sign->hash_algo) << std::endl;
+ stream << " " << _("Date & Time") << ": "
<< boost::posix_time::to_iso_string(
boost::posix_time::from_time_t(sign->timestamp))
<< std::endl;
diff --git a/src/gpg/result_analyse/VerifyResultAnalyse.h b/src/gpg/result_analyse/VerifyResultAnalyse.h
index 30352bee..c3364025 100644
--- a/src/gpg/result_analyse/VerifyResultAnalyse.h
+++ b/src/gpg/result_analyse/VerifyResultAnalyse.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * 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.
@@ -31,19 +31,19 @@
namespace GpgFrontend {
class VerifyResultAnalyse : public ResultAnalyse {
-public:
+ public:
explicit VerifyResultAnalyse(GpgError error, GpgVerifyResult result);
-private:
+ private:
void do_analyse();
-private:
+ private:
bool print_signer(std::stringstream &stream, gpgme_signature_t sign);
GpgError error;
GpgVerifyResult result;
};
-} // namespace GpgFrontend
+} // namespace GpgFrontend
-#endif // GPGFRONTEND_VERIFYRESULTANALYSE_H
+#endif // GPGFRONTEND_VERIFYRESULTANALYSE_H