aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2022-07-23 14:54:51 +0000
committerGitHub <[email protected]>2022-07-23 14:54:51 +0000
commitb244320b2d228189767aa6d59febceb6b64527fb (patch)
tree179d34e2a3e84231fad72c4bbe9f74673d0b74d0 /src/core/function
parentMerge pull request #68 from saturneric/develop-2.0.8 (diff)
parentfeat(project): add rpm package support (diff)
downloadGpgFrontend-2.0.9.tar.gz
GpgFrontend-2.0.9.zip
Merge pull request #70 from saturneric/dev/2.0.8/saturnericv2.0.9
Develop 2.0.9.1
Diffstat (limited to 'src/core/function')
-rw-r--r--src/core/function/ArchiveFileOperator.cpp12
-rw-r--r--src/core/function/ArchiveFileOperator.h10
-rw-r--r--src/core/function/DataObjectOperator.cpp1
-rw-r--r--src/core/function/FileOperator.cpp66
-rw-r--r--src/core/function/GlobalSettingStation.h4
-rw-r--r--src/core/function/KeyPackageOperator.cpp3
-rw-r--r--src/core/function/PassphraseGenerator.cpp50
-rw-r--r--src/core/function/aes/aes_ssl.h8
-rw-r--r--src/core/function/aes/aes_ssl_cbc.cpp2
-rw-r--r--src/core/function/gpg/GpgCommandExecutor.h3
-rw-r--r--src/core/function/gpg/GpgFileOpera.h1
-rw-r--r--src/core/function/gpg/GpgKeyOpera.cpp7
-rw-r--r--src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp4
-rw-r--r--src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp4
-rw-r--r--src/core/function/result_analyse/GpgSignResultAnalyse.cpp2
15 files changed, 88 insertions, 89 deletions
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp
index 17f29df1..64c7389e 100644
--- a/src/core/function/ArchiveFileOperator.cpp
+++ b/src/core/function/ArchiveFileOperator.cpp
@@ -151,7 +151,8 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive(
#ifdef WINDOWS
auto entry_path =
- QString::fromStdWString(std::wstring(archive_entry_pathname_w(entry))).toUtf8()
+ QString::fromStdWString(std::wstring(archive_entry_pathname_w(entry)))
+ .toUtf8()
.toStdString();
#else
auto entry_path = std::string(archive_entry_pathname_utf8(entry));
@@ -161,7 +162,6 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive(
<< archive_entry_size(entry) << " bytes"
<< "file type" << archive_entry_filetype(entry);
-
r = archive_write_header(a, entry);
if (r < ARCHIVE_OK) {
LOG(ERROR) << "archive_write_header() failed: "
@@ -231,11 +231,11 @@ void GpgFrontend::ArchiveFileOperator::ExtractArchive(
LOG(ERROR) << "cannot read from stdin";
}
#ifdef WINDOWS
- if (archive_read_open_filename_w(a, archive_path.wstring().c_str(),
- 10240) != ARCHIVE_OK) {
+ if (archive_read_open_filename_w(a, archive_path.wstring().c_str(), 10240) !=
+ ARCHIVE_OK) {
#else
- if (archive_read_open_filename(a, archive_path.u8string().c_str(),
- 10240) != ARCHIVE_OK) {
+ if (archive_read_open_filename(a, archive_path.u8string().c_str(), 10240) !=
+ ARCHIVE_OK) {
#endif
LOG(ERROR) << "archive_read_open_filename() failed: "
<< archive_error_string(a);
diff --git a/src/core/function/ArchiveFileOperator.h b/src/core/function/ArchiveFileOperator.h
index 28d1ad65..4db5af5f 100644
--- a/src/core/function/ArchiveFileOperator.h
+++ b/src/core/function/ArchiveFileOperator.h
@@ -46,15 +46,13 @@ class GPGFRONTEND_CORE_EXPORT ArchiveFileOperator {
public:
static void ListArchive(const std::filesystem::path &archive_path);
- static void CreateArchive(
- const std::filesystem::path &base_path,
- const std::filesystem::path &archive_path,
+ static void CreateArchive(const std::filesystem::path &base_path,
+ const std::filesystem::path &archive_path,
int compress,
const std::vector<std::filesystem::path> &files);
- static void ExtractArchive(
- const std::filesystem::path &archive_path,
- const std::filesystem::path &base_path);
+ static void ExtractArchive(const std::filesystem::path &archive_path,
+ const std::filesystem::path &base_path);
};
} // namespace GpgFrontend
diff --git a/src/core/function/DataObjectOperator.cpp b/src/core/function/DataObjectOperator.cpp
index d5b746d6..2744c448 100644
--- a/src/core/function/DataObjectOperator.cpp
+++ b/src/core/function/DataObjectOperator.cpp
@@ -29,6 +29,7 @@
#include "DataObjectOperator.h"
#include <qt-aes/qaesencryption.h>
+
#include <boost/date_time.hpp>
#include "core/function/FileOperator.h"
diff --git a/src/core/function/FileOperator.cpp b/src/core/function/FileOperator.cpp
index 4977b3a9..fcbdb91c 100644
--- a/src/core/function/FileOperator.cpp
+++ b/src/core/function/FileOperator.cpp
@@ -1,30 +1,30 @@
/**
-* Copyright (C) 2021 Saturneric
-*
-* 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.
-*
-* GpgFrontend 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 GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
-*
-* The initial version of the source code is inherited from
-* the gpg4usb project, which is under GPL-3.0-or-later.
-*
-* All the source code of GpgFrontend was modified and released by
-* Saturneric<[email protected]> starting on May 12, 2021.
-*
-* SPDX-License-Identifier: GPL-3.0-or-later
-*
-*/
+ * Copyright (C) 2021 Saturneric
+ *
+ * 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.
+ *
+ * GpgFrontend 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 GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from
+ * the gpg4usb project, which is under GPL-3.0-or-later.
+ *
+ * All the source code of GpgFrontend was modified and released by
+ * Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
#include "FileOperator.h"
@@ -56,9 +56,11 @@ bool GpgFrontend::FileOperator::ReadFileStd(
const std::filesystem::path& file_name, std::string& data) {
QByteArray byte_data;
#ifdef WINDOWS
- bool res = ReadFile(QString::fromStdU16String(file_name.u16string()).toUtf8(), byte_data);
+ bool res = ReadFile(QString::fromStdU16String(file_name.u16string()).toUtf8(),
+ byte_data);
#else
- bool res = ReadFile(QString::fromStdString(file_name.u8string()).toUtf8(), byte_data);
+ bool res = ReadFile(QString::fromStdString(file_name.u8string()).toUtf8(),
+ byte_data);
#endif
data = byte_data.toStdString();
return res;
@@ -66,7 +68,8 @@ bool GpgFrontend::FileOperator::ReadFileStd(
bool GpgFrontend::FileOperator::WriteFileStd(
const std::filesystem::path& file_name, const std::string& data) {
- return WriteFile(QString::fromStdString(file_name.u8string()).toUtf8(), QByteArray::fromStdString(data));
+ return WriteFile(QString::fromStdString(file_name.u8string()).toUtf8(),
+ QByteArray::fromStdString(data));
}
std::string GpgFrontend::FileOperator::CalculateHash(
@@ -80,12 +83,11 @@ std::string GpgFrontend::FileOperator::CalculateHash(
ss << " " << _("filename") << _(": ")
<< file_path.filename().u8string().c_str() << std::endl;
-
QFile f(info.filePath());
f.open(QFile::ReadOnly);
auto buffer = f.readAll();
- ss << " " << _("file size(bytes)") << _(": ")
- << buffer.size() << std::endl;
+ ss << " " << _("file size(bytes)") << _(": ") << buffer.size()
+ << std::endl;
f.close();
if (f.open(QFile::ReadOnly)) {
auto hash_md5 = QCryptographicHash(QCryptographicHash::Md5);
diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h
index ccf8e8f0..58282466 100644
--- a/src/core/function/GlobalSettingStation.h
+++ b/src/core/function/GlobalSettingStation.h
@@ -142,8 +142,8 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation
void SyncSettings() noexcept;
private:
- std::filesystem::path app_path_ =
- QCoreApplication::applicationDirPath().toStdString(); ///< Program Location
+ std::filesystem::path app_path_ = QCoreApplication::applicationDirPath()
+ .toStdString(); ///< Program Location
std::filesystem::path app_data_path_ =
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
.toStdString(); ///< Program Data Location
diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp
index 67fa3fac..3779c64b 100644
--- a/src/core/function/KeyPackageOperator.cpp
+++ b/src/core/function/KeyPackageOperator.cpp
@@ -72,7 +72,6 @@ bool KeyPackageOperator::ImportKeyPackage(
const std::filesystem::path& key_package_path,
const std::filesystem::path& phrase_path,
GpgFrontend::GpgImportInformation& import_info) {
-
LOG(INFO) << "Importing key package: " << key_package_path.u8string();
std::string encrypted_data;
@@ -101,7 +100,7 @@ bool KeyPackageOperator::ImportKeyPackage(
auto decoded = encryption.removePadding(encryption.decode(encoded, hash_key));
auto key_data = QByteArray::fromBase64(decoded);
- LOG(INFO) << "key data" << key_data.size();
+ LOG(INFO) << "key data" << key_data.size();
if (!key_data.startsWith(GpgConstants::PGP_PUBLIC_KEY_BEGIN) &&
!key_data.startsWith(GpgConstants::PGP_PRIVATE_KEY_BEGIN)) {
return false;
diff --git a/src/core/function/PassphraseGenerator.cpp b/src/core/function/PassphraseGenerator.cpp
index 0267edda..de963fa1 100644
--- a/src/core/function/PassphraseGenerator.cpp
+++ b/src/core/function/PassphraseGenerator.cpp
@@ -1,29 +1,29 @@
/**
-* Copyright (C) 2021 Saturneric
-*
-* 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.
-*
-* GpgFrontend 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 GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
-*
-* The initial version of the source code is inherited from
-* the gpg4usb project, which is under GPL-3.0-or-later.
-*
-* All the source code of GpgFrontend was modified and released by
-* Saturneric<[email protected]> starting on May 12, 2021.
-*
-* SPDX-License-Identifier: GPL-3.0-or-later
-*
+ * Copyright (C) 2021 Saturneric
+ *
+ * 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.
+ *
+ * GpgFrontend 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 GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from
+ * the gpg4usb project, which is under GPL-3.0-or-later.
+ *
+ * All the source code of GpgFrontend was modified and released by
+ * Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
*/
#include "PassphraseGenerator.h"
diff --git a/src/core/function/aes/aes_ssl.h b/src/core/function/aes/aes_ssl.h
index b5f0820f..e75b68dd 100644
--- a/src/core/function/aes/aes_ssl.h
+++ b/src/core/function/aes/aes_ssl.h
@@ -29,11 +29,11 @@
#ifndef GPGFRONTEND_AES_SSL_H
#define GPGFRONTEND_AES_SSL_H
-#include "GpgFrontend.h"
-
#include <openssl/aes.h>
#include <openssl/evp.h>
+#include "GpgFrontend.h"
+
namespace GpgFrontend::RawAPI {
/**
@@ -69,6 +69,6 @@ uint8_t *aes_256_cbc_encrypt(EVP_CIPHER_CTX *e, uint8_t *plaintext, int *len);
*/
uint8_t *aes_256_cbc_decrypt(EVP_CIPHER_CTX *e, uint8_t *ciphertext, int *len);
-} // namespace GpgFrontend::RawAPI
+} // namespace GpgFrontend::RawAPI
-#endif // GPGFRONTEND_AES_SSL_H
+#endif // GPGFRONTEND_AES_SSL_H
diff --git a/src/core/function/aes/aes_ssl_cbc.cpp b/src/core/function/aes/aes_ssl_cbc.cpp
index 95ae0ce2..88a54baa 100644
--- a/src/core/function/aes/aes_ssl_cbc.cpp
+++ b/src/core/function/aes/aes_ssl_cbc.cpp
@@ -96,4 +96,4 @@ uint8_t *aes_256_cbc_decrypt(EVP_CIPHER_CTX *e, uint8_t *ciphertext, int *len) {
return plaintext;
}
-} // namespace GpgFrontend::RawAPI \ No newline at end of file
+} // namespace GpgFrontend::RawAPI \ No newline at end of file
diff --git a/src/core/function/gpg/GpgCommandExecutor.h b/src/core/function/gpg/GpgCommandExecutor.h
index 00d9b43d..40ee22df 100644
--- a/src/core/function/gpg/GpgCommandExecutor.h
+++ b/src/core/function/gpg/GpgCommandExecutor.h
@@ -42,7 +42,8 @@ namespace GpgFrontend {
* @brief Extra commands related to GPG
*
*/
-class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor : public SingletonFunctionObject<GpgCommandExecutor> {
+class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor
+ : public SingletonFunctionObject<GpgCommandExecutor> {
public:
/**
* @brief Construct a new Gpg Command Executor object
diff --git a/src/core/function/gpg/GpgFileOpera.h b/src/core/function/gpg/GpgFileOpera.h
index 3f223535..dc81bc53 100644
--- a/src/core/function/gpg/GpgFileOpera.h
+++ b/src/core/function/gpg/GpgFileOpera.h
@@ -43,7 +43,6 @@ namespace GpgFrontend {
class GPGFRONTEND_CORE_EXPORT GpgFileOpera
: public SingletonFunctionObject<GpgFileOpera> {
public:
-
explicit GpgFileOpera(
int channel = SingletonFunctionObject::GetDefaultChannel());
diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp
index e36edfd9..03d8c8d9 100644
--- a/src/core/function/gpg/GpgKeyOpera.cpp
+++ b/src/core/function/gpg/GpgKeyOpera.cpp
@@ -36,13 +36,12 @@
#include <string>
#include <vector>
-#include "core/GpgConstants.h"
-#include "core/GpgGenKeyInfo.h"
#include "GpgCommandExecutor.h"
#include "GpgKeyGetter.h"
+#include "core/GpgConstants.h"
+#include "core/GpgGenKeyInfo.h"
-GpgFrontend::GpgKeyOpera::GpgKeyOpera(
- int channel)
+GpgFrontend::GpgKeyOpera::GpgKeyOpera(int channel)
: SingletonFunctionObject<GpgKeyOpera>(channel) {}
/**
diff --git a/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp b/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp
index ff3d2e27..d3ec8d6e 100644
--- a/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp
+++ b/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp
@@ -30,8 +30,8 @@
#include "function/gpg/GpgKeyGetter.h"
-GpgFrontend::GpgDecryptResultAnalyse::GpgDecryptResultAnalyse(GpgError m_error,
- GpgDecrResult m_result)
+GpgFrontend::GpgDecryptResultAnalyse::GpgDecryptResultAnalyse(
+ GpgError m_error, GpgDecrResult m_result)
: error_(m_error), result_(std::move(m_result)) {}
void GpgFrontend::GpgDecryptResultAnalyse::do_analyse() {
diff --git a/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp b/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp
index 053a15a5..9b3b9700 100644
--- a/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp
+++ b/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp
@@ -28,8 +28,8 @@
#include "GpgEncryptResultAnalyse.h"
-GpgFrontend::GpgEncryptResultAnalyse::GpgEncryptResultAnalyse(GpgError error,
- GpgEncrResult result)
+GpgFrontend::GpgEncryptResultAnalyse::GpgEncryptResultAnalyse(
+ GpgError error, GpgEncrResult result)
: error_(error), result_(std::move(result)) {}
void GpgFrontend::GpgEncryptResultAnalyse::do_analyse() {
diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
index e389523c..a47b8e3e 100644
--- a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
+++ b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp
@@ -31,7 +31,7 @@
#include "function/gpg/GpgKeyGetter.h"
GpgFrontend::GpgSignResultAnalyse::GpgSignResultAnalyse(GpgError error,
- GpgSignResult result)
+ GpgSignResult result)
: error_(error), result_(std::move(result)) {}
void GpgFrontend::GpgSignResultAnalyse::do_analyse() {