7#include <unordered_map>
53 explicit Keystore(std::shared_ptr<Config> config =
nullptr);
87 bool HasKey(
const std::vector<uint8_t>& keyData)
const;
94 std::vector<KeystoreEntry>
GetKey(
const std::string& keyName)
const;
103 std::unordered_map<std::string, KeystoreEntry> mKeys;
104 std::shared_ptr<Config> mConfig;
A named Part with a parent/child hierarchy and optional thread safety.
Definition Component.h:34
Persistent store of cryptographic keys used for archive signature verification.
Definition Keystore.h:48
Keystore(std::shared_ptr< Config > config=nullptr)
Constructs an empty Keystore.
std::vector< KeystoreEntry > GetAllKeys() const
Returns every key currently stored.
bool AddKey(const std::string &keyName, const std::vector< uint8_t > &keyData, KeyOrigin origin=KeyOrigin::Game)
Adds a key to the store.
bool RemoveKey(const std::string &keyName)
Removes a key from the store by name.
~Keystore() override=default
std::vector< KeystoreEntry > GetKey(const std::string &keyName) const
Retrieves all keys that match the given name.
void Load()
Loads all keys from the persistent storage file on disk.
void Save()
Persists the current set of keys to the storage file on disk.
bool HasKey(const std::vector< uint8_t > &keyData) const
Checks whether a key with the given data exists in the store.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
KeyOrigin
Describes where a key originated.
Definition Keystore.h:19
A single named key stored in the Keystore.
Definition Keystore.h:24
KeyOrigin Origin
Origin category for this key.
Definition Keystore.h:30
std::string Name
Human-readable name identifying this key.
Definition Keystore.h:26
std::vector< uint8_t > Data
Raw key bytes.
Definition Keystore.h:28