#ifndef GRADIDO_LOGIN_SERVER_CONTROLLER_CRYPTO_KEY_INCLUDE #define GRADIDO_LOGIN_SERVER_CONTROLLER_CRYPTO_KEY_INCLUDE #include "../model/table/CryptoKey.h" #include "../Crypto/KeyPairHedera.h" #include "Poco/SharedPtr.h" #include "TableControllerBase.h" #include "User.h" namespace controller { class HederaAccount; class CryptoKey : public TableControllerBase, public NotificationList { friend HederaAccount; public: ~CryptoKey(); static Poco::AutoPtr create(const KeyPairHedera* hederaKeyPair, Poco::AutoPtr user, bool saveEncrypted = true); //! if returned ptr is NULL, dataset not found static Poco::AutoPtr load(int id); static Poco::AutoPtr load(MemoryBin* publicKey); static Poco::AutoPtr load(const unsigned char* publicKey, size_t size); inline bool deleteFromDB() { return mDBModel->deleteFromDB(); } inline Poco::AutoPtr getModel() { return _getModel(); } inline const model::table::CryptoKey* getModel() const { return _getModel(); } std::unique_ptr getKeyPair(Poco::AutoPtr user) const; std::unique_ptr getKeyPair() const; protected: bool changeEncryption(Poco::AutoPtr user); CryptoKey(model::table::CryptoKey* dbModel); }; } #endif //GRADIDO_LOGIN_SERVER_CONTROLLER_CRYPTO_KEY_INCLUDE