You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Update Cache Entry Identifier Formulas to shared cache across multiple Beacon Key Sources](../../changes/2024-09-13_cache-across-hierarchical-keyrings/change.md)
10
+
- New optional parameter `Partition ID` used to distinguish Cryptographic Material Providers (i.e: Beacon Key Sources) writing to a cache
11
+
- New optional parameter `cache` allowed while creating a `SingleKeyStore`
12
+
- 1.0.0
13
+
- Initial record
9
14
10
15
### Changelog
11
16
@@ -164,10 +169,10 @@ This can also be described as single tenant.
164
169
165
170
On initialization of a Single Key Store, the caller MUST provide:
166
171
167
-
TODO: Update
168
-
169
172
-[Beacon Key Id](#beacon-key-id)
170
173
-[cacheTTL](#cachettl)
174
+
-[cache](#key-store-cache)
175
+
-[partition-id](#partition-id)
171
176
172
177
### Multi Key Store Initialization
173
178
@@ -177,11 +182,10 @@ This can also be described as multi tenant.
177
182
178
183
On initialization of a Multi Key Store, the caller MUST provide:
179
184
180
-
TODO: Update
181
-
182
185
-[Beacon Key Field Name](#beacon-key-field-name)
183
186
-[cacheTTL](#cachettl)
184
-
-[max cache size](#max-cache-size)
187
+
-[cache](#key-store-cache)
188
+
-[partition-id](#partition-id)
185
189
186
190
### Field descriptions
187
191
@@ -212,28 +216,32 @@ and used to extract a beacon key id from a query.
212
216
The [cacheTTL](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#time-to-live-ttl)
213
217
for how long a beacon key should exist locally before reauthorization.
214
218
215
-
#### max cache size
219
+
###Key Store Cache
216
220
217
-
TODO: Remove and add partition ID
221
+
For a Beacon Key Source a [CMC](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md)
222
+
MUST be created.
223
+
For a [Single Key Store](#single-key-store-initialization), either the customer provides a cache, or we create a cache that MUST have [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
224
+
equal to 1.
225
+
For a [Multi Key Store](#multi-key-store-initialization), either the customer provides a cache, or we create a cache that MUST have [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
226
+
equal to 1000.
218
227
219
-
The [max cache size](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#entry-capacity)
220
-
that the [Key Store Cache](#key-store-cache) will be configured to.
228
+
The Key Store Cache MUST be shared across different [Beacon Key Sources](#beacon-key-source) if and only if a `Shared` cache is used.
229
+
In all other cases, the Key Store Cache MUST be bound to the [Beacon Key Source](#beacon-key-source).
230
+
In either case, Cache Identifiers MUST be unique across all key sources.
231
+
Cache Identifiers for Searchable Encryption MUST be set as per the section [Searchable Encryption Cache Identifier](#searchable-encryption-cache-identifier).
221
232
222
-
### Key Store Cache
233
+
### Partition ID
223
234
224
-
TODO: Update
235
+
An optional string that uniquely identifies the respective [Beacon Key Source](#beacon-key-source)
236
+
and is used to avoid collisions with other [Beacon Key Sources](#beacon-key-source).
225
237
226
-
For a Beacon Key Source a [CMC](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md)
227
-
MUST be created.
228
-
For a [Single Key Store](#single-key-store-initialization) the [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
229
-
MUST be 1
230
-
For a [Multi Key Store](#multi-key-store-initialization) the [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
231
-
MUST be key store's max cache size.
238
+
PartitionId can be a string provided by the user. If provided, it MUST be interpreted as UTF8 bytes.
239
+
If the PartitionId is NOT provided by the user, it MUST be set to the 16 byte representation of a v4 UUID.
240
+
241
+
The Partition ID MUST NOT be changed after initialization.
232
242
233
-
The Key Store Cache MUST be bound to the Beacon Key Source.
234
-
This is currently invariant because we construct the cache for each search config
235
-
It is easy for beacon key ids to be unique within a single key source,
236
-
this may not be true across all key sources.
243
+
Please see [Shared Cache Considerations](#shared-cache-considerations) on how to provide the
244
+
Partition ID and Logical Key Store Name while providing a Shared Cache to the [Beacon Key Source](#beacon-key-source).
237
245
238
246
## Beacon Keys
239
247
@@ -328,6 +336,14 @@ These materials MUST be put into the associated [Key Store Cache](#key-store-cac
328
336
with an [Expiry Time](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#expiry-time)
329
337
equal to now + configured [cacheTTL](#cachettl).
330
338
339
+
If using a `Shared` cache across multiple [Beacon Key Sources](#beacon-key-source),
340
+
different [Beacon Key Sources](#beacon-key-source) having the same `branchKey` can have different TTLs.
341
+
In such a case, the expiry time in the cache is set according to the [Beacon Key Source](#beacon-key-source) that populated the cache.
342
+
There MUST be a check (cacheEntryWithinLimits) to make sure that for the cache entry found, who's TTL has NOT expired,
343
+
`time.now() - cacheEntryCreationTime <= ttlSeconds` is true and
344
+
valid for TTL of the [Beacon Key Source](#beacon-key-source) getting the cache entry.
345
+
If this is NOT true, then we MUST treat the cache entry as expired.
346
+
331
347
These cached materials MUST be returned.
332
348
333
349
### HMAC Key Generation
@@ -340,3 +356,160 @@ using the beacon key retrieved above as the initial key material with no salt.
340
356
The `info` MUST be the concatenation of "AWS_DBE_SCAN_BEACON" encoded as UTF8
341
357
and the beacon name.
342
358
The `expectedLength` MUST be 64 bytes.
359
+
360
+
## Searchable Encryption Cache Identifier
361
+
362
+
When accessing the underlying cryptographic materials cache,
363
+
Searchable Encryption MUST use the formulas specified in this section
364
+
in order to compute the [cache entry identifier](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#cache-identifier).
365
+
366
+
### Preliminaries
367
+
368
+
Each of the cache entry identifier formulas includes serialized information related to the branch key,
369
+
as defined in the [Key Provider Info](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/structures.md#key-provider-information).
370
+
371
+
We establish the following definitions for the Cache Entry Identifier formula:
372
+
373
+
#### Resource Identifier
374
+
375
+
A Hex value that indicates if an element is from a Caching_CMM, Hierarchical_Keyring, or some other future resource.
376
+
377
+
```
378
+
Caching_CMM : 0x01 (0001)
379
+
Hierarchical_Keyring : 0x02 (0010)
380
+
```
381
+
382
+
#### Scope Identifier
383
+
384
+
A Hex value that indicates if an element is used for Encryption, Decryption, Searchable Encryption, or some other future purpose.
385
+
386
+
```
387
+
Encrypt : 0x01 (0001)
388
+
Decrypt : 0x02 (0010)
389
+
Searchable Encryption : 0x03 (0011)
390
+
```
391
+
392
+
#### Partition ID
393
+
394
+
Partition ID is an optional parameter provided to the [Beacon Key Source](#beacon-key-source) input, which distinguishes
395
+
Cryptographic Material Providers (i.e: [Beacon Key Sources](#beacon-key-source)) writing to a cache.
396
+
It can either be a String provided by the user, which MUST be interpreted as the bytes of
397
+
UTF-8 Encoding of the String, or a v4 UUID, which SHOULD be interpreted as the 16 byte representation of the UUID.
398
+
399
+
Note: The cache will not know if the Partition ID is a String set by the user or the UUID.
400
+
The constructor of the [Beacon Key Source](#beacon-key-source) MUST record these bytes at construction time.
401
+
402
+
Please see [Shared Cache Considerations](#shared-cache-considerations) on how to provide the
403
+
Partition ID and Logical Key Store Name of the [beacon versions](#beacon-version-initialization)
404
+
while providing a Shared Cache to the [Beacon Key Source](#beacon-key-source).
405
+
406
+
#### Resource Suffix
407
+
408
+
The resource suffixes for the Searchable Encryption is as follows:
0 commit comments