feat: crypto: Add basic AES keyslot manager

We loads keys from AppData/Alber/sysdata/aes_keys.txt.

NOTE: We do differ from other emulators by not hardcoding the generator key, it's the user responsibility to provide it in aes_keys.txt.
This commit is contained in:
Mary 2023-06-19 23:13:20 +02:00
parent bf85b405af
commit 2e5bc0cb14
6 changed files with 280 additions and 2 deletions

View file

@ -5,6 +5,8 @@
#include <fstream>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
@ -164,6 +166,19 @@ namespace Helpers {
return std::bit_cast<To, From>(from);
}
#endif
static std::vector<std::string> split(const std::string& s, const char c) {
std::istringstream tmp(s);
std::vector<std::string> result(1);
while (std::getline(tmp, *result.rbegin(), c)) {
result.emplace_back();
}
// Remove temporary slot
result.pop_back();
return result;
}
}; // namespace Helpers
// UDLs for memory size values