add load/save hashFile function
parent
275a90f658
commit
c08b34ddbf
|
|
@ -13,7 +13,9 @@ public:
|
||||||
bool saveKeyFile(const std::string &app);
|
bool saveKeyFile(const std::string &app);
|
||||||
bool generateKeyPair();
|
bool generateKeyPair();
|
||||||
|
|
||||||
std::string loadHashList(const std::string &hashList);
|
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 generateHashList(const std::string &app);
|
||||||
std::string generateFileHash(const std::string &filepath);
|
std::string generateFileHash(const std::string &filepath);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,3 +156,22 @@ bool IntegretyCheck::verifyHashList(const std::string &signedHashList) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string IntegretyCheck::loadHashList(const std::string &app) {
|
||||||
|
std::stringstream content;
|
||||||
|
fs::path appPath(app);
|
||||||
|
std::ifstream in(appPath / HASH_FILE, std::ios::in | std::ios::binary);
|
||||||
|
if (in) {
|
||||||
|
content << in.rdbuf();
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
return content.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntegretyCheck::saveHashList(const std::string &app,
|
||||||
|
const std::string &hashList) {
|
||||||
|
fs::path appPath(app);
|
||||||
|
std::ofstream out(appPath / HASH_FILE);
|
||||||
|
out << hashList;
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue