MCPcopy Create free account
hub / github.com/Snapchat/Valdi / restoreCryptoKey

Method restoreCryptoKey

valdi/src/valdi/runtime/Resources/EncryptedDiskCache.cpp:118–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118bool EncryptedDiskCache::restoreCryptoKey(const StringBox& path) {
119 auto encryptoKeyBinary = _keychain->get(path);
120 if (encryptoKeyBinary.empty()) {
121 return false;
122 }
123
124 snap::utils::crypto::AesEncryptor::Key cryptoKeyData;
125 if (encryptoKeyBinary.size() != cryptoKeyData.size()) {
126 return false;
127 }
128
129 std::memcpy(cryptoKeyData.data(), encryptoKeyBinary.data(), encryptoKeyBinary.size());
130 _cryptoKey = {cryptoKeyData};
131 return true;
132}
133
134void EncryptedDiskCache::generateCryptoKey(const StringBox& path) {
135 auto key = DataEncryptor::generateKey();

Callers

nothing calls this directly

Calls 4

getMethod · 0.65
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected