aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt16
-rw-r--r--src/GpgFrontend.h.in2
-rw-r--r--src/before_exit.cpp2
-rw-r--r--src/gpg/CMakeLists.txt17
-rw-r--r--src/gpg/GpgFunctionObject.h2
-rw-r--r--src/gpg/GpgGenKeyInfo.cpp2
-rw-r--r--src/gpg/GpgGenKeyInfo.h2
-rw-r--r--src/signal.cpp4
-rw-r--r--src/smtp/CMakeLists.txt14
-rw-r--r--src/smtp/SmtpMime31
-rw-r--r--src/smtp/emailaddress.cpp44
-rw-r--r--src/smtp/emailaddress.h63
-rw-r--r--src/smtp/mimeattachment.cpp43
-rw-r--r--src/smtp/mimeattachment.h51
-rw-r--r--src/smtp/mimecontentformatter.cpp59
-rw-r--r--src/smtp/mimecontentformatter.h43
-rw-r--r--src/smtp/mimefile.cpp61
-rw-r--r--src/smtp/mimefile.h63
-rw-r--r--src/smtp/mimehtml.cpp46
-rw-r--r--src/smtp/mimehtml.h61
-rw-r--r--src/smtp/mimeinlinefile.cpp42
-rw-r--r--src/smtp/mimeinlinefile.h56
-rw-r--r--src/smtp/mimemessage.cpp312
-rw-r--r--src/smtp/mimemessage.h110
-rw-r--r--src/smtp/mimemultipart.cpp71
-rw-r--r--src/smtp/mimemultipart.h71
-rw-r--r--src/smtp/mimepart.cpp158
-rw-r--r--src/smtp/mimepart.h110
-rw-r--r--src/smtp/mimetext.cpp52
-rw-r--r--src/smtp/mimetext.h62
-rw-r--r--src/smtp/quotedprintable.cpp62
-rw-r--r--src/smtp/quotedprintable.h39
-rw-r--r--src/smtp/smtpclient.cpp407
-rw-r--r--src/smtp/smtpclient.h197
-rw-r--r--src/smtp/smtpexports.h10
-rw-r--r--src/ui/CMakeLists.txt22
-rw-r--r--src/ui/GpgFrontendUI.h6
-rwxr-xr-xsrc/ui/KeyMgmt.cpp1
-rwxr-xr-xsrc/ui/KeyMgmt.h4
-rw-r--r--src/ui/aes/qaesencryption.cpp626
-rw-r--r--src/ui/aes/qaesencryption.h165
-rw-r--r--src/ui/settings/GlobalSettingStation.cpp2
-rw-r--r--src/ui/settings/GlobalSettingStation.h2
-rw-r--r--src/ui/settings/SettingsSendMail.cpp4
-rw-r--r--src/ui/settings/SettingsSendMail.h1
-rw-r--r--src/ui/smtp/SendMailDialog.cpp3
-rw-r--r--src/ui/thread/SMTPSendMailThread.h4
-rw-r--r--src/ui/thread/SMTPTestThread.h5
-rw-r--r--src/ui/thread/VersionCheckThread.cpp2
-rw-r--r--src/ui/widgets/ExportKeyPackageDialog.cpp1
50 files changed, 40 insertions, 3193 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index be587533..7f243df8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,12 +8,6 @@ if (UI_CORE)
add_subdirectory(ui)
endif ()
-if (SMTP_SUPPORT)
- message(STATUS "Build SMTP Support")
- add_compile_definitions(SMTP_SUPPORT)
- add_subdirectory(smtp)
-endif ()
-
if (SERVER_SUPPORT)
message(STATUS "Build Server Support")
add_compile_definitions(SERVER_SUPPORT)
@@ -244,25 +238,19 @@ if (APPLICATION_BUILD)
if (ADVANCE_SUPPORT)
set(GPGFRONTEND_BEFORE_UI_LIBS ${GPGFRONTEND_BEFORE_UI_LIBS} server)
endif ()
- if (SMTP_SUPPORT)
- set(GPGFRONTEND_BEFORE_UI_LIBS ${GPGFRONTEND_BEFORE_UI_LIBS} smtp)
- endif ()
- set(GPGFRONTEND_LIBS ${GPGFRONTEND_AFTER_UI_LIBS} gpgfrontend_ui gpgfrontend_core ${GPGFRONTEND_BEFORE_UI_LIBS} easy_logging_pp)
+ set(GPGFRONTEND_LIBS ${GPGFRONTEND_AFTER_UI_LIBS} gpgfrontend_ui gpgfrontend_core ${GPGFRONTEND_BEFORE_UI_LIBS} easyloggingpp)
set(QT_DEPENDENCY_LIBS Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
message(STATUS "Boost Libraries ${Boost_LIBRARIES}")
IF (MINGW)
message(STATUS "Link Application Static Library For MINGW")
- find_library(libconfig NAMES libconfig++.a)
- find_library(libintl NAMES libintl.a)
- find_library(libiconv NAMES libiconv.a)
target_link_libraries(${AppName}
${GPGFRONTEND_LIBS}
${QT_DEPENDENCY_LIBS}
${Boost_LIBRARIES}
- ${libintl} ${libiconv} ${libconfig} crypto ssl)
+ crypto ssl)
elseif (APPLE)
message(STATUS "Link Application Static Library For macOS")
target_link_libraries(${AppName}
diff --git a/src/GpgFrontend.h.in b/src/GpgFrontend.h.in
index 11934550..c6ff0518 100644
--- a/src/GpgFrontend.h.in
+++ b/src/GpgFrontend.h.in
@@ -45,7 +45,7 @@
// logging
#define ELPP_DEFAULT_LOGGING_FLAGS 8192
-#include <easyloggingpp/easylogging++.h>
+#include <easylogging++.h>
#define PROJECT_NAME "@CMAKE_PROJECT_NAME@"
#define OS_PLATFORM @OS_PLATFORM@
diff --git a/src/before_exit.cpp b/src/before_exit.cpp
index ba731203..53878758 100644
--- a/src/before_exit.cpp
+++ b/src/before_exit.cpp
@@ -22,8 +22,6 @@
*
*/
-#include <easyloggingpp/easylogging++.h>
-
#include "ui/settings/GlobalSettingStation.h"
void before_exit(int status, void *arg) {
diff --git a/src/gpg/CMakeLists.txt b/src/gpg/CMakeLists.txt
index 604191f3..52cb5d3c 100644
--- a/src/gpg/CMakeLists.txt
+++ b/src/gpg/CMakeLists.txt
@@ -6,14 +6,9 @@ aux_source_directory(. GPG_SOURCE)
add_library(gpgfrontend_core STATIC ${GPG_SOURCE})
set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils)
-
set(GPGME_LIB_DIR ${UTILS_DIR}/gpgme/lib)
-if (EASY_LOGGING_PP)
- message(STATUS "Link EASY_LOGGING_PP")
- set(THIRD_PARTY_LIBS easy_logging_pp config++)
-endif ()
-
+set(THIRD_PARTY_LIBS easyloggingpp config++)
set(BOOST_LIBS Boost::date_time Boost::filesystem)
message(STATUS "Third Party Libraries " ${THIRD_PARTY_LIBS})
@@ -25,13 +20,10 @@ if (MINGW)
gpgme gpg-error assuan wsock32)
target_compile_features(gpgfrontend_core PUBLIC cxx_std_17)
elseif (APPLE)
- find_library(libgpgme NAMES libgpgme.a)
- find_library(libgpg-error NAMES libgpg-error.a)
- find_library(libassuan NAMES libassuan.a)
message(STATUS "Link GPG Static Library For macOS")
target_link_libraries(gpgfrontend_core ${THIRD_PARTY_LIBS}
+ gpgme gpg-error assuan
${BOOST_LIBS}
- ${libgpgme} ${libgpg-error} ${libassuan}
dl)
if (XCODE_BUILD)
set_target_properties(gpgfrontend_core
@@ -41,12 +33,9 @@ elseif (APPLE)
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif ()
else ()
- find_library(libgpgme NAMES libgpgme.a)
- find_library(libgpg-error NAMES libgpg-error.a)
- find_library(libassuan NAMES libassuan.a)
message(STATUS "Link GPG Static Library For Unix")
target_link_libraries(gpgfrontend_core ${THIRD_PARTY_LIBS}
- ${libgpgme} ${libgpg-error} ${libassuan}
+ gpgme gpg-error assuan
${BOOST_LIBS}
pthread dl)
endif ()
diff --git a/src/gpg/GpgFunctionObject.h b/src/gpg/GpgFunctionObject.h
index 404b2f84..9a2273d7 100644
--- a/src/gpg/GpgFunctionObject.h
+++ b/src/gpg/GpgFunctionObject.h
@@ -25,8 +25,6 @@
#ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
#define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
-#include <easyloggingpp/easylogging++.h>
-
#include <map>
#include <memory>
#include <mutex>
diff --git a/src/gpg/GpgGenKeyInfo.cpp b/src/gpg/GpgGenKeyInfo.cpp
index f67aaa1f..1274421d 100644
--- a/src/gpg/GpgGenKeyInfo.cpp
+++ b/src/gpg/GpgGenKeyInfo.cpp
@@ -24,8 +24,6 @@
#include "gpg/GpgGenKeyInfo.h"
-#include <easyloggingpp/easylogging++.h>
-
#include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/date_time/gregorian/greg_duration.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
diff --git a/src/gpg/GpgGenKeyInfo.h b/src/gpg/GpgGenKeyInfo.h
index 8f7d19ea..89030b15 100644
--- a/src/gpg/GpgGenKeyInfo.h
+++ b/src/gpg/GpgGenKeyInfo.h
@@ -31,6 +31,8 @@
#include <string>
#include <vector>
+#include "GpgFrontend.h"
+
namespace GpgFrontend {
class GenKeyInfo {
diff --git a/src/signal.cpp b/src/signal.cpp
index c5b6727e..c43229b3 100644
--- a/src/signal.cpp
+++ b/src/signal.cpp
@@ -22,10 +22,10 @@
*
*/
-#include <easyloggingpp/easylogging++.h>
-
#include <csetjmp>
+#include "GpgFrontend.h"
+
extern jmp_buf recover_env;
void handle_signal(int sig) {
diff --git a/src/smtp/CMakeLists.txt b/src/smtp/CMakeLists.txt
deleted file mode 100644
index afae322e..00000000
--- a/src/smtp/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-aux_source_directory(. SMTP_MIME_SOURCE)
-
-add_library(smtp STATIC ${SMTP_MIME_SOURCE})
-
-target_link_libraries(smtp
- Qt5::Network Qt5::Core)
-
-if(XCODE_BUILD)
-set_target_properties(smtp
- PROPERTIES
- ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
-endif() \ No newline at end of file
diff --git a/src/smtp/SmtpMime b/src/smtp/SmtpMime
deleted file mode 100644
index 940996b8..00000000
--- a/src/smtp/SmtpMime
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef SMTPMIME_H
-#define SMTPMIME_H
-
-#include "smtpclient.h"
-#include "mimepart.h"
-#include "mimehtml.h"
-#include "mimeattachment.h"
-#include "mimemessage.h"
-#include "mimetext.h"
-#include "mimeinlinefile.h"
-#include "mimefile.h"
-
-#endif // SMTPMIME_H
diff --git a/src/smtp/emailaddress.cpp b/src/smtp/emailaddress.cpp
deleted file mode 100644
index c0ecaa0d..00000000
--- a/src/smtp/emailaddress.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/emailaddress.h"
-
-/* [1] Constructors and Destructors */
-
-EmailAddress::EmailAddress(const QString &address, const QString &name) {
- this->address = address;
- this->name = name;
-}
-
-EmailAddress::~EmailAddress() {}
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-
-void EmailAddress::setName(const QString &name) { this->name = name; }
-
-void EmailAddress::setAddress(const QString &address) {
- this->address = address;
-}
-
-const QString &EmailAddress::getName() const { return name; }
-
-const QString &EmailAddress::getAddress() const { return address; }
-
-/* [2] --- */
diff --git a/src/smtp/emailaddress.h b/src/smtp/emailaddress.h
deleted file mode 100644
index 90e4c1e9..00000000
--- a/src/smtp/emailaddress.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef EMAILADDRESS_H
-#define EMAILADDRESS_H
-
-#include <QObject>
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT EmailAddress : public QObject {
-Q_OBJECT
-public:
-
- /* [1] Constructors and Destructors */
-
- EmailAddress() = default;
-
- explicit EmailAddress(const QString &address, const QString &name = "");
-
- ~EmailAddress() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters */
- void setName(const QString &name);
-
- void setAddress(const QString &address);
-
- [[nodiscard]] const QString &getName() const;
-
- [[nodiscard]] const QString &getAddress() const;
-
- /* [2] --- */
-
-
-private:
-
- /* [3] Private members */
-
- QString name;
- QString address;
-
- /* [3] --- */
-};
-
-#endif // EMAILADDRESS_H
diff --git a/src/smtp/mimeattachment.cpp b/src/smtp/mimeattachment.cpp
deleted file mode 100644
index 033eecfb..00000000
--- a/src/smtp/mimeattachment.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimeattachment.h"
-#include <QFileInfo>
-
-/* [1] Constructors and Destructors */
-
-MimeAttachment::MimeAttachment(QFile *file) : MimeFile(file) {}
-
-MimeAttachment::MimeAttachment(const QByteArray &stream,
- const QString &fileName)
- : MimeFile(stream, fileName) {}
-
-MimeAttachment::~MimeAttachment() = default;
-
-/* [1] --- */
-
-/* [2] Protected methods */
-
-void MimeAttachment::prepare() {
- this->header += "Content-disposition: attachment\r\n";
-
- /* !!! IMPORTANT !!! */
- MimeFile::prepare();
-}
-
-/* [2] --- */
diff --git a/src/smtp/mimeattachment.h b/src/smtp/mimeattachment.h
deleted file mode 100644
index 6b98a65a..00000000
--- a/src/smtp/mimeattachment.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEATTACHMENT_H
-#define MIMEATTACHMENT_H
-
-#include <QFile>
-#include "mimepart.h"
-#include "mimefile.h"
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeAttachment : public MimeFile {
-Q_OBJECT
-public:
-
- /* [1] Constructors and Destructors */
-
- explicit MimeAttachment(QFile *file);
-
- MimeAttachment(const QByteArray &stream, const QString &fileName);
-
- ~MimeAttachment() override;
-
- /* [1] --- */
-
-protected:
-
- /* [2] Protected methods */
-
- void prepare() override;
-
- /* [2] --- */
-};
-
-#endif // MIMEATTACHMENT_H
diff --git a/src/smtp/mimecontentformatter.cpp b/src/smtp/mimecontentformatter.cpp
deleted file mode 100644
index 8f538457..00000000
--- a/src/smtp/mimecontentformatter.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimecontentformatter.h"
-
-MimeContentFormatter::MimeContentFormatter(int max_length)
- : max_length(max_length) {}
-
-QString MimeContentFormatter::format(const QString &content,
- bool quotedPrintable) const {
-
- QString out;
-
- int chars = 0;
- for (auto i : content) {
- chars++;
- if (!quotedPrintable) {
- if (chars > max_length) {
- out.append("\r\n");
- chars = 1;
- }
- } else {
- if (i == '\n') { // new line
- out.append(i);
- chars = 0;
- continue;
- }
-
- if ((chars > max_length - 1) ||
- ((i == '=') && (chars > max_length - 3))) {
- out.append('=');
- out.append("\r\n");
- chars = 1;
- }
- }
- out.append(i);
- }
-
- return out;
-}
-
-void MimeContentFormatter::setMaxLength(int l) { max_length = l; }
-
-int MimeContentFormatter::getMaxLength() const { return max_length; }
diff --git a/src/smtp/mimecontentformatter.h b/src/smtp/mimecontentformatter.h
deleted file mode 100644
index e6e3637f..00000000
--- a/src/smtp/mimecontentformatter.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMECONTENTFORMATTER_H
-#define MIMECONTENTFORMATTER_H
-
-#include <QObject>
-#include <QByteArray>
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeContentFormatter : public QObject {
-Q_OBJECT
-public:
- explicit MimeContentFormatter(int max_length = 76);
-
- void setMaxLength(int l);
-
- [[nodiscard]] int getMaxLength() const;
-
- [[nodiscard]] QString format(const QString &content, bool quotedPrintable = false) const;
-
-protected:
- int max_length;
-
-};
-
-#endif // MIMECONTENTFORMATTER_H
diff --git a/src/smtp/mimefile.cpp b/src/smtp/mimefile.cpp
deleted file mode 100644
index 4f095b84..00000000
--- a/src/smtp/mimefile.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimefile.h"
-#include <QFileInfo>
-
-/* [1] Constructors and Destructors */
-
-MimeFile::MimeFile(QFile *file) {
- this->file = file;
- this->cType = "application/octet-stream";
- this->cName = QFileInfo(*file).fileName();
- this->cEncoding = Base64;
-}
-
-MimeFile::MimeFile(const QByteArray &stream, const QString &fileName) {
- this->cEncoding = Base64;
- this->cType = "application/octet-stream";
- this->file = nullptr;
- this->cName = fileName;
- this->content = stream;
-}
-
-MimeFile::~MimeFile() {
- delete file;
-}
-
-/* [1] --- */
-
-/* [2] Getters and setters */
-
-/* [2] --- */
-
-/* [3] Protected methods */
-
-void MimeFile::prepare() {
- if (this->file) {
- file->open(QIODevice::ReadOnly);
- this->content = file->readAll();
- file->close();
- }
- /* !!! IMPORTANT !!!! */
- MimePart::prepare();
-}
-
-/* [3] --- */
diff --git a/src/smtp/mimefile.h b/src/smtp/mimefile.h
deleted file mode 100644
index 46903da9..00000000
--- a/src/smtp/mimefile.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEFILE_H
-#define MIMEFILE_H
-
-#include "mimepart.h"
-#include <QFile>
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeFile : public MimePart {
-Q_OBJECT
-public:
-
- /* [1] Constructors and Destructors */
-
- MimeFile(const QByteArray &stream, const QString &fileName);
-
- explicit MimeFile(QFile *f);
-
- ~MimeFile() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters */
-
- /* [2] --- */
-
-protected:
-
- /* [3] Protected members */
-
- QFile *file;
-
- /* [3] --- */
-
-
- /* [4] Protected methods */
-
- void prepare() override;
-
- /* [4] --- */
-
-};
-
-#endif // MIMEFILE_H
diff --git a/src/smtp/mimehtml.cpp b/src/smtp/mimehtml.cpp
deleted file mode 100644
index 9f3a53c3..00000000
--- a/src/smtp/mimehtml.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimehtml.h"
-
-/* [1] Constructors and Destructors */
-
-MimeHtml::MimeHtml(const QString &html) : MimeText(html) {
- this->cType = "text/html";
-}
-
-MimeHtml::~MimeHtml() = default;
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-
-void MimeHtml::setHtml(const QString &html) { this->text = html; }
-
-const QString &MimeHtml::getHtml() const { return text; }
-
-/* [2] --- */
-
-/* [3] Protected methods */
-
-void MimeHtml::prepare() {
- /* !!! IMPORTANT !!! */
- MimeText::prepare();
-}
-
-/* [3] --- */
diff --git a/src/smtp/mimehtml.h b/src/smtp/mimehtml.h
deleted file mode 100644
index 8ce8c454..00000000
--- a/src/smtp/mimehtml.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEHTML_H
-#define MIMEHTML_H
-
-#include "mimetext.h"
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeHtml : public MimeText {
-Q_OBJECT
-public:
-
- /* [1] Constructors and Destructors */
-
- explicit MimeHtml(const QString &html = "");
-
- ~MimeHtml() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters */
-
- void setHtml(const QString &html);
-
- [[nodiscard]] const QString &getHtml() const;
-
- /* [2] --- */
-
-protected:
-
- /* [3] Protected members */
-
- /* [3] --- */
-
-
- /* [4] Protected methods */
-
- void prepare() override;
-
- /* [4] --- */
-};
-
-#endif // MIMEHTML_H
diff --git a/src/smtp/mimeinlinefile.cpp b/src/smtp/mimeinlinefile.cpp
deleted file mode 100644
index a49167e8..00000000
--- a/src/smtp/mimeinlinefile.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimeinlinefile.h"
-
-/* [1] Constructors and Destructors */
-
-MimeInlineFile::MimeInlineFile(QFile *f) : MimeFile(f) {}
-
-MimeInlineFile::~MimeInlineFile() = default;
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-
-/* [2] --- */
-
-/* [3] Protected methods */
-
-void MimeInlineFile::prepare() {
- this->header += "Content-Disposition: inline\r\n";
-
- /* !!! IMPORTANT !!! */
- MimeFile::prepare();
-}
-
-/* [3] --- */
diff --git a/src/smtp/mimeinlinefile.h b/src/smtp/mimeinlinefile.h
deleted file mode 100644
index 916f7b76..00000000
--- a/src/smtp/mimeinlinefile.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEINLINEFILE_H
-#define MIMEINLINEFILE_H
-
-#include "mimefile.h"
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeInlineFile : public MimeFile {
-public:
-
- /* [1] Constructors and Destructors */
-
- explicit MimeInlineFile(QFile *f);
-
- ~MimeInlineFile() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters */
-
- /* [2] --- */
-
-protected:
-
- /* [3] Protected members */
-
- /* [3] --- */
-
-
- /* [4] Protected methods */
-
- void prepare() override;
-
- /* [4] --- */
-};
-
-#endif // MIMEINLINEFILE_H
diff --git a/src/smtp/mimemessage.cpp b/src/smtp/mimemessage.cpp
deleted file mode 100644
index 6c058e89..00000000
--- a/src/smtp/mimemessage.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimemessage.h"
-
-#include <QDateTime>
-#include <QLocale>
-#include <typeinfo>
-
-#include "smtp/quotedprintable.h"
-
-/* [1] Constructors and Destructors */
-MimeMessage::MimeMessage(bool createAutoMimeContent)
- : replyTo(nullptr), hEncoding(MimePart::_8Bit) {
- if (createAutoMimeContent) this->content = new MimeMultiPart();
-
- autoMimeContentCreated = createAutoMimeContent;
-}
-
-MimeMessage::~MimeMessage() {
- if (this->autoMimeContentCreated) {
- this->autoMimeContentCreated = false;
- delete (this->content);
- }
-}
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-MimePart &MimeMessage::getContent() { return *content; }
-
-void MimeMessage::setContent(MimePart *content) {
- if (this->autoMimeContentCreated) {
- this->autoMimeContentCreated = false;
- delete (this->content);
- }
- this->content = content;
-}
-
-void MimeMessage::setReplyTo(EmailAddress *rto) { replyTo = rto; }
-
-void MimeMessage::setSender(EmailAddress *e) {
- this->sender = e;
- e->setParent(this);
-}
-
-void MimeMessage::addRecipient(EmailAddress *rcpt, RecipientType type) {
- switch (type) {
- case To:
- recipientsTo << rcpt;
- break;
- case Cc:
- recipientsCc << rcpt;
- break;
- case Bcc:
- recipientsBcc << rcpt;
- break;
- }
-
- rcpt->setParent(this);
-}
-
-void MimeMessage::addTo(EmailAddress *rcpt) { this->recipientsTo << rcpt; }
-
-void MimeMessage::addCc(EmailAddress *rcpt) { this->recipientsCc << rcpt; }
-
-void MimeMessage::addBcc(EmailAddress *rcpt) { this->recipientsBcc << rcpt; }
-
-void MimeMessage::setSubject(const QString &subject) {
- this->subject = subject;
-}
-
-void MimeMessage::addPart(MimePart *part) {
- if (typeid(*content) == typeid(MimeMultiPart)) {
- ((MimeMultiPart *)content)->addPart(part);
- };
-}
-
-void MimeMessage::setInReplyTo(const QString &inReplyTo) {
- mInReplyTo = inReplyTo;
-}
-
-void MimeMessage::setHeaderEncoding(MimePart::Encoding hEnc) {
- this->hEncoding = hEnc;
-}
-
-const EmailAddress &MimeMessage::getSender() const { return *sender; }
-
-const QList<EmailAddress *> &MimeMessage::getRecipients(
- RecipientType type) const {
- switch (type) {
- default:
- case To:
- return recipientsTo;
- case Cc:
- return recipientsCc;
- case Bcc:
- return recipientsBcc;
- }
-}
-
-const EmailAddress *MimeMessage::getReplyTo() const { return replyTo; }
-
-const QString &MimeMessage::getSubject() const { return subject; }
-
-const QList<MimePart *> &MimeMessage::getParts() const {
- if (typeid(*content) == typeid(MimeMultiPart)) {
- return ((MimeMultiPart *)content)->getParts();
- } else {
- auto *res = new QList<MimePart *>();
- res->append(content);
- return *res;
- }
-}
-
-/* [2] --- */
-
-/* [3] Public Methods */
-
-QString MimeMessage::toString() {
- QString mime;
-
- /* =========== MIME HEADER ============ */
-
- /* ---------- Sender / From ----------- */
- mime = "From:";
- if (!sender->getName().isEmpty()) {
- switch (hEncoding) {
- case MimePart::Base64:
- mime += " =?utf-8?B?" +
- QByteArray().append(sender->getName().toUtf8()).toBase64() +
- "?=";
- break;
- case MimePart::QuotedPrintable:
- mime += " =?utf-8?Q?" +
- QuotedPrintable::encode(
- QByteArray().append(sender->getName().toUtf8()))
- .replace(' ', "_")
- .replace(':', "=3A") +
- "?=";
- break;
- default:
- mime += " " + sender->getName();
- }
- }
- mime += " <" + sender->getAddress() + ">\r\n";
- /* ---------------------------------- */
-
- /* ------- Recipients / To ---------- */
- mime += "To:";
- QList<EmailAddress *>::iterator it;
- int i;
- for (i = 0, it = recipientsTo.begin(); it != recipientsTo.end(); ++it, ++i) {
- if (i != 0) {
- mime += ",";
- }
-
- if (!(*it)->getName().isEmpty()) {
- switch (hEncoding) {
- case MimePart::Base64:
- mime += " =?utf-8?B?" +
- QByteArray().append((*it)->getName().toUtf8()).toBase64() +
- "?=";
- break;
- case MimePart::QuotedPrintable:
- mime += " =?utf-8?Q?" +
- QuotedPrintable::encode(
- QByteArray().append((*it)->getName().toUtf8()))
- .replace(' ', "_")
- .replace(':', "=3A") +
- "?=";
- break;
- default:
- mime += " " + (*it)->getName();
- }
- }
- mime += " <" + (*it)->getAddress() + ">";
- }
- mime += "\r\n";
- /* ---------------------------------- */
-
- /* ------- Recipients / Cc ---------- */
- if (!recipientsCc.empty()) {
- mime += "Cc:";
- }
- for (i = 0, it = recipientsCc.begin(); it != recipientsCc.end(); ++it, ++i) {
- if (i != 0) {
- mime += ",";
- }
-
- if ((*it)->getName() != "") {
- switch (hEncoding) {
- case MimePart::Base64:
- mime += " =?utf-8?B?" +
- QByteArray().append((*it)->getName().toUtf8()).toBase64() +
- "?=";
- break;
- case MimePart::QuotedPrintable:
- mime += " =?utf-8?Q?" +
- QuotedPrintable::encode(
- QByteArray().append((*it)->getName().toUtf8()))
- .replace(' ', "_")
- .replace(':', "=3A") +
- "?=";
- break;
- default:
- mime += " " + (*it)->getName();
- }
- }
- mime += " <" + (*it)->getAddress() + ">";
- }
- if (!recipientsCc.empty()) {
- mime += "\r\n";
- }
- /* ---------------------------------- */
-
- /* ------------ Subject ------------- */
- mime += "Subject: ";
-
- switch (hEncoding) {
- case MimePart::Base64:
- mime += "=?utf-8?B?" + QByteArray().append(subject.toUtf8()).toBase64() +
- "?=";
- break;
- case MimePart::QuotedPrintable:
- mime += "=?utf-8?Q?" +
- QuotedPrintable::encode(QByteArray().append(subject.toUtf8()))
- .replace(' ', "_")
- .replace(':', "=3A") +
- "?=";
- break;
- default:
- mime += subject;
- }
- mime += "\r\n";
- /* ---------------------------------- */
-
- /* ---------- Reply-To -------------- */
- if (replyTo) {
- mime += "Reply-To: ";
- if (!replyTo->getName().isEmpty()) {
- switch (hEncoding) {
- case MimePart::Base64:
- mime += " =?utf-8?B?" +
- QByteArray().append(replyTo->getName().toUtf8()).toBase64() +
- "?=";
- break;
- case MimePart::QuotedPrintable:
- mime += " =?utf-8?Q?" +
- QuotedPrintable::encode(
- QByteArray().append(replyTo->getName().toUtf8()))
- .replace(' ', "_")
- .replace(':', "=3A") +
- "?=";
- break;
- default:
- mime += " " + replyTo->getName();
- }
- }
- mime += " <" + replyTo->getAddress() + ">\r\n";
- }
-
- /* ---------------------------------- */
-
- mime += "MIME-Version: 1.0\r\n";
- if (!mInReplyTo.isEmpty()) {
- mime += "In-Reply-To: <" + mInReplyTo + ">\r\n";
- mime += "References: <" + mInReplyTo + ">\r\n";
- }
-
- QDateTime now = QDateTime::currentDateTime();
-#if QT_VERSION_MAJOR < 5 // Qt4 workaround since RFC2822Date isn't defined
- QString shortDayName =
- QLocale::c().dayName(now.date().dayOfWeek(), QLocale::ShortFormat);
- QString shortMonthName =
- QLocale::c().monthName(now.date().month(), QLocale::ShortFormat);
- int utcOffset = now.secsTo(QDateTime(now.date(), now.time(), Qt::UTC)) / 60;
- char timezoneSign = utcOffset >= 0 ? '+' : '-';
- utcOffset = utcOffset >= 0 ? utcOffset : -utcOffset;
- QString timezone = QString("%1%2%3")
- .arg(timezoneSign)
- .arg(utcOffset / 60, 2, 10, QChar('0'))
- .arg(utcOffset % 60, 2, 10, QChar('0'));
- mime += QString("Date: %1\r\n")
- .arg(now.toString("%1, dd %2 yyyy hh:mm:ss %3")
- .arg(shortDayName)
- .arg(shortMonthName)
- .arg(timezone));
-#else // Qt5 supported
- mime += QString("Date: %1\r\n").arg(now.toString(Qt::RFC2822Date));
-#endif // support RFC2822Date
-
- mime += content->toString();
- return mime;
-}
-
-/* [3] --- */
diff --git a/src/smtp/mimemessage.h b/src/smtp/mimemessage.h
deleted file mode 100644
index 24e4f108..00000000
--- a/src/smtp/mimemessage.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEMESSAGE_H
-#define MIMEMESSAGE_H
-
-#include "mimepart.h"
-#include "mimemultipart.h"
-#include "emailaddress.h"
-#include <QList>
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeMessage : public QObject {
-public:
-
- enum RecipientType {
- To, // primary
- Cc, // carbon copy
- Bcc // blind carbon copy
- };
-
- /* [1] Constructors and Destructors */
-
- explicit MimeMessage(bool createAutoMimeConent = true);
-
- ~MimeMessage() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters */
-
- void setSender(EmailAddress *e);
-
- void addRecipient(EmailAddress *rcpt, RecipientType type = To);
-
- void addTo(EmailAddress *rcpt);
-
- void addCc(EmailAddress *rcpt);
-
- void addBcc(EmailAddress *rcpt);
-
- void setSubject(const QString &subject);
-
- void addPart(MimePart *part);
-
- void setReplyTo(EmailAddress *rto);
-
- void setInReplyTo(const QString &inReplyTo);
-
- void setHeaderEncoding(MimePart::Encoding);
-
- [[nodiscard]] const EmailAddress &getSender() const;
-
- [[nodiscard]] const QList<EmailAddress *> &getRecipients(RecipientType type = To) const;
-
- [[nodiscard]] const QString &getSubject() const;
-
- [[nodiscard]] const QList<MimePart *> &getParts() const;
-
- [[nodiscard]] const EmailAddress *getReplyTo() const;
-
- MimePart &getContent();
-
- void setContent(MimePart *content);
- /* [2] --- */
-
-
- /* [3] Public methods */
-
- virtual QString toString();
-
- /* [3] --- */
-
-protected:
-
- /* [4] Protected members */
-
- EmailAddress *sender{};
- EmailAddress *replyTo;
- QList<EmailAddress *> recipientsTo, recipientsCc, recipientsBcc;
- QString subject;
- QString mInReplyTo;
- MimePart *content;
- bool autoMimeContentCreated;
-
- MimePart::Encoding hEncoding;
-
- /* [4] --- */
-
-
-};
-
-#endif // MIMEMESSAGE_H
diff --git a/src/smtp/mimemultipart.cpp b/src/smtp/mimemultipart.cpp
deleted file mode 100644
index 4dd00d1a..00000000
--- a/src/smtp/mimemultipart.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimemultipart.h"
-
-#include <QCryptographicHash>
-#include <QRandomGenerator>
-#include <QTime>
-
-const QString MULTI_PART_NAMES[] = {
- "multipart/mixed", // Mixed
- "multipart/digest", // Digest
- "multipart/alternative", // Alternative
- "multipart/related", // Related
- "multipart/report", // Report
- "multipart/signed", // Signed
- "multipart/encrypted" // Encrypted
-};
-
-MimeMultiPart::MimeMultiPart(MultiPartType type) {
- this->type = type;
- this->cType = MULTI_PART_NAMES[this->type];
- this->cEncoding = _8Bit;
-
- QRandomGenerator generator;
-
- QCryptographicHash md5(QCryptographicHash::Md5);
- md5.addData(QByteArray().append((char)generator.generate()));
- cBoundary = md5.result().toHex();
-}
-
-void MimeMultiPart::addPart(MimePart *part) { parts.append(part); }
-
-const QList<MimePart *> &MimeMultiPart::getParts() const { return parts; }
-
-void MimeMultiPart::prepare() {
- QList<MimePart *>::iterator it;
-
- content.clear();
- for (it = parts.begin(); it != parts.end(); it++) {
- content += QString("--" + cBoundary + "\r\n").toUtf8();
- (*it)->prepare();
- content += (*it)->toString().toUtf8();
- };
-
- content += QString("--" + cBoundary + "--\r\n").toUtf8();
-
- MimePart::prepare();
-}
-
-void MimeMultiPart::setMimeType(const MultiPartType type) {
- this->type = type;
- this->cType = MULTI_PART_NAMES[type];
-}
-
-MimeMultiPart::MultiPartType MimeMultiPart::getMimeType() const { return type; }
diff --git a/src/smtp/mimemultipart.h b/src/smtp/mimemultipart.h
deleted file mode 100644
index b829a66f..00000000
--- a/src/smtp/mimemultipart.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEMULTIPART_H
-#define MIMEMULTIPART_H
-
-#include "mimepart.h"
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeMultiPart : public MimePart {
-Q_OBJECT
-public:
- /* [0] Enums */
- enum MultiPartType {
- Mixed = 0, // RFC 2046, section 5.1.3
- Digest = 1, // RFC 2046, section 5.1.5
- Alternative = 2, // RFC 2046, section 5.1.4
- Related = 3, // RFC 2387
- Report = 4, // RFC 6522
- Signed = 5, // RFC 1847, section 2.1
- Encrypted = 6 // RFC 1847, section 2.2
- };
-
- /* [0] --- */
-
- /* [1] Constructors and Destructors */
- explicit MimeMultiPart(MultiPartType type = Related);
-
- /* [1] --- */
-
- /* [2] Getters and Setters */
-
- void setMimeType(MultiPartType type);
-
- [[nodiscard]] MultiPartType getMimeType() const;
-
- [[nodiscard]] const QList<MimePart *> &getParts() const;
-
- /* [2] --- */
-
- /* [3] Public methods */
-
- void addPart(MimePart *part);
-
- void prepare() override;
-
- /* [3] --- */
-
-protected:
- QList<MimePart *> parts;
-
- MultiPartType type;
-};
-
-#endif // MIMEMULTIPART_H
diff --git a/src/smtp/mimepart.cpp b/src/smtp/mimepart.cpp
deleted file mode 100644
index 10aa6cbc..00000000
--- a/src/smtp/mimepart.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimepart.h"
-
-#include "smtp/quotedprintable.h"
-
-/* [1] Constructors and Destructors */
-
-MimePart::MimePart() {
- cEncoding = _7Bit;
- prepared = false;
- cBoundary.clear();
-}
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-
-void MimePart::setContent(const QByteArray &content) {
- this->content = content;
-}
-
-void MimePart::setHeader(const QString &header) { this->header = header; }
-
-void MimePart::addHeaderLine(const QString &line) {
- this->header += line + "\r\n";
-}
-
-const QString &MimePart::getHeader() const { return header; }
-
-const QByteArray &MimePart::getContent() const { return content; }
-
-void MimePart::setContentId(const QString &cId) { this->cId = cId; }
-
-const QString &MimePart::getContentId() const { return this->cId; }
-
-void MimePart::setContentName(const QString &cName) { this->cName = cName; }
-
-const QString &MimePart::getContentName() const { return this->cName; }
-
-void MimePart::setContentType(const QString &cType) { this->cType = cType; }
-
-const QString &MimePart::getContentType() const { return this->cType; }
-
-void MimePart::setCharset(const QString &charset) { this->cCharset = charset; }
-
-const QString &MimePart::getCharset() const { return this->cCharset; }
-
-void MimePart::setEncoding(Encoding enc) { this->cEncoding = enc; }
-
-MimePart::Encoding MimePart::getEncoding() const { return this->cEncoding; }
-
-MimeContentFormatter &MimePart::getContentFormatter() {
- return this->formatter;
-}
-
-/* [2] --- */
-
-/* [3] Public methods */
-
-QString MimePart::toString() {
- if (!prepared) prepare();
-
- return mimeString;
-}
-
-/* [3] --- */
-
-/* [4] Protected methods */
-
-void MimePart::prepare() {
- mimeString = QString();
-
- /* === Header Prepare === */
-
- /* Content-Type */
- mimeString.append("Content-Type: ").append(cType);
-
- if (!cName.isEmpty())
- mimeString.append("; name=\"").append(cName).append("\"");
-
- if (!cCharset.isEmpty()) mimeString.append("; charset=").append(cCharset);
-
- if (!cBoundary.isEmpty()) mimeString.append("; boundary=").append(cBoundary);
-
- mimeString.append("\r\n");
- /* ------------ */
-
- /* Content-Transfer-Encoding */
- mimeString.append("Content-Transfer-Encoding: ");
- switch (cEncoding) {
- case _7Bit:
- mimeString.append("7bit\r\n");
- break;
- case _8Bit:
- mimeString.append("8bit\r\n");
- break;
- case Base64:
- mimeString.append("base64\r\n");
- break;
- case QuotedPrintable:
- mimeString.append("quoted-printable\r\n");
- break;
- }
- /* ------------------------ */
-
- /* Content-Id */
- if (cId != nullptr)
- mimeString.append("Content-ID: <").append(cId).append(">\r\n");
- /* ---------- */
-
- /* Addition header lines */
-
- mimeString.append(header).append("\r\n");
-
- /* ------------------------- */
-
- /* === End of Header Prepare === */
-
- /* === Content === */
- switch (cEncoding) {
- case _7Bit:
- mimeString.append(QString(content).toLatin1());
- break;
- case _8Bit:
- mimeString.append(content);
- break;
- case Base64:
- mimeString.append(formatter.format(content.toBase64()));
- break;
- case QuotedPrintable:
- mimeString.append(
- formatter.format(QuotedPrintable::encode(content), true));
- break;
- }
- mimeString.append("\r\n");
- /* === End of Content === */
-
- prepared = true;
-}
-
-/* [4] --- */
diff --git a/src/smtp/mimepart.h b/src/smtp/mimepart.h
deleted file mode 100644
index 1a1386de..00000000
--- a/src/smtp/mimepart.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMEPART_H
-#define MIMEPART_H
-
-#include "mimecontentformatter.h"
-#include <QObject>
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimePart : public QObject {
-Q_OBJECT
-public:
- /* [0] Enumerations */
- enum Encoding {
- _7Bit, _8Bit, Base64, QuotedPrintable
- };
-
- /* [0] --- */
-
- /* [1] Constructors and Destructors */
-
- MimePart();
-
- ~MimePart() = default;
-
- /* [1] --- */
-
- /* [2] Getters and Setters */
-
- [[nodiscard]] const QString &getHeader() const;
-
- [[nodiscard]] const QByteArray &getContent() const;
-
- void setContent(const QByteArray &content);
-
- void setHeader(const QString &header);
-
- void addHeaderLine(const QString &line);
-
- void setContentId(const QString &cId);
-
- [[nodiscard]] const QString &getContentId() const;
-
- void setContentName(const QString &cName);
-
- [[nodiscard]] const QString &getContentName() const;
-
- void setContentType(const QString &cType);
-
- [[nodiscard]] const QString &getContentType() const;
-
- void setCharset(const QString &charset);
-
- [[nodiscard]] const QString &getCharset() const;
-
- void setEncoding(Encoding enc);
-
- [[nodiscard]] Encoding getEncoding() const;
-
- MimeContentFormatter &getContentFormatter();
-
- /* [2] --- */
-
- /* [3] Public methods */
-
- virtual QString toString();
-
- virtual void prepare();
-
- /* [3] --- */
-
-protected:
- /* [4] Protected members */
-
- QString header;
- QByteArray content;
-
- QString cId;
- QString cName;
- QString cType;
- QString cCharset;
- QString cBoundary;
- Encoding cEncoding;
-
- QString mimeString;
- bool prepared;
-
- MimeContentFormatter formatter;
-
- /* [4] --- */
-};
-
-#endif // MIMEPART_H
diff --git a/src/smtp/mimetext.cpp b/src/smtp/mimetext.cpp
deleted file mode 100644
index 3726647e..00000000
--- a/src/smtp/mimetext.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/mimetext.h"
-
-/* [1] Constructors and Destructors */
-
-MimeText::MimeText(const QString &txt) {
- this->text = txt;
- this->cType = "text/plain";
- this->cCharset = "utf-8";
- this->cEncoding = _8Bit;
-}
-
-MimeText::~MimeText() = default;
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-
-void MimeText::setText(const QString &text) { this->text = text; }
-
-const QString &MimeText::getText() const { return text; }
-
-/* [2] --- */
-
-/* [3] Protected Methods */
-
-void MimeText::prepare() {
- this->content.clear();
- this->content.append(text.toUtf8());
-
- /* !!! IMPORTANT !!! */
- MimePart::prepare();
-}
-
-/* [3] --- */
diff --git a/src/smtp/mimetext.h b/src/smtp/mimetext.h
deleted file mode 100644
index c21a1c5e..00000000
--- a/src/smtp/mimetext.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef MIMETEXT_H
-#define MIMETEXT_H
-
-#include "mimepart.h"
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT MimeText : public MimePart {
-public:
-
- /* [1] Constructors and Destructors */
-
- explicit MimeText(const QString &text = "");
-
- ~MimeText() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters*/
-
- void setText(const QString &text);
-
- [[nodiscard]] const QString &getText() const;
-
- /* [2] --- */
-
-protected:
-
- /* [3] Protected members */
-
- QString text;
- /* [3] --- */
-
-
- /* [4] Protected methods */
-
- void prepare() override;
-
- /* [4] --- */
-
-};
-
-#endif // MIMETEXT_H
diff --git a/src/smtp/quotedprintable.cpp b/src/smtp/quotedprintable.cpp
deleted file mode 100644
index 93e51122..00000000
--- a/src/smtp/quotedprintable.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/quotedprintable.h"
-
-QString QuotedPrintable::encode(const QByteArray &input) {
- QString output;
-
- char byte;
- const char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
-
- for (char i : input) {
- byte = i;
-
- if ((byte == 0x20) || ((byte >= 33) && (byte <= 126) && (byte != 61))) {
- output.append(byte);
- } else {
- output.append('=');
- output.append(hex[((byte >> 4) & 0x0F)]);
- output.append(hex[(byte & 0x0F)]);
- }
- }
-
- return output;
-}
-
-QByteArray QuotedPrintable::decode(const QString &input) {
- // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B
- // C D E F
- const int hexVal[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
- 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15};
-
- QByteArray output;
-
- for (int i = 0; i < input.length(); ++i) {
- if (input.at(i).toLatin1() == '=') {
- output.append((hexVal[input.at(i + 1).toLatin1() - '0'] << 4) +
- hexVal[input.at(i + 2).toLatin1() - '0']);
- i += 2;
- } else {
- output.append(input.at(i).toLatin1());
- }
- }
-
- return output;
-}
diff --git a/src/smtp/quotedprintable.h b/src/smtp/quotedprintable.h
deleted file mode 100644
index 00ca3cf8..00000000
--- a/src/smtp/quotedprintable.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef QUOTEDPRINTABLE_H
-#define QUOTEDPRINTABLE_H
-
-#include <QObject>
-#include <QByteArray>
-
-#include "smtpexports.h"
-
-class SMTP_EXPORT QuotedPrintable : public QObject {
-Q_OBJECT
-public:
-
- static QString encode(const QByteArray &input);
-
- static QByteArray decode(const QString &input);
-
-private:
- QuotedPrintable();
-};
-
-#endif // QUOTEDPRINTABLE_H
diff --git a/src/smtp/smtpclient.cpp b/src/smtp/smtpclient.cpp
deleted file mode 100644
index 63202998..00000000
--- a/src/smtp/smtpclient.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#include "smtp/smtpclient.h"
-
-#include <QByteArray>
-#include <QFileInfo>
-
-/* [1] Constructors and destructors */
-
-SmtpClient::SmtpClient(const QString &host, int port,
- ConnectionType connectionType)
- : socket(NULL), name("localhost"), authMethod(AuthPlain),
- connectionTimeout(5000), responseTimeout(5000),
- sendMessageTimeout(60000) {
- setConnectionType(connectionType);
-
- this->host = host;
- this->port = port;
-
- connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this,
- SLOT(socketStateChanged(QAbstractSocket::SocketState)));
- connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
- SLOT(socketError(QAbstractSocket::SocketError)));
- connect(socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
-}
-
-SmtpClient::~SmtpClient() {
- if (socket)
- delete socket;
-}
-
-/* [1] --- */
-
-/* [2] Getters and Setters */
-
-void SmtpClient::setUser(const QString &user) { this->user = user; }
-
-void SmtpClient::setPassword(const QString &password) {
- this->password = password;
-}
-
-void SmtpClient::setAuthMethod(AuthMethod method) { this->authMethod = method; }
-
-void SmtpClient::setHost(const QString &host) { this->host = host; }
-
-void SmtpClient::setPort(int port) { this->port = port; }
-
-void SmtpClient::setConnectionType(ConnectionType ct) {
- this->connectionType = ct;
-
- if (socket)
- delete socket;
-
- switch (connectionType) {
- case TcpConnection:
- socket = new QTcpSocket(this);
- break;
- case SslConnection:
- case TlsConnection:
- socket = new QSslSocket(this);
- }
-}
-
-const QString &SmtpClient::getHost() const { return this->host; }
-
-const QString &SmtpClient::getUser() const { return this->user; }
-
-const QString &SmtpClient::getPassword() const { return this->password; }
-
-SmtpClient::AuthMethod SmtpClient::getAuthMethod() const {
- return this->authMethod;
-}
-
-int SmtpClient::getPort() const { return this->port; }
-
-SmtpClient::ConnectionType SmtpClient::getConnectionType() const {
- return connectionType;
-}
-
-const QString &SmtpClient::getName() const { return this->name; }
-
-void SmtpClient::setName(const QString &name) { this->name = name; }
-
-const QString &SmtpClient::getResponseText() const { return responseText; }
-
-int SmtpClient::getResponseCode() const { return responseCode; }
-
-QTcpSocket *SmtpClient::getSocket() { return socket; }
-
-int SmtpClient::getConnectionTimeout() const { return connectionTimeout; }
-
-void SmtpClient::setConnectionTimeout(int msec) { connectionTimeout = msec; }
-
-int SmtpClient::getResponseTimeout() const { return responseTimeout; }
-
-void SmtpClient::setResponseTimeout(int msec) { responseTimeout = msec; }
-
-int SmtpClient::getSendMessageTimeout() const { return sendMessageTimeout; }
-
-void SmtpClient::setSendMessageTimeout(int msec) { sendMessageTimeout = msec; }
-
-/* [2] --- */
-
-/* [3] Public methods */
-
-bool SmtpClient::connectToHost() {
- switch (connectionType) {
- case TlsConnection:
- case TcpConnection:
- socket->connectToHost(host, port);
- break;
- case SslConnection:
- ((QSslSocket *) socket)->connectToHostEncrypted(host, port);
- break;
- }
-
- // Tries to connect to server
- if (!socket->waitForConnected(connectionTimeout)) {
- emit smtpError(ConnectionTimeoutError);
- return false;
- }
-
- try {
- // Wait for the server's response
- waitForResponse();
-
- // If the response code is not 220 (Service ready)
- // means that is something wrong with the server
- if (responseCode != 220) {
- emit smtpError(ServerError);
- return false;
- }
-
- // Send a EHLO/HELO message to the server
- // The client's first command must be EHLO/HELO
- sendMessage("EHLO " + name);
-
- // Wait for the server's response
- waitForResponse();
-
- // The response code needs to be 250.
- if (responseCode != 250) {
- emit smtpError(ServerError);
- return false;
- }
-
- if (connectionType == TlsConnection) {
- // send a request to start TLS handshake
- sendMessage("STARTTLS");
-
- // Wait for the server's response
- waitForResponse();
-
- // The response code needs to be 220.
- if (responseCode != 220) {
- emit smtpError(ServerError);
- return false;
- };
-
- ((QSslSocket *) socket)->startClientEncryption();
-
- if (!((QSslSocket *) socket)->waitForEncrypted(connectionTimeout)) {
- qDebug() << ((QSslSocket *) socket)->errorString();
- emit smtpError(ConnectionTimeoutError);
- return false;
- }
-
- // Send ELHO one more time
- sendMessage("EHLO " + name);
-
- // Wait for the server's response
- waitForResponse();
-
- // The response code needs to be 250.
- if (responseCode != 250) {
- emit smtpError(ServerError);
- return false;
- }
- }
- } catch (ResponseTimeoutException) {
- return false;
- } catch (SendMessageTimeoutException) {
- return false;
- }
-
- // If no errors occured the function returns true.
- return true;
-}
-
-bool SmtpClient::login() { return login(user, password, authMethod); }
-
-bool SmtpClient::login(const QString &user, const QString &password,
- AuthMethod method) {
- try {
- if (method == AuthPlain) {
- // Sending command: AUTH PLAIN base64('\0' + username + '\0' + password)
- sendMessage("AUTH PLAIN " + QByteArray()
- .append((char) 0)
- .append(user.toUtf8())
- .append((char) 0)
- .append(password.toUtf8())
- .toBase64());
-
- // Wait for the server's response
- waitForResponse();
-
- // If the response is not 235 then the authentication was faild
- if (responseCode != 235) {
- emit smtpError(AuthenticationFailedError);
- return false;
- }
- } else if (method == AuthLogin) {
- // Sending command: AUTH LOGIN
- sendMessage("AUTH LOGIN");
-
- // Wait for 334 response code
- waitForResponse();
- if (responseCode != 334) {
- emit smtpError(AuthenticationFailedError);
- return false;
- }
-
- // Send the username in base64
- sendMessage(QByteArray().append(user.toUtf8()).toBase64());
-
- // Wait for 334
- waitForResponse();
- if (responseCode != 334) {
- emit smtpError(AuthenticationFailedError);
- return false;
- }
-
- // Send the password in base64
- sendMessage(QByteArray().append(password.toUtf8()).toBase64());
-
- // Wait for the server's responce
- waitForResponse();
-
- // If the response is not 235 then the authentication was faild
- if (responseCode != 235) {
- emit smtpError(AuthenticationFailedError);
- return false;
- }
- }
- } catch (ResponseTimeoutException) {
- // Responce Timeout exceeded
- emit smtpError(AuthenticationFailedError);
- return false;
- } catch (SendMessageTimeoutException) {
- // Send Timeout exceeded
- emit smtpError(AuthenticationFailedError);
- return false;
- }
-
- return true;
-}
-
-bool SmtpClient::sendMail(MimeMessage &email) {
- try {
- // Send the MAIL command with the sender
- sendMessage("MAIL FROM:<" + email.getSender().getAddress() + ">");
-
- waitForResponse();
-
- if (responseCode != 250)
- return false;
-
- // Send RCPT command for each recipient
- QList<EmailAddress *>::const_iterator it, itEnd;
- // To (primary recipients)
- for (it = email.getRecipients().begin(),
- itEnd = email.getRecipients().end();
- it != itEnd; ++it) {
-
- sendMessage("RCPT TO:<" + (*it)->getAddress() + ">");
- waitForResponse();
-
- if (responseCode != 250)
- return false;
- }
-
- // Cc (carbon copy)
- for (it = email.getRecipients(MimeMessage::Cc).begin(),
- itEnd = email.getRecipients(MimeMessage::Cc).end();
- it != itEnd; ++it) {
- sendMessage("RCPT TO:<" + (*it)->getAddress() + ">");
- waitForResponse();
-
- if (responseCode != 250)
- return false;
- }
-
- // Bcc (blind carbon copy)
- for (it = email.getRecipients(MimeMessage::Bcc).begin(),
- itEnd = email.getRecipients(MimeMessage::Bcc).end();
- it != itEnd; ++it) {
- sendMessage("RCPT TO:<" + (*it)->getAddress() + ">");
- waitForResponse();
-
- if (responseCode != 250)
- return false;
- }
-
- // Send DATA command
- sendMessage("DATA");
- waitForResponse();
-
- if (responseCode != 354)
- return false;
-
- sendMessage(email.toString());
-
- // Send \r\n.\r\n to end the mail data
- sendMessage(".");
-
- waitForResponse();
-
- if (responseCode != 250)
- return false;
- } catch (ResponseTimeoutException) {
- return false;
- } catch (SendMessageTimeoutException) {
- return false;
- }
-
- return true;
-}
-
-void SmtpClient::quit() {
- try {
- sendMessage("QUIT");
- } catch (SmtpClient::SendMessageTimeoutException) {
- // Manually close the connection to the smtp server if message "QUIT" wasn't
- // received by the smtp server
- if (socket->state() == QAbstractSocket::ConnectedState ||
- socket->state() == QAbstractSocket::ConnectingState ||
- socket->state() == QAbstractSocket::HostLookupState)
- socket->disconnectFromHost();
- }
-}
-
-/* [3] --- */
-
-/* [4] Protected methods */
-
-void SmtpClient::waitForResponse() {
- do {
- if (!socket->waitForReadyRead(responseTimeout)) {
- emit smtpError(ResponseTimeoutError);
- throw ResponseTimeoutException();
- }
-
- while (socket->canReadLine()) {
- // Save the server's response
- responseText = socket->readLine();
-
- // Extract the respose code from the server's responce (first 3 digits)
- responseCode = responseText.leftRef(3).toInt();
-
- if (responseCode / 100 == 4)
- emit smtpError(ServerError);
-
- if (responseCode / 100 == 5)
- emit smtpError(ClientError);
-
- if (responseText[3] == ' ') {
- return;
- }
- }
- } while (true);
-}
-
-void SmtpClient::sendMessage(const QString &text) {
- socket->write(text.toUtf8() + "\r\n");
- if (!socket->waitForBytesWritten(sendMessageTimeout)) {
- emit smtpError(SendDataTimeoutError);
- throw SendMessageTimeoutException();
- }
-}
-
-/* [4] --- */
-
-/* [5] Slots for the socket's signals */
-
-void SmtpClient::socketStateChanged(QAbstractSocket::SocketState /*state*/) {}
-
-void SmtpClient::socketError(QAbstractSocket::SocketError /*socketError*/) {}
-
-void SmtpClient::socketReadyRead() {}
-
-/* [5] --- */
diff --git a/src/smtp/smtpclient.h b/src/smtp/smtpclient.h
deleted file mode 100644
index 29c507dc..00000000
--- a/src/smtp/smtpclient.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- Copyright (c) 2011-2012 - Tőkés Attila
-
- This file is part of SmtpClient for Qt.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- See the LICENSE file for more details.
-*/
-
-#ifndef SMTPCLIENT_H
-#define SMTPCLIENT_H
-
-#include <QObject>
-#include <QtNetwork/QSslSocket>
-
-#include "mimemessage.h"
-#include "smtpexports.h"
-
-class SMTP_EXPORT SmtpClient : public QObject {
-Q_OBJECT
-public:
-
- /* [0] Enumerations */
-
- enum AuthMethod {
- AuthPlain,
- AuthLogin
- };
-
- enum SmtpError {
- ConnectionTimeoutError,
- ResponseTimeoutError,
- SendDataTimeoutError,
- AuthenticationFailedError,
- ServerError, // 4xx smtp error
- ClientError // 5xx smtp error
- };
-
- enum ConnectionType {
- TcpConnection,
- SslConnection,
- TlsConnection // STARTTLS
- };
-
- /* [0] --- */
-
-
- /* [1] Constructors and Destructors */
-
- explicit SmtpClient(const QString &host = "localhost", int port = 25, ConnectionType ct = TcpConnection);
-
- ~SmtpClient() override;
-
- /* [1] --- */
-
-
- /* [2] Getters and Setters */
-
- [[nodiscard]] const QString &getHost() const;
-
- void setHost(const QString &host);
-
- [[nodiscard]] int getPort() const;
-
- void setPort(int port);
-
- [[nodiscard]] const QString &getName() const;
-
- void setName(const QString &name);
-
- [[nodiscard]] ConnectionType getConnectionType() const;
-
- void setConnectionType(ConnectionType ct);
-
- [[nodiscard]] const QString &getUser() const;
-
- void setUser(const QString &user);
-
- [[nodiscard]] const QString &getPassword() const;
-
- void setPassword(const QString &password);
-
- [[nodiscard]] SmtpClient::AuthMethod getAuthMethod() const;
-
- void setAuthMethod(AuthMethod method);
-
- [[nodiscard]] const QString &getResponseText() const;
-
- [[nodiscard]] int getResponseCode() const;
-
- [[nodiscard]] int getConnectionTimeout() const;
-
- void setConnectionTimeout(int msec);
-
- [[nodiscard]] int getResponseTimeout() const;
-
- void setResponseTimeout(int msec);
-
- [[nodiscard]] int getSendMessageTimeout() const;
-
- void setSendMessageTimeout(int msec);
-
- QTcpSocket *getSocket();
-
-
- /* [2] --- */
-
-
- /* [3] Public methods */
-
- bool connectToHost();
-
- bool login();
-
- bool login(const QString &user, const QString &password, AuthMethod method = AuthLogin);
-
- bool sendMail(MimeMessage &email);
-
- void quit();
-
-
- /* [3] --- */
-
-protected:
-
- /* [4] Protected members */
-
- QTcpSocket *socket;
-
- QString host;
- int port;
- ConnectionType connectionType;
- QString name;
-
- QString user;
- QString password;
- AuthMethod authMethod;
-
- int connectionTimeout;
- int responseTimeout;
- int sendMessageTimeout;
-
-
- QString responseText;
- int responseCode;
-
-
- class ResponseTimeoutException : public std::exception {
- };
-
- class SendMessageTimeoutException : public std::exception {
- };
-
- /* [4] --- */
-
-
- /* [5] Protected methods */
-
- void waitForResponse();
-
- void sendMessage(const QString &text);
-
- /* [5] --- */
-
-protected slots:
-
- /* [6] Protected slots */
-
- void socketStateChanged(QAbstractSocket::SocketState state);
-
- void socketError(QAbstractSocket::SocketError error);
-
- void socketReadyRead();
-
- /* [6] --- */
-
-
-signals:
-
- /* [7] Signals */
-
- void smtpError(SmtpClient::SmtpError e);
-
- /* [7] --- */
-
-};
-
-#endif // SMTPCLIENT_H
diff --git a/src/smtp/smtpexports.h b/src/smtp/smtpexports.h
deleted file mode 100644
index 4bad0da0..00000000
--- a/src/smtp/smtpexports.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef SMTPEXPORTS_H
-#define SMTPEXPORTS_H
-
-#ifdef SMTP_BUILD
-#define SMTP_EXPORT
-#else
-#define SMTP_EXPORT
-#endif
-
-#endif // SMTPEXPORTS_H
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 32edb262..ed250b82 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,6 +1,5 @@
# tracking source files
aux_source_directory(. UI_SOURCE)
-aux_source_directory(./aes UI_SOURCE)
aux_source_directory(./keypair_details UI_SOURCE)
aux_source_directory(./widgets UI_SOURCE)
aux_source_directory(./keygen UI_SOURCE)
@@ -16,16 +15,31 @@ if (SMTP_SUPPORT)
aux_source_directory(./smtp UI_SOURCE)
endif ()
-
add_library(gpgfrontend_ui STATIC ${UI_SOURCE})
set(GPGFRONTEND_UI_LIB_NAME gpgfrontend_ui)
+
+# link smtp-mime
+if (SMTP_SUPPORT)
+ target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
+ smtp-mime)
+endif ()
+# link json
+target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
+ nlohmann_json::nlohmann_json)
+# Qt AES
+target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
+ QtAES)
# link Qt
target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
# link vmime
-find_library(libvmime NAMES libvmime.a)
target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
- ${libvmime} anl ssl crypto)
+ vmime-static anl ssl crypto)
+# link easyloggingpp
+target_link_libraries(${GPGFRONTEND_UI_LIB_NAME}
+ easyloggingpp)
+
+
target_include_directories(gpgfrontend_ui PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/${GPGFRONTEND_UI_LIB_NAME}_autogen/include)
diff --git a/src/ui/GpgFrontendUI.h b/src/ui/GpgFrontendUI.h
index 90e15324..fd7b814a 100644
--- a/src/ui/GpgFrontendUI.h
+++ b/src/ui/GpgFrontendUI.h
@@ -36,8 +36,14 @@
#undef LIBCONFIGXX_STATIC
#define LIBCONFIGXX_STATIC
+#include <qt-aes/qaesencryption.h>
+
#include <libconfig.h++>
+#ifdef SMTP_SUPPORT
+#include <SmtpMime>
+#endif
+
/**
* Resources File(s) Path Vars
*/
diff --git a/src/ui/KeyMgmt.cpp b/src/ui/KeyMgmt.cpp
index a0209d10..d6656ba3 100755
--- a/src/ui/KeyMgmt.cpp
+++ b/src/ui/KeyMgmt.cpp
@@ -31,7 +31,6 @@
#include "gpg/function/GpgKeyOpera.h"
#include "ui/SignalStation.h"
#include "ui/UserInterfaceUtils.h"
-#include "ui/aes/qaesencryption.h"
#include "ui/keygen/SubkeyGenerateDialog.h"
#include "ui/settings/GlobalSettingStation.h"
#include "ui/widgets/ExportKeyPackageDialog.h"
diff --git a/src/ui/KeyMgmt.h b/src/ui/KeyMgmt.h
index e3f250eb..1e0ad5d2 100755
--- a/src/ui/KeyMgmt.h
+++ b/src/ui/KeyMgmt.h
@@ -25,9 +25,9 @@
#ifndef __KEYMGMT_H__
#define __KEYMGMT_H__
-#include "KeyImportDetailDialog.h"
-#include "KeyServerImportDialog.h"
#include "ui/GpgFrontendUI.h"
+#include "ui/KeyImportDetailDialog.h"
+#include "ui/KeyServerImportDialog.h"
#include "ui/keygen/KeygenDialog.h"
#include "ui/keypair_details/KeyDetailsDialog.h"
#include "ui/widgets/KeyList.h"
diff --git a/src/ui/aes/qaesencryption.cpp b/src/ui/aes/qaesencryption.cpp
deleted file mode 100644
index 9103fb8e..00000000
--- a/src/ui/aes/qaesencryption.cpp
+++ /dev/null
@@ -1,626 +0,0 @@
-#include "qaesencryption.h"
-#include <QDebug>
-#include <QVector>
-
-#ifdef USE_INTEL_AES_IF_AVAILABLE
-#include "aesni/aesni-key-exp.h"
-#include "aesni/aesni-enc-ecb.h"
-#include "aesni/aesni-enc-cbc.h"
-#endif
-
-/*
- * Static Functions
- * */
-QByteArray QAESEncryption::Crypt(QAESEncryption::Aes level, QAESEncryption::Mode mode, const QByteArray &rawText,
- const QByteArray &key, const QByteArray &iv, QAESEncryption::Padding padding)
-{
- return QAESEncryption(level, mode, padding).encode(rawText, key, iv);
-}
-
-QByteArray QAESEncryption::Decrypt(QAESEncryption::Aes level, QAESEncryption::Mode mode, const QByteArray &rawText,
- const QByteArray &key, const QByteArray &iv, QAESEncryption::Padding padding)
-{
- return QAESEncryption(level, mode, padding).decode(rawText, key, iv);
-}
-
-QByteArray QAESEncryption::ExpandKey(QAESEncryption::Aes level, QAESEncryption::Mode mode, const QByteArray &key)
-{
- return QAESEncryption(level, mode).expandKey(key);
-}
-
-QByteArray QAESEncryption::RemovePadding(const QByteArray &rawText, QAESEncryption::Padding padding)
-{
- if (rawText.isEmpty())
- return rawText;
-
- QByteArray ret(rawText);
- switch (padding)
- {
- case Padding::ZERO:
- //Works only if the last byte of the decoded array is not zero
- while (ret.at(ret.length()-1) == 0x00)
- ret.remove(ret.length()-1, 1);
- break;
- case Padding::PKCS7:
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
- ret.remove(ret.length() - ret.back(), ret.back());
-#else
- ret.remove(ret.length() - ret.at(ret.length() - 1), ret.at(ret.length() - 1));
-#endif
- break;
- case Padding::ISO:
- {
- // Find the last byte which is not zero
- int marker_index = ret.length() - 1;
- for (; marker_index >= 0; --marker_index)
- {
- if (ret.at(marker_index) != 0x00)
- {
- break;
- }
- }
-
- // And check if it's the byte for marking padding
- if (ret.at(marker_index) == '\x80')
- {
- ret.truncate(marker_index);
- }
- break;
- }
- default:
- //do nothing
- break;
- }
- return ret;
-}
-/*
- * End Static function declarations
- * */
-
-/*
- * Local Functions
- * */
-
-namespace {
-
-quint8 xTime(quint8 x)
-{
- return ((x<<1) ^ (((x>>7) & 1) * 0x1b));
-}
-
-quint8 multiply(quint8 x, quint8 y)
-{
- return (((y & 1) * x) ^ ((y>>1 & 1) * xTime(x)) ^ ((y>>2 & 1) * xTime(xTime(x))) ^ ((y>>3 & 1)
- * xTime(xTime(xTime(x)))) ^ ((y>>4 & 1) * xTime(xTime(xTime(xTime(x))))));
-}
-
-}
-
-/*
- * End Local functions
- * */
-
-QAESEncryption::QAESEncryption(Aes level, Mode mode,
- Padding padding)
- : m_nb(4), m_blocklen(16), m_level(level), m_mode(mode), m_padding(padding)
- , m_aesNIAvailable(false), m_state(nullptr)
-{
-#ifdef USE_INTEL_AES_IF_AVAILABLE
- m_aesNIAvailable = check_aesni_support();
-#endif
-
- switch (level)
- {
- case AES_128: {
- AES128 aes;
- m_nk = aes.nk;
- m_keyLen = aes.keylen;
- m_nr = aes.nr;
- m_expandedKey = aes.expandedKey;
- }
- break;
- case AES_192: {
- AES192 aes;
- m_nk = aes.nk;
- m_keyLen = aes.keylen;
- m_nr = aes.nr;
- m_expandedKey = aes.expandedKey;
- }
- break;
- case AES_256: {
- AES256 aes;
- m_nk = aes.nk;
- m_keyLen = aes.keylen;
- m_nr = aes.nr;
- m_expandedKey = aes.expandedKey;
- }
- break;
- default: {
- AES128 aes;
- m_nk = aes.nk;
- m_keyLen = aes.keylen;
- m_nr = aes.nr;
- m_expandedKey = aes.expandedKey;
- }
- break;
- }
-
-}
-QByteArray QAESEncryption::getPadding(int currSize, int alignment)
-{
- int size = (alignment - currSize % alignment) % alignment;
- switch(m_padding)
- {
- case Padding::ZERO:
- return QByteArray(size, 0x00);
- break;
- case Padding::PKCS7:
- if (size == 0)
- size = alignment;
- return QByteArray(size, size);
- break;
- case Padding::ISO:
- if (size > 0)
- return QByteArray (size - 1, 0x00).prepend('\x80');
- break;
- default:
- return QByteArray(size, 0x00);
- break;
- }
- return QByteArray();
-}
-
-QByteArray QAESEncryption::expandKey(const QByteArray &key)
-{
-
-#ifdef USE_INTEL_AES_IF_AVAILABLE
- if (true){
- switch(m_level) {
- case AES_128: {
- AES128 aes128;
- quint8 ret[aes128.expandedKey];
- memset(ret, 0x00, sizeof(ret));
- quint8 uchar_key[key.size()];
- memcpy(uchar_key, key.data(), key.size());
- AES_128_Key_Expansion(uchar_key, ret);
- return QByteArray((char*) ret, aes128.expandedKey);
- }
- break;
- case AES_192: {
- AES192 aes192;
- quint8 ret[aes192.expandedKey];
- memset(ret, 0x00, sizeof(ret));
- quint8 uchar_key[key.size()];
- memcpy(uchar_key, key.data(), key.size());
-
- AES_192_Key_Expansion(uchar_key, ret);
- return QByteArray((char*) ret, aes192.expandedKey);
- }
- break;
- case AES_256: {
- AES256 aes256;
- quint8 ret[aes256.expandedKey];
- memset(ret, 0x00, sizeof(ret));
- quint8 uchar_key[key.size()];
- memcpy(uchar_key, key.data(), key.size());
-
- AES_256_Key_Expansion(uchar_key, ret);
- return QByteArray((char*) ret, aes256.expandedKey);
- }
- break;
- default:
- return QByteArray();
- break;
- }
- } else
-#endif
- {
-
- int i, k;
- quint8 tempa[4]; // Used for the column/row operations
- QByteArray roundKey(key); // The first round key is the key itself.
-
- // All other round keys are found from the previous round keys.
- //i == Nk
- for(i = m_nk; i < m_nb * (m_nr + 1); i++)
- {
- tempa[0] = (quint8) roundKey.at((i-1) * 4 + 0);
- tempa[1] = (quint8) roundKey.at((i-1) * 4 + 1);
- tempa[2] = (quint8) roundKey.at((i-1) * 4 + 2);
- tempa[3] = (quint8) roundKey.at((i-1) * 4 + 3);
-
- if (i % m_nk == 0)
- {
- // This function shifts the 4 bytes in a word to the left once.
- // [a0,a1,a2,a3] becomes [a1,a2,a3,a0]
-
- // Function RotWord()
- k = tempa[0];
- tempa[0] = tempa[1];
- tempa[1] = tempa[2];
- tempa[2] = tempa[3];
- tempa[3] = k;
-
- // Function Subword()
- tempa[0] = getSBoxValue(tempa[0]);
- tempa[1] = getSBoxValue(tempa[1]);
- tempa[2] = getSBoxValue(tempa[2]);
- tempa[3] = getSBoxValue(tempa[3]);
-
- tempa[0] = tempa[0] ^ Rcon[i/m_nk];
- }
-
- if (m_level == AES_256 && i % m_nk == 4)
- {
- // Function Subword()
- tempa[0] = getSBoxValue(tempa[0]);
- tempa[1] = getSBoxValue(tempa[1]);
- tempa[2] = getSBoxValue(tempa[2]);
- tempa[3] = getSBoxValue(tempa[3]);
- }
- roundKey.insert(i * 4 + 0, (quint8) roundKey.at((i - m_nk) * 4 + 0) ^ tempa[0]);
- roundKey.insert(i * 4 + 1, (quint8) roundKey.at((i - m_nk) * 4 + 1) ^ tempa[1]);
- roundKey.insert(i * 4 + 2, (quint8) roundKey.at((i - m_nk) * 4 + 2) ^ tempa[2]);
- roundKey.insert(i * 4 + 3, (quint8) roundKey.at((i - m_nk) * 4 + 3) ^ tempa[3]);
- }
- return roundKey;
- }
-}
-
-// This function adds the round key to state.
-// The round key is added to the state by an XOR function.
-void QAESEncryption::addRoundKey(const quint8 round, const QByteArray &expKey)
-{
- QByteArray::iterator it = m_state->begin();
- for(int i=0; i < 16; ++i)
- it[i] = (quint8) it[i] ^ (quint8) expKey.at(round * m_nb * 4 + (i/4) * m_nb + (i%4));
-}
-
-// The SubBytes Function Substitutes the values in the
-// state matrix with values in an S-box.
-void QAESEncryption::subBytes()
-{
- QByteArray::iterator it = m_state->begin();
- for(int i = 0; i < 16; i++)
- it[i] = getSBoxValue((quint8) it[i]);
-}
-
-// The ShiftRows() function shifts the rows in the state to the left.
-// Each row is shifted with different offset.
-// Offset = Row number. So the first row is not shifted.
-void QAESEncryption::shiftRows()
-{
- QByteArray::iterator it = m_state->begin();
- quint8 temp;
- //Keep in mind that QByteArray is column-driven!!
-
- //Shift 1 to left
- temp = (quint8)it[1];
- it[1] = (quint8)it[5];
- it[5] = (quint8)it[9];
- it[9] = (quint8)it[13];
- it[13] = (quint8)temp;
-
- //Shift 2 to left
- temp = (quint8)it[2];
- it[2] = (quint8)it[10];
- it[10] = (quint8)temp;
- temp = (quint8)it[6];
- it[6] = (quint8)it[14];
- it[14] = (quint8)temp;
-
- //Shift 3 to left
- temp = (quint8)it[3];
- it[3] = (quint8)it[15];
- it[15] = (quint8)it[11];
- it[11] = (quint8)it[7];
- it[7] = (quint8)temp;
-}
-
-// MixColumns function mixes the columns of the state matrix
-//optimized!!
-void QAESEncryption::mixColumns()
-{
- QByteArray::iterator it = m_state->begin();
- quint8 tmp, tm, t;
-
- for(int i = 0; i < 16; i += 4){
- t = (quint8)it[i];
- tmp = (quint8)it[i] ^ (quint8)it[i+1] ^ (quint8)it[i+2] ^ (quint8)it[i+3] ;
-
- tm = xTime( (quint8)it[i] ^ (quint8)it[i+1] );
- it[i] = (quint8)it[i] ^ (quint8)tm ^ (quint8)tmp;
-
- tm = xTime( (quint8)it[i+1] ^ (quint8)it[i+2]);
- it[i+1] = (quint8)it[i+1] ^ (quint8)tm ^ (quint8)tmp;
-
- tm = xTime( (quint8)it[i+2] ^ (quint8)it[i+3]);
- it[i+2] =(quint8)it[i+2] ^ (quint8)tm ^ (quint8)tmp;
-
- tm = xTime((quint8)it[i+3] ^ (quint8)t);
- it[i+3] =(quint8)it[i+3] ^ (quint8)tm ^ (quint8)tmp;
- }
-}
-
-// MixColumns function mixes the columns of the state matrix.
-// The method used to multiply may be difficult to understand for the inexperienced.
-// Please use the references to gain more information.
-void QAESEncryption::invMixColumns()
-{
- QByteArray::iterator it = m_state->begin();
- quint8 a,b,c,d;
- for(int i = 0; i < 16; i+=4){
- a = (quint8) it[i];
- b = (quint8) it[i+1];
- c = (quint8) it[i+2];
- d = (quint8) it[i+3];
-
- it[i] = (quint8) (multiply(a, 0x0e) ^ multiply(b, 0x0b) ^ multiply(c, 0x0d) ^ multiply(d, 0x09));
- it[i+1] = (quint8) (multiply(a, 0x09) ^ multiply(b, 0x0e) ^ multiply(c, 0x0b) ^ multiply(d, 0x0d));
- it[i+2] = (quint8) (multiply(a, 0x0d) ^ multiply(b, 0x09) ^ multiply(c, 0x0e) ^ multiply(d, 0x0b));
- it[i+3] = (quint8) (multiply(a, 0x0b) ^ multiply(b, 0x0d) ^ multiply(c, 0x09) ^ multiply(d, 0x0e));
- }
-}
-
-// The SubBytes Function Substitutes the values in the
-// state matrix with values in an S-box.
-void QAESEncryption::invSubBytes()
-{
- QByteArray::iterator it = m_state->begin();
- for(int i = 0; i < 16; ++i)
- it[i] = getSBoxInvert((quint8) it[i]);
-}
-
-void QAESEncryption::invShiftRows()
-{
- QByteArray::iterator it = m_state->begin();
- uint8_t temp;
-
- //Keep in mind that QByteArray is column-driven!!
-
- //Shift 1 to right
- temp = (quint8)it[13];
- it[13] = (quint8)it[9];
- it[9] = (quint8)it[5];
- it[5] = (quint8)it[1];
- it[1] = (quint8)temp;
-
- //Shift 2
- temp = (quint8)it[10];
- it[10] = (quint8)it[2];
- it[2] = (quint8)temp;
- temp = (quint8)it[14];
- it[14] = (quint8)it[6];
- it[6] = (quint8)temp;
-
- //Shift 3
- temp = (quint8)it[7];
- it[7] = (quint8)it[11];
- it[11] = (quint8)it[15];
- it[15] = (quint8)it[3];
- it[3] = (quint8)temp;
-}
-
-QByteArray QAESEncryption::byteXor(const QByteArray &a, const QByteArray &b)
-{
- QByteArray::const_iterator it_a = a.begin();
- QByteArray::const_iterator it_b = b.begin();
- QByteArray ret;
-
- //for(int i = 0; i < m_blocklen; i++)
- for(int i = 0; i < std::min(a.size(), b.size()); i++)
- ret.insert(i,it_a[i] ^ it_b[i]);
-
- return ret;
-}
-
-// Cipher is the main function that encrypts the PlainText.
-QByteArray QAESEncryption::cipher(const QByteArray &expKey, const QByteArray &in)
-{
-
- //m_state is the input buffer...
- QByteArray output(in);
- m_state = &output;
-
- // Add the First round key to the state before starting the rounds.
- addRoundKey(0, expKey);
-
- // There will be Nr rounds.
- // The first Nr-1 rounds are identical.
- // These Nr-1 rounds are executed in the loop below.
- for(quint8 round = 1; round < m_nr; ++round){
- subBytes();
- shiftRows();
- mixColumns();
- addRoundKey(round, expKey);
- }
-
- // The last round is given below.
- // The MixColumns function is not here in the last round.
- subBytes();
- shiftRows();
- addRoundKey(m_nr, expKey);
-
- return output;
-}
-
-QByteArray QAESEncryption::invCipher(const QByteArray &expKey, const QByteArray &in)
-{
- //m_state is the input buffer.... handle it!
- QByteArray output(in);
- m_state = &output;
-
- // Add the First round key to the state before starting the rounds.
- addRoundKey(m_nr, expKey);
-
- // There will be Nr rounds.
- // The first Nr-1 rounds are identical.
- // These Nr-1 rounds are executed in the loop below.
- for(quint8 round=m_nr-1; round>0 ; round--){
- invShiftRows();
- invSubBytes();
- addRoundKey(round, expKey);
- invMixColumns();
- }
-
- // The last round is given below.
- // The MixColumns function is not here in the last round.
- invShiftRows();
- invSubBytes();
- addRoundKey(0, expKey);
-
- return output;
-}
-
-QByteArray QAESEncryption::printArray(uchar* arr, int size)
-{
- QByteArray print("");
- for(int i=0; i<size; i++)
- print.append(arr[i]);
-
- return print.toHex();
-}
-
-QByteArray QAESEncryption::encode(const QByteArray &rawText, const QByteArray &key, const QByteArray &iv)
-{
- if (m_mode >= CBC && (iv.isEmpty() || iv.size() != m_blocklen))
- return QByteArray();
-
- QByteArray expandedKey = expandKey(key);
- QByteArray alignedText(rawText);
-
- //Fill array with padding
- alignedText.append(getPadding(rawText.size(), m_blocklen));
-
- switch(m_mode)
- {
- case ECB: {
-#ifdef USE_INTEL_AES_IF_AVAILABLE
- if (m_aesNIAvailable){
- unsigned char in[alignedText.size()];
- memcpy(in, alignedText.data(), alignedText.size());
- unsigned char out[alignedText.size()];
- memcpy(out, alignedText.data(), alignedText.size());
- char expKey[expandedKey.size()];
- memcpy(expKey, expandedKey.data(), expandedKey.size());
- AES_ECB_encrypt(in, out, alignedText.size(),
- expKey, m_nr);
- return QByteArray((char*)out, alignedText.size());
- }
-#endif
- QByteArray ret;
- for(int i=0; i < alignedText.size(); i+= m_blocklen)
- ret.append(cipher(expandedKey, alignedText.mid(i, m_blocklen)));
- return ret;
- }
- break;
- case CBC: {
-#ifdef USE_INTEL_AES_IF_AVAILABLE
- if (m_aesNIAvailable){
- quint8 in[alignedText.size()];
- memcpy(in, alignedText.constData(), alignedText.size());
- quint8 ivec[iv.size()];
- memcpy(ivec, iv.data(), iv.size());
- char out[alignedText.size()];
- memset(out, 0x00, alignedText.size());
- char expKey[expandedKey.size()];
- memcpy(expKey, expandedKey.data(), expandedKey.size());
- AES_CBC_encrypt(in,
- (unsigned char*) out,
- ivec,
- alignedText.size(),
- expKey,
- m_nr);
- return QByteArray(out, alignedText.size());
- }
-#endif
- QByteArray ret;
- QByteArray ivTemp(iv);
- for(int i=0; i < alignedText.size(); i+= m_blocklen) {
- alignedText.replace(i, m_blocklen, byteXor(alignedText.mid(i, m_blocklen),ivTemp));
- ret.append(cipher(expandedKey, alignedText.mid(i, m_blocklen)));
- ivTemp = ret.mid(i, m_blocklen);
- }
- return ret;
- }
- break;
- case CFB: {
- QByteArray ret;
- ret.append(byteXor(alignedText.left(m_blocklen), cipher(expandedKey, iv)));
- for(int i=0; i < alignedText.size(); i+= m_blocklen) {
- if (i+m_blocklen < alignedText.size())
- ret.append(byteXor(alignedText.mid(i+m_blocklen, m_blocklen),
- cipher(expandedKey, ret.mid(i, m_blocklen))));
- }
- return ret;
- }
- break;
- case OFB: {
- QByteArray ret;
- QByteArray ofbTemp;
- ofbTemp.append(cipher(expandedKey, iv));
- for (int i=m_blocklen; i < alignedText.size(); i += m_blocklen){
- ofbTemp.append(cipher(expandedKey, ofbTemp.right(m_blocklen)));
- }
- ret.append(byteXor(alignedText, ofbTemp));
- return ret;
- }
- break;
- default: break;
- }
- return QByteArray();
-}
-
-QByteArray QAESEncryption::decode(const QByteArray &rawText, const QByteArray &key, const QByteArray &iv)
-{
- if (m_mode >= CBC && (iv.isEmpty() || iv.size() != m_blocklen))
- return QByteArray();
-
- QByteArray ret;
- QByteArray expandedKey = expandKey(key);
-
- switch(m_mode)
- {
- case ECB:
- for(int i=0; i < rawText.size(); i+= m_blocklen)
- ret.append(invCipher(expandedKey, rawText.mid(i, m_blocklen)));
- break;
- case CBC: {
- QByteArray ivTemp(iv);
- for(int i=0; i < rawText.size(); i+= m_blocklen){
- ret.append(invCipher(expandedKey, rawText.mid(i, m_blocklen)));
- ret.replace(i, m_blocklen, byteXor(ret.mid(i, m_blocklen),ivTemp));
- ivTemp = rawText.mid(i, m_blocklen);
- }
- }
- break;
- case CFB: {
- ret.append(byteXor(rawText.mid(0, m_blocklen), cipher(expandedKey, iv)));
- for(int i=0; i < rawText.size(); i+= m_blocklen){
- if (i+m_blocklen < rawText.size()) {
- ret.append(byteXor(rawText.mid(i+m_blocklen, m_blocklen),
- cipher(expandedKey, rawText.mid(i, m_blocklen))));
- }
- }
- }
- break;
- case OFB: {
- QByteArray ofbTemp;
- ofbTemp.append(cipher(expandedKey, iv));
- for (int i=m_blocklen; i < rawText.size(); i += m_blocklen){
- ofbTemp.append(cipher(expandedKey, ofbTemp.right(m_blocklen)));
- }
- ret.append(byteXor(rawText, ofbTemp));
- }
- break;
- default:
- //do nothing
- break;
- }
- return ret;
-}
-
-QByteArray QAESEncryption::removePadding(const QByteArray &rawText)
-{
- return RemovePadding(rawText, (Padding) m_padding);
-}
diff --git a/src/ui/aes/qaesencryption.h b/src/ui/aes/qaesencryption.h
deleted file mode 100644
index ec8023b3..00000000
--- a/src/ui/aes/qaesencryption.h
+++ /dev/null
@@ -1,165 +0,0 @@
-#ifndef QAESENCRYPTION_H
-#define QAESENCRYPTION_H
-
-#ifdef QtAES_EXPORTS
-#include "qtaes_export.h"
-#else
-#define QTAESSHARED_EXPORT
-#endif
-
-#include <QByteArray>
-#include <QObject>
-
-#ifdef __linux__
-#ifndef __LP64__
-#define do_rdtsc _do_rdtsc
-#endif
-#endif
-
-class QTAESSHARED_EXPORT QAESEncryption : public QObject {
- Q_OBJECT
- public:
- enum Aes { AES_128, AES_192, AES_256 };
-
- enum Mode { ECB, CBC, CFB, OFB };
-
- enum Padding { ZERO, PKCS7, ISO };
-
- static QByteArray Crypt(
- QAESEncryption::Aes level, QAESEncryption::Mode mode,
- const QByteArray &rawText, const QByteArray &key,
- const QByteArray &iv = QByteArray(),
- QAESEncryption::Padding padding = QAESEncryption::ISO);
- static QByteArray Decrypt(
- QAESEncryption::Aes level, QAESEncryption::Mode mode,
- const QByteArray &rawText, const QByteArray &key,
- const QByteArray &iv = QByteArray(),
- QAESEncryption::Padding padding = QAESEncryption::ISO);
- static QByteArray ExpandKey(QAESEncryption::Aes level,
- QAESEncryption::Mode mode, const QByteArray &key);
- static QByteArray RemovePadding(
- const QByteArray &rawText,
- QAESEncryption::Padding padding = QAESEncryption::ISO);
-
- QAESEncryption(QAESEncryption::Aes level, QAESEncryption::Mode mode,
- QAESEncryption::Padding padding = QAESEncryption::ISO);
-
- QByteArray encode(const QByteArray &rawText, const QByteArray &key,
- const QByteArray &iv = QByteArray());
- QByteArray decode(const QByteArray &rawText, const QByteArray &key,
- const QByteArray &iv = QByteArray());
- QByteArray removePadding(const QByteArray &rawText);
- QByteArray expandKey(const QByteArray &key);
-
- QByteArray printArray(uchar *arr, int size);
- Q_SIGNALS:
-
- public Q_SLOTS:
-
- private:
- int m_nb;
- int m_blocklen;
- int m_level;
- int m_mode;
- int m_nk;
- int m_keyLen;
- quint8 m_nr;
- int m_expandedKey;
- int m_padding;
- bool m_aesNIAvailable;
- QByteArray *m_state;
-
- struct AES256 {
- int nk = 8;
- int keylen = 32;
- int nr = 14;
- int expandedKey = 240;
- };
-
- struct AES192 {
- int nk = 6;
- int keylen = 24;
- int nr = 12;
- int expandedKey = 209;
- };
-
- struct AES128 {
- int nk = 4;
- int keylen = 16;
- int nr = 10;
- int expandedKey = 176;
- };
-
- quint8 getSBoxValue(quint8 num) { return sbox[num]; }
- quint8 getSBoxInvert(quint8 num) { return rsbox[num]; }
-
- void addRoundKey(const quint8 round, const QByteArray &expKey);
- void subBytes();
- void shiftRows();
- void mixColumns();
- void invMixColumns();
- void invSubBytes();
- void invShiftRows();
- QByteArray getPadding(int currSize, int alignment);
- QByteArray cipher(const QByteArray &expKey, const QByteArray &in);
- QByteArray invCipher(const QByteArray &expKey, const QByteArray &in);
- QByteArray byteXor(const QByteArray &a, const QByteArray &b);
-
- const quint8 sbox[256] = {
- // 0 1 2 3 4 5 6 7 8 9 A B C
- // D E F
- 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
- 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
- 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26,
- 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
- 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2,
- 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
- 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed,
- 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
- 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f,
- 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
- 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec,
- 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
- 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14,
- 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
- 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d,
- 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
- 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f,
- 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
- 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11,
- 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
- 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f,
- 0xb0, 0x54, 0xbb, 0x16};
-
- const quint8 rsbox[256] = {
- 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
- 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
- 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32,
- 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
- 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49,
- 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16,
- 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50,
- 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
- 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05,
- 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02,
- 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41,
- 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
- 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8,
- 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89,
- 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b,
- 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
- 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59,
- 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d,
- 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d,
- 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
- 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63,
- 0x55, 0x21, 0x0c, 0x7d};
-
- // The round constant word array, Rcon[i], contains the values given by
- // x to th e power (i-1) being powers of x (x is denoted as {02}) in the field
- // GF(2^8) Only the first 14 elements are needed
- const quint8 Rcon[14] = {0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
- 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab};
-};
-
-#endif // QAESENCRYPTION_H
diff --git a/src/ui/settings/GlobalSettingStation.cpp b/src/ui/settings/GlobalSettingStation.cpp
index 73090ec7..e1e5f6f4 100644
--- a/src/ui/settings/GlobalSettingStation.cpp
+++ b/src/ui/settings/GlobalSettingStation.cpp
@@ -30,8 +30,6 @@
#include <vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp>
#include <vmime/vmime.hpp>
-#include "ui/aes/qaesencryption.h"
-
std::unique_ptr<GpgFrontend::UI::GlobalSettingStation>
GpgFrontend::UI::GlobalSettingStation::_instance = nullptr;
diff --git a/src/ui/settings/GlobalSettingStation.h b/src/ui/settings/GlobalSettingStation.h
index 420b5c99..457a5a2f 100644
--- a/src/ui/settings/GlobalSettingStation.h
+++ b/src/ui/settings/GlobalSettingStation.h
@@ -27,9 +27,9 @@
#include <openssl/x509.h>
+#include <nlohmann/json.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
-#include <json/json.hpp>
#include "GpgFrontendBuildInstallInfo.h"
#include "ui/GpgFrontendUI.h"
diff --git a/src/ui/settings/SettingsSendMail.cpp b/src/ui/settings/SettingsSendMail.cpp
index 5408b535..728cfc66 100644
--- a/src/ui/settings/SettingsSendMail.cpp
+++ b/src/ui/settings/SettingsSendMail.cpp
@@ -24,10 +24,6 @@
#include "SettingsSendMail.h"
-#ifdef SMTP_SUPPORT
-#include "smtp/SmtpMime"
-#endif
-
#include "ui/data_struct/SettingsObject.h"
#include "ui/thread/SMTPSendMailThread.h"
#include "ui/thread/SMTPTestThread.h"
diff --git a/src/ui/settings/SettingsSendMail.h b/src/ui/settings/SettingsSendMail.h
index c866fa5f..75b03c77 100644
--- a/src/ui/settings/SettingsSendMail.h
+++ b/src/ui/settings/SettingsSendMail.h
@@ -25,7 +25,6 @@
#ifndef GPGFRONTEND_SETTINGSSENDMAIL_H
#define GPGFRONTEND_SETTINGSSENDMAIL_H
-#include "smtp/SmtpMime"
#include "ui/GpgFrontendUI.h"
class Ui_SendMailSettings;
diff --git a/src/ui/smtp/SendMailDialog.cpp b/src/ui/smtp/SendMailDialog.cpp
index bb21ca3f..badbed57 100644
--- a/src/ui/smtp/SendMailDialog.cpp
+++ b/src/ui/smtp/SendMailDialog.cpp
@@ -31,9 +31,8 @@
#include "ui_SendMailDialog.h"
#ifdef SMTP_SUPPORT
-#include "smtp/SmtpMime"
-#include "ui/thread/SMTPSendMailThread.h"
#include "ui/settings/GlobalSettingStation.h"
+#include "ui/thread/SMTPSendMailThread.h"
#endif
namespace GpgFrontend::UI {
diff --git a/src/ui/thread/SMTPSendMailThread.h b/src/ui/thread/SMTPSendMailThread.h
index e5c9e27f..3d723670 100644
--- a/src/ui/thread/SMTPSendMailThread.h
+++ b/src/ui/thread/SMTPSendMailThread.h
@@ -27,10 +27,6 @@
#include <utility>
-#ifdef SMTP_SUPPORT
-#include "smtp/SmtpMime"
-#endif
-
#include "ui/GpgFrontendUI.h"
namespace GpgFrontend::UI {
diff --git a/src/ui/thread/SMTPTestThread.h b/src/ui/thread/SMTPTestThread.h
index db61d97d..c51ac3fd 100644
--- a/src/ui/thread/SMTPTestThread.h
+++ b/src/ui/thread/SMTPTestThread.h
@@ -27,11 +27,8 @@
#include <utility>
-#ifdef SMTP_SUPPORT
-#include "smtp/SmtpMime"
-#endif
-
#include "ui/GpgFrontendUI.h"
+
namespace GpgFrontend::UI {
class SMTPTestThread : public QThread {
diff --git a/src/ui/thread/VersionCheckThread.cpp b/src/ui/thread/VersionCheckThread.cpp
index 2a1cf9af..8b2487d8 100644
--- a/src/ui/thread/VersionCheckThread.cpp
+++ b/src/ui/thread/VersionCheckThread.cpp
@@ -25,9 +25,9 @@
#include "VersionCheckThread.h"
#include <QMetaType>
+#include <nlohmann/json.hpp>
#include "GpgFrontendBuildInfo.h"
-#include "json/json.hpp"
namespace GpgFrontend::UI {
diff --git a/src/ui/widgets/ExportKeyPackageDialog.cpp b/src/ui/widgets/ExportKeyPackageDialog.cpp
index d99e966a..b82ceb32 100644
--- a/src/ui/widgets/ExportKeyPackageDialog.cpp
+++ b/src/ui/widgets/ExportKeyPackageDialog.cpp
@@ -28,7 +28,6 @@
#include "gpg/function/GpgKeyGetter.h"
#include "gpg/function/GpgKeyImportExporter.h"
-#include "ui/aes/qaesencryption.h"
#include "ui_ExportKeyPackageDialog.h"
GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(