#pragma once #include "../cryptopp/rsa.h" #include class IntegretyCheck { public: IntegretyCheck(); IntegretyCheck(const std::string &appPath, const std::string &keyFile, const std::string &hashList); bool loadKeyFile(const std::string &app); bool saveKeyFile(const std::string &app); bool generateKeyPair(); std::string loadHashList(const std::string &app); void saveHashList(const std::string &app, const std::string &hashList); std::string generateHashList(const std::string &app); std::string generateFileHash(const std::string &filepath); bool checkHashList(const std::string &hashList, const std::string &appPath); bool verifyFileHash(const std::string &filePath, const std::string &hash); void signHashList(std::string &hashList); bool verifyHashList(const std::string &signedHashList, std::string &hashList); static const int KEY_SIZE; static const std::string HASH_FILE; static const std::string KEY_FILE; static const std::string SIGNATURE_MARKER; static const std::string HASH_FILE_DIVIDER; private: CryptoPP::RSA::PublicKey m_publicKey; CryptoPP::RSA::PrivateKey m_privateKey; bool extractHashAndFile(const std::string &line, std::string &hash, std::string &filename); };