MCPcopy Create free account
hub / github.com/apple/foundationdb / insertCipherKey

Method insertCipherKey

flow/BlobCipher.cpp:237–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235// BlobCipherKeyCache class methods
236
237Reference<BlobCipherKey> BlobCipherKeyCache::insertCipherKey(const EncryptCipherDomainId& domainId,
238 const EncryptCipherBaseKeyId& baseCipherId,
239 const uint8_t* baseCipher,
240 int baseCipherLen) {
241 if (domainId == ENCRYPT_INVALID_DOMAIN_ID || baseCipherId == ENCRYPT_INVALID_CIPHER_KEY_ID) {
242 throw encrypt_invalid_id();
243 }
244
245 try {
246 auto domainItr = domainCacheMap.find(domainId);
247 if (domainItr == domainCacheMap.end()) {
248 // Add mapping to track new encryption domain
249 Reference<BlobCipherKeyIdCache> keyIdCache = makeReference<BlobCipherKeyIdCache>(domainId);
250 Reference<BlobCipherKey> cipherKey =
251 keyIdCache->insertBaseCipherKey(baseCipherId, baseCipher, baseCipherLen);
252 domainCacheMap.emplace(domainId, keyIdCache);
253 return cipherKey;
254 } else {
255 // Track new baseCipher keys
256 Reference<BlobCipherKeyIdCache> keyIdCache = domainItr->second;
257 return keyIdCache->insertBaseCipherKey(baseCipherId, baseCipher, baseCipherLen);
258 }
259
260 TraceEvent("InsertCipherKey").detail("DomainId", domainId).detail("BaseCipherKeyId", baseCipherId);
261 } catch (Error& e) {
262 TraceEvent("InsertCipherKey_Failed").detail("BaseCipherKeyId", baseCipherId).detail("DomainId", domainId);
263 throw;
264 }
265}
266
267Reference<BlobCipherKey> BlobCipherKeyCache::insertCipherKey(const EncryptCipherDomainId& domainId,
268 const EncryptCipherBaseKeyId& baseCipherId,

Callers 5

BlobCipher.cppFile · 0.80
whenFunction · 0.80
setupCipherEssentialsMethod · 0.80
getEncryptionKeyMethod · 0.80
startMethod · 0.80

Calls 5

TraceEventClass · 0.85
insertBaseCipherKeyMethod · 0.80
detailMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected