#ifndef GPG_H #define GPG_H #include #include #include #include using namespace GpgME; class Gpg { private: Gpg(); QObject *m_window; QString initGpgHome(); QString initGpgExec(); void initGpgConfig(); public: ~Gpg(); static std::shared_ptr instance() { static std::shared_ptr s{new Gpg}; return s; } Gpg(Gpg const &) = delete; void operator=(Gpg const &) = delete; void setWindow(QObject *window) { m_window = window; }; QObject *getWindow() { return m_window; }; QPair< Error, std::vector< Key > > getAllKeys(bool remote = false, bool include_sigs = {}, bool validate = false); QPair> getKeys( QString pattern_uid, bool remote = false, bool include_sigs = false, bool validate = false); QPair getKey( QString uid, bool remote = false, bool include_sigs = false, bool validate = false); QPair decrypt( QByteArray cipherText); QPair decryptFromFile( QString path); QPair encrypt( QString str, QString uid, bool ascii_armor = true, bool text_mode = true); Error encryptToFile( QString str, QString path, QString uid, bool ascii_armor = true, bool text_mode = true); Error importKeysFromFile( QString path); Error deleteKeyId( QString uid); }; #endif