diff options
Diffstat (limited to 'include/gpg')
-rw-r--r-- | include/gpg/GpgConstants.h | 43 | ||||
-rw-r--r-- | include/gpg/GpgContext.h | 227 | ||||
-rw-r--r-- | include/gpg/GpgFileOpera.h | 51 | ||||
-rw-r--r-- | include/gpg/GpgGenKeyInfo.h | 199 | ||||
-rw-r--r-- | include/gpg/GpgInfo.h | 43 | ||||
-rw-r--r-- | include/gpg/GpgKey.h | 87 | ||||
-rw-r--r-- | include/gpg/GpgKeySignature.h | 67 | ||||
-rw-r--r-- | include/gpg/GpgSubKey.h | 64 | ||||
-rw-r--r-- | include/gpg/GpgUID.h | 60 | ||||
-rw-r--r-- | include/gpg/result_analyse/DecryptResultAnalyse.h | 44 | ||||
-rw-r--r-- | include/gpg/result_analyse/EncryptResultAnalyse.h | 38 | ||||
-rw-r--r-- | include/gpg/result_analyse/ResultAnalyse.h | 48 | ||||
-rw-r--r-- | include/gpg/result_analyse/SignResultAnalyse.h | 44 | ||||
-rw-r--r-- | include/gpg/result_analyse/VerifyResultAnalyse.h | 47 |
14 files changed, 0 insertions, 1062 deletions
diff --git a/include/gpg/GpgConstants.h b/include/gpg/GpgConstants.h deleted file mode 100644 index 61037170..00000000 --- a/include/gpg/GpgConstants.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPG_CONSTANTS_H -#define GPG_CONSTANTS_H - -class QString; - -const int RESTART_CODE = 1000; - -class GpgConstants { -public: - static const char *PGP_CRYPT_BEGIN; - static const char *PGP_CRYPT_END; - static const char *PGP_SIGNED_BEGIN; - static const char *PGP_SIGNED_END; - static const char *PGP_SIGNATURE_BEGIN; - static const char *PGP_SIGNATURE_END; - static const char *GPG_FRONTEND_SHORT_CRYPTO_HEAD; -}; - -#endif // CONSTANTS_H diff --git a/include/gpg/GpgContext.h b/include/gpg/GpgContext.h deleted file mode 100644 index 75949f25..00000000 --- a/include/gpg/GpgContext.h +++ /dev/null @@ -1,227 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef __SGPGMEPP_CONTEXT_H__ -#define __SGPGMEPP_CONTEXT_H__ - -#include "GpgFrontend.h" - -#include "GpgConstants.h" -#include "GpgGenKeyInfo.h" -#include "GpgKey.h" -#include "GpgInfo.h" - -using GpgKeyList = std::list<GpgKey>; - -class GpgImportedKey { -public: - QString fpr; - int importStatus; -}; - -typedef std::list<GpgImportedKey> GpgImportedKeyList; - -class GpgImportInformation { -public: - GpgImportInformation() = default; - - int considered = 0; - int no_user_id = 0; - int imported = 0; - int imported_rsa = 0; - int unchanged = 0; - int new_user_ids = 0; - int new_sub_keys = 0; - int new_signatures = 0; - int new_revocations = 0; - int secret_read = 0; - int secret_imported = 0; - int secret_unchanged = 0; - int not_imported = 0; - GpgImportedKeyList importedKeys; -}; - -namespace GpgME { - - /** - * Custom Encapsulation of GpgME APIs - */ - class GpgContext : public QObject { - Q_OBJECT - - public: - - GpgContext(); - - ~GpgContext() override; - - [[nodiscard]] bool isGood() const; - - GpgImportInformation importKey(QByteArray inBuffer); - - [[nodiscard]] const GpgKeyList &getKeys() const; - - bool exportKeys(QStringList *uidList, QByteArray *outBuffer); - - bool exportKeys(const QVector<GpgKey> &keys, QByteArray &outBuffer); - - gpgme_error_t generateKey(GenKeyInfo *params); - - gpgme_error_t generateSubkey(const GpgKey &key, GenKeyInfo *params); - - void deleteKeys(QStringList *uidList); - - gpg_error_t encrypt(QVector<GpgKey> &keys, const QByteArray &inBuffer, QByteArray *outBuffer, - gpgme_encrypt_result_t *result); - - gpgme_error_t encryptSign(QVector<GpgKey> &keys, QVector<GpgKey> &signers, const QByteArray &inBuffer, - QByteArray *outBuffer, gpgme_encrypt_result_t *encr_result, - gpgme_sign_result_t *sign_result); - - gpgme_error_t decrypt(const QByteArray &inBuffer, QByteArray *outBuffer, gpgme_decrypt_result_t *result); - - gpgme_error_t - decryptVerify(const QByteArray &inBuffer, QByteArray *outBuffer, gpgme_decrypt_result_t *decrypt_result, - gpgme_verify_result_t *verify_result); - - void clearPasswordCache(); - - bool exportSecretKey(const GpgKey &key, QByteArray *outBuffer); - - void getSigners(QVector<GpgKey> &signer, gpgme_ctx_t ctx); - - static void setSigners(const QVector<GpgKey> &keys, gpgme_ctx_t ctx); - - bool signKey(const GpgKey &target, const QVector<GpgKey> &keys, const QString &uid, - const QDateTime *expires); - - bool revSign(const GpgKey &key, const GpgKeySignature &signature); - - gpgme_error_t verify(QByteArray *inBuffer, QByteArray *sigBuffer, gpgme_verify_result_t *result); - - gpg_error_t - sign(const QVector<GpgKey> &keys, const QByteArray &inBuffer, QByteArray *outBuffer, - gpgme_sig_mode_t mode, gpgme_sign_result_t *result = nullptr, bool default_ctx = true); - - bool addUID(const GpgKey &key, const GpgUID &uid); - - bool revUID(const GpgKey &key, const GpgUID &uid); - - bool setPrimaryUID(const GpgKey &key, const GpgUID &uid); - - bool setExpire(const GpgKey &key, const GpgSubKey *subkey, QDateTime *expires); - - void generateRevokeCert(const GpgKey &key, const QString &outputFileName); - - static bool checkIfKeyCanSign(const GpgKey &key); - - static bool checkIfKeyCanCert(const GpgKey &key); - - static bool checkIfKeyCanAuth(const GpgKey &key); - - static bool checkIfKeyCanEncr(const GpgKey &key); - - - /** - * @details If text contains PGP-message, put a linebreak before the message, - * so that gpgme can decrypt correctly - * - * @param in Pointer to the QBytearray to check. - */ - static void preventNoDataErr(QByteArray *in); - - GpgKey getKeyByFpr(const QString &fpr); - - GpgKey getKeyById(const QString &id); - - static QString gpgErrString(gpgme_error_t err); - - static QString getGpgmeVersion(); - - /** - * @brief - * - * @param text - * @return \li 2, if the text is completly signed, - * \li 1, if the text is partially signed, - * \li 0, if the text is not signed at all. - */ - static int textIsSigned(const QByteArray &text); - - static QString beautifyFingerprint(QString fingerprint); - - signals: - - void signalKeyDBChanged(); - - void signalKeyUpdated(QString key_id); - - void signalKeyInfoChanged(); - - private slots: - - void slotRefreshKeyList(); - - void slotUpdateKeyList(const QString &key_id); - - private: - - GpgInfo info; - - gpgme_ctx_t mCtx{}; - gpgme_data_t in{}; - gpgme_error_t err; - bool debug; - bool good = true; - - QByteArray mPasswordCache; - QSettings settings; - GpgKeyList mKeyList; - - QMap<QString, GpgKey *> mKeyMap; - - gpgme_ctx_t create_ctx(); - - static gpgme_error_t readToBuffer(gpgme_data_t dataIn, QByteArray *outBuffer); - - void fetch_keys(); - - static void checkErr(gpgme_error_t gpgmeError); - - static void checkErr(gpgme_error_t gpgmeError, const QString &comment); - - static gpgme_error_t passphraseCb(void *hook, const char *uid_hint, - const char *passphrase_info, - int last_was_bad, int fd); - - gpgme_error_t passphrase(const char *uid_hint, - const char *passphrase_info, - int last_was_bad, int fd); - - void executeGpgCommand(const QStringList &arguments, const std::function<void(QProcess *)> &interactFunc); - - }; -} // namespace GpgME - -#endif // __SGPGMEPP_CONTEXT_H__ diff --git a/include/gpg/GpgFileOpera.h b/include/gpg/GpgFileOpera.h deleted file mode 100644 index 9b5e118c..00000000 --- a/include/gpg/GpgFileOpera.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_GPGFILEOPERA_H -#define GPGFRONTEND_GPGFILEOPERA_H - -#include "GpgFrontend.h" -#include "gpg/GpgContext.h" - -class GpgFileOpera { -public: - static gpgme_error_t encryptFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath, - gpgme_encrypt_result_t *result); - - static gpgme_error_t decryptFile(GpgME::GpgContext *ctx, const QString &mPath, gpgme_decrypt_result_t *result); - - static gpgme_error_t signFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath, - gpgme_sign_result_t *result); - - static gpgme_error_t verifyFile(GpgME::GpgContext *ctx, const QString &mPath, gpgme_verify_result_t *result); - - static gpg_error_t - encryptSignFile(GpgME::GpgContext *ctx, QVector<GpgKey> &keys, const QString &mPath, gpgme_encrypt_result_t *encr_res, gpgme_sign_result_t *sign_res); - - static gpg_error_t decryptVerifyFile(GpgME::GpgContext *ctx, const QString &mPath, gpgme_decrypt_result_t *decr_res, gpgme_verify_result_t *verify_res); - -}; - - -#endif //GPGFRONTEND_GPGFILEOPERA_H diff --git a/include/gpg/GpgGenKeyInfo.h b/include/gpg/GpgGenKeyInfo.h deleted file mode 100644 index a5936207..00000000 --- a/include/gpg/GpgGenKeyInfo.h +++ /dev/null @@ -1,199 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPG4USB_GPGGENKEYINFO_H -#define GPG4USB_GPGGENKEYINFO_H - -#include "GpgFrontend.h" - -class GenKeyInfo { - - bool subKey = true; - QString userid; - QString algo; - int keySize = 2048; - QDateTime expired = QDateTime::currentDateTime().addYears(2); - bool nonExpired = false; - - bool noPassPhrase = false; - bool allowNoPassPhrase = true; - - int suggestMaxKeySize = 1024; - int suggestSizeAdditionStep = 1024; - int suggestMinKeySize = 4096; - - QString passPhrase; - -public: - - static const QVector<QString> SupportedKeyAlgo; - - static const QVector<QString> SupportedSubkeyAlgo; - - [[nodiscard]] bool isSubKey() const { - return subKey; - } - - void setIsSubKey(bool m_sub_key) { - GenKeyInfo::subKey = m_sub_key; - } - - [[nodiscard]] const QString &getUserid() const { - return userid; - } - - void setUserid(const QString &m_userid) { - GenKeyInfo::userid = m_userid; - } - - [[nodiscard]] const QString &getAlgo() const { - return algo; - } - - void setAlgo(const QString &m_algo); - - [[nodiscard]] QString getKeySizeStr() const; - - [[nodiscard]] int getKeySize() const { - return keySize; - - } - - void setKeySize(int m_key_size); - - [[nodiscard]] const QDateTime &getExpired() const { - return expired; - } - - void setExpired(const QDateTime &m_expired); - - [[nodiscard]] bool isNonExpired() const { - return nonExpired; - } - - void setNonExpired(bool m_non_expired); - - [[nodiscard]] bool isNoPassPhrase() const { - return this->noPassPhrase; - } - - void setNonPassPhrase(bool m_non_pass_phrase) { - GenKeyInfo::noPassPhrase = m_non_pass_phrase; - } - - [[nodiscard]] bool isAllowSigning() const { - return allowSigning; - } - - [[nodiscard]] bool isAllowNoPassPhrase() const { - return allowNoPassPhrase; - } - - void setAllowSigning(bool m_allow_signing) { - if(allowChangeSigning) - GenKeyInfo::allowSigning = m_allow_signing; - } - - [[nodiscard]] bool isAllowEncryption() const { - return allowEncryption; - } - - void setAllowEncryption(bool m_allow_encryption); - - [[nodiscard]] bool isAllowCertification() const { - return allowCertification; - } - - void setAllowCertification(bool m_allow_certification); - - [[nodiscard]] bool isAllowAuthentication() const { - return allowAuthentication; - } - - void setAllowAuthentication(bool m_allow_authentication) { - if(allowChangeAuthentication) - GenKeyInfo::allowAuthentication = m_allow_authentication; - } - - [[nodiscard]] const QString &getPassPhrase() const { - return passPhrase; - } - - void setPassPhrase(const QString &m_pass_phrase) { - GenKeyInfo::passPhrase = m_pass_phrase; - } - - [[nodiscard]] bool isAllowChangeSigning() const { - return allowChangeSigning; - } - [[nodiscard]] bool isAllowChangeEncryption() const { - return allowChangeEncryption; - } - - [[nodiscard]] bool isAllowChangeCertification() const { - return allowChangeCertification; - } - - [[nodiscard]] bool isAllowChangeAuthentication() const { - return allowChangeAuthentication; - } - - [[nodiscard]] int getSuggestMaxKeySize() const { - return suggestMaxKeySize; - } - - [[nodiscard]] int getSuggestMinKeySize() const { - return suggestMinKeySize; - } - - [[nodiscard]] int getSizeChangeStep() const { - return suggestSizeAdditionStep; - } - - -private: - bool allowEncryption = true; - bool allowChangeEncryption = true; - - bool allowCertification = true; - bool allowChangeCertification = true; - - bool allowAuthentication = true; - bool allowChangeAuthentication = true; - - bool allowSigning = true; - bool allowChangeSigning = true; - - void reset_options(); - -public: - - explicit GenKeyInfo(bool m_is_sub_key = false) : subKey(m_is_sub_key) { - setAlgo("rsa"); - } - - -}; - -#endif //GPG4USB_GPGGENKEYINFO_H diff --git a/include/gpg/GpgInfo.h b/include/gpg/GpgInfo.h deleted file mode 100644 index 914491dd..00000000 --- a/include/gpg/GpgInfo.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * -*/ - -#ifndef GPGFRONTEND_ZH_CN_TS_GPGINFO_H -#define GPGFRONTEND_ZH_CN_TS_GPGINFO_H - -#include "GpgFrontend.h" - -/** - * Use to record some info about gnupg - */ -class GpgInfo { -public: - - /** - * executable binary path of gnupg - */ - QString appPath; -}; - - -#endif //GPGFRONTEND_ZH_CN_TS_GPGINFO_H diff --git a/include/gpg/GpgKey.h b/include/gpg/GpgKey.h deleted file mode 100644 index 9bf33111..00000000 --- a/include/gpg/GpgKey.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_GPGKEY_H -#define GPGFRONTEND_GPGKEY_H - -#include "GpgUID.h" -#include "GpgSubKey.h" - -class GpgKey { -public: - - QString id; - QString name; - QString email; - QString comment; - QString fpr; - QString protocol; - QString owner_trust; - QString pubkey_algo; - QDateTime last_update; - QDateTime expires; - QDateTime create_time; - - unsigned int length{}; - - bool can_encrypt{}; - bool can_sign{}; - bool can_certify{}; - bool can_authenticate{}; - - - bool is_private_key{}; - bool expired{}; - bool revoked{}; - bool disabled{}; - - bool has_master_key{}; - - bool good = false; - - QVector<GpgSubKey> subKeys; - - QVector<GpgUID> uids; - - gpgme_key_t key_refer = nullptr; - - explicit GpgKey(gpgme_key_t key = nullptr); - - GpgKey(const GpgKey &k); - - GpgKey(GpgKey &&k) noexcept; - - GpgKey& operator=(const GpgKey &k); - - GpgKey& operator=(GpgKey &&k) noexcept; - - ~GpgKey(); - - void parse(gpgme_key_t key); - - void swapKeyRefer(gpgme_key_t key); -}; - - -#endif //GPGFRONTEND_GPGKEY_H diff --git a/include/gpg/GpgKeySignature.h b/include/gpg/GpgKeySignature.h deleted file mode 100644 index 0dd2f893..00000000 --- a/include/gpg/GpgKeySignature.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_GPGKEYSIGNATURE_H -#define GPGFRONTEND_GPGKEYSIGNATURE_H - -#include "GpgFrontend.h" - -struct GpgKeySignature { - - bool revoked{}; - bool expired{}; - bool invalid{}; - bool exportable{}; - - gpgme_error_t status{}; - - QString keyid; - QString pubkey_algo; - - QDateTime create_time; - QDateTime expire_time; - - QString uid; - QString name; - QString email; - QString comment; - - gpgme_sigsum_t summary; - - GpgKeySignature() = default; - - explicit GpgKeySignature(gpgme_key_sig_t key_sig); - - GpgKeySignature(GpgKeySignature &&) noexcept = default; - - GpgKeySignature(const GpgKeySignature &) = default; - - GpgKeySignature &operator=(GpgKeySignature &&) noexcept = default; - - GpgKeySignature &operator=(const GpgKeySignature &) = default; - -}; - - -#endif //GPGFRONTEND_GPGKEYSIGNATURE_H diff --git a/include/gpg/GpgSubKey.h b/include/gpg/GpgSubKey.h deleted file mode 100644 index f2da9e9e..00000000 --- a/include/gpg/GpgSubKey.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ -#ifndef GPGFRONTEND_GPGSUBKEY_H -#define GPGFRONTEND_GPGSUBKEY_H - -#include "GpgFrontend.h" - -struct GpgSubKey { - - QString id; - QString fpr; - - QString pubkey_algo; - - unsigned int length; - - bool can_encrypt{}; - bool can_sign{}; - bool can_certify{}; - bool can_authenticate{}; - - - bool is_private_key{}; - bool expired{}; - bool revoked{}; - bool disabled{}; - bool secret{}; - bool is_cardkey{}; - - QDateTime timestamp; - QDateTime expires; - - explicit GpgSubKey(gpgme_subkey_t key = nullptr); - - GpgSubKey(GpgSubKey &&) noexcept = default; - GpgSubKey(const GpgSubKey &) = default; - GpgSubKey& operator=(GpgSubKey &&) noexcept = default; - GpgSubKey& operator=(const GpgSubKey &) = default; - -}; - - -#endif //GPGFRONTEND_GPGSUBKEY_H diff --git a/include/gpg/GpgUID.h b/include/gpg/GpgUID.h deleted file mode 100644 index 6fb09446..00000000 --- a/include/gpg/GpgUID.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_GPGUID_H -#define GPGFRONTEND_GPGUID_H - -#include <utility> - -#include "GpgFrontend.h" -#include "GpgKeySignature.h" - -struct GpgUID { - - QString name{}; - - QString email{}; - - QString comment{}; - - QString uid{}; - - bool revoked{}; - - bool invalid{}; - - QVector<GpgKeySignature> signatures; - - GpgUID() = default; - - explicit GpgUID(gpgme_user_id_t user_id); - - GpgUID(GpgUID &&) noexcept = default; - GpgUID(const GpgUID &) = default; - GpgUID& operator=(GpgUID &&) noexcept = default; - GpgUID& operator=(const GpgUID &) = default; - -}; - -#endif //GPGFRONTEND_GPGUID_H
\ No newline at end of file diff --git a/include/gpg/result_analyse/DecryptResultAnalyse.h b/include/gpg/result_analyse/DecryptResultAnalyse.h deleted file mode 100644 index b1d0c7b4..00000000 --- a/include/gpg/result_analyse/DecryptResultAnalyse.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_DECRYPTRESULTANALYSE_H -#define GPGFRONTEND_DECRYPTRESULTANALYSE_H - -#include "gpg/GpgContext.h" -#include "ResultAnalyse.h" - -class DecryptResultAnalyse : public ResultAnalyse { -Q_OBJECT -public: - explicit DecryptResultAnalyse(GpgME::GpgContext *ctx, gpgme_error_t error, gpgme_decrypt_result_t result); - -private: - - GpgME::GpgContext *mCtx; - - bool printReci(QTextStream &stream, gpgme_recipient_t reci); -}; - - -#endif //GPGFRONTEND_DECRYPTRESULTANALYSE_H diff --git a/include/gpg/result_analyse/EncryptResultAnalyse.h b/include/gpg/result_analyse/EncryptResultAnalyse.h deleted file mode 100644 index 447555c5..00000000 --- a/include/gpg/result_analyse/EncryptResultAnalyse.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_ENCRYPTRESULTANALYSE_H -#define GPGFRONTEND_ENCRYPTRESULTANALYSE_H - -#include "ResultAnalyse.h" - -class EncryptResultAnalyse : public ResultAnalyse { -Q_OBJECT -public: - explicit EncryptResultAnalyse(gpgme_error_t error, gpgme_encrypt_result_t result); - -}; - - -#endif //GPGFRONTEND_ENCRYPTRESULTANALYSE_H diff --git a/include/gpg/result_analyse/ResultAnalyse.h b/include/gpg/result_analyse/ResultAnalyse.h deleted file mode 100644 index da2e5676..00000000 --- a/include/gpg/result_analyse/ResultAnalyse.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ -#ifndef GPGFRONTEND_RESULTANALYSE_H -#define GPGFRONTEND_RESULTANALYSE_H - -#include "GpgFrontend.h" - -class ResultAnalyse : public QObject { -Q_OBJECT -public: - ResultAnalyse() = default; - - [[nodiscard]] const QString &getResultReport() const; - - [[nodiscard]] int getStatus() const; - -protected: - QString resultText; - QTextStream stream{&resultText}; - - int status = 1; - - void setStatus(int mStatus); -}; - - -#endif //GPGFRONTEND_RESULTANALYSE_H diff --git a/include/gpg/result_analyse/SignResultAnalyse.h b/include/gpg/result_analyse/SignResultAnalyse.h deleted file mode 100644 index ebb15dfb..00000000 --- a/include/gpg/result_analyse/SignResultAnalyse.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_SIGNRESULTANALYSE_H -#define GPGFRONTEND_SIGNRESULTANALYSE_H - -#include "GpgFrontend.h" - -#include "ResultAnalyse.h" -#include "gpg/GpgContext.h" - -class SignResultAnalyse : public ResultAnalyse { -Q_OBJECT -public: - - explicit SignResultAnalyse(GpgME::GpgContext *ctx, gpgme_error_t error, gpgme_sign_result_t result); - - -private: - -}; - -#endif //GPGFRONTEND_SIGNRESULTANALYSE_H diff --git a/include/gpg/result_analyse/VerifyResultAnalyse.h b/include/gpg/result_analyse/VerifyResultAnalyse.h deleted file mode 100644 index c009741a..00000000 --- a/include/gpg/result_analyse/VerifyResultAnalyse.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This file is part of GPGFrontend. - * - * GPGFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from gpg4usb-team. - * Their source code version also complies with GNU General Public License. - * - * The source code version of this software was modified and released - * by Saturneric<[email protected]> starting on May 12, 2021. - * - */ - -#ifndef GPGFRONTEND_VERIFYRESULTANALYSE_H -#define GPGFRONTEND_VERIFYRESULTANALYSE_H - -#include "gpg/GpgContext.h" -#include "gpg/GpgKeySignature.h" - -#include "ResultAnalyse.h" - -class VerifyResultAnalyse : public ResultAnalyse{ -public: - - explicit VerifyResultAnalyse(GpgME::GpgContext *ctx, gpgme_error_t error, gpgme_verify_result_t result); - -private: - - GpgME::GpgContext *mCtx; - - bool printSigner(QTextStream &stream, gpgme_signature_t sign); - -}; - - -#endif //GPGFRONTEND_VERIFYRESULTANALYSE_H |