Skip to content

Commit 7d3d211

Browse files
committed
fix spec
1 parent 2d30327 commit 7d3d211

File tree

3 files changed

+42
-40
lines changed

3 files changed

+42
-40
lines changed

DynamoDbEncryption/dafny/DynamoDbEncryption/src/ConfigToInfo.dfy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,9 @@ module SearchConfigToInfo {
150150
//= specification/searchable-encryption/search-config.md#key-store-cache
151151
//# For a Beacon Key Source a [CMC](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md)
152152
//# MUST be created.
153-
//# For a [Single Key Store](#single-key-store-initialization), either the user 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)
154-
//# equal to 1. If the user provides a cache which is not `Shared`, they SHOULD set the [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
155-
//# of the provided `CacheType` to 1, because the [Single Key Store](#single-key-store-initialization) only ever caches one entry. Even if the user provides an entryCapacity > 1, the [Single Key Store](#single-key-store-initialization) will only cache one entry.
156-
//# For a [Multi Key Store](#multi-key-store-initialization), either the user 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)
153+
//# For a [Single Key Store](#single-key-store-initialization), either the user provides a cache, or we create a cache that has [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
154+
//# equal to 1.
155+
//# For a [Multi Key Store](#multi-key-store-initialization), either the user provides a cache, or we create a cache that has [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
157156
//# equal to 1000.
158157
var cacheType : MPT.CacheType :=
159158
if config.multi? then

DynamoDbEncryption/dafny/DynamoDbEncryption/src/SearchInfo.dfy

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,10 @@ module SearchableEncryptionInfo {
318318
&& var putCacheOutput := Seq.Last(newPutCacheHistory).output;
319319

320320
//= specification/searchable-encryption/search-config.md#get-beacon-key-materials
321-
//# The Searchable Encryption cache identifier for [Key Store Cache](#key-store-cache)
322-
//# [Get Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#get-cache-entry)
323-
//# and the [Key Store Cache](#key-store-cache)
324-
//# [Put Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#put-cache-entry)
325-
//# MUST be the same.
321+
//# The Searchable Encryption cache identifier
322+
//# used to [Put Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#put-cache-entry)
323+
//# MUST be the same
324+
//# as the identifier that was used to attempt [Get Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#get-cache-entry).
326325
&& putCacheInput.identifier == getCacheInput.identifier
327326

328327
//= specification/searchable-encryption/search-config.md#get-beacon-key-materials
@@ -374,7 +373,7 @@ module SearchableEncryptionInfo {
374373

375374
//= specification/searchable-encryption/search-config.md#get-beacon-key-materials
376375
//# If using a `Shared` cache across multiple [Beacon Key Sources](#beacon-key-source),
377-
//# different [Beacon Key Sources](#beacon-key-source) having the same `branchKey` can have different TTLs.
376+
//# different [Beacon Key Sources](#beacon-key-source) having the same `beaconKey` can have different TTLs.
378377
//# 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.
379378
//# There MUST be a check (cacheEntryWithinLimits) to make sure that for the cache entry found, who's TTL has NOT expired,
380379
//# `time.now() - cacheEntryCreationTime <= ttlSeconds` is true and

specification/searchable-encryption/search-config.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,13 @@ for how long a beacon key should exist locally before reauthorization.
220220

221221
For a Beacon Key Source a [CMC](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md)
222222
MUST be created.
223-
For a [Single Key Store](#single-key-store-initialization), either the user 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. If the user provides a cache which is not `Shared`, they SHOULD set the [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
225-
of the provided `CacheType` to 1, because the [Single Key Store](#single-key-store-initialization) only ever caches one entry. Even if the user provides an entryCapacity > 1, the [Single Key Store](#single-key-store-initialization) will only cache one entry.
226-
For a [Multi Key Store](#multi-key-store-initialization), either the user 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)
223+
For a [Single Key Store](#single-key-store-initialization), either the user provides a cache, or we create a cache that has [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 user provides a cache, or we create a cache that has [Entry Capacity](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#entry-capacity)
227226
equal to 1000.
228227

229-
The Key Store Cache MUST be shared across different [Beacon Key Sources](#beacon-key-source) if and only if a `Shared` cache is used.
230-
In all other cases, the Key Store Cache MUST be bound to the [Beacon Key Source](#beacon-key-source).
228+
The Key Store Cache is 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 is bound to the [Beacon Key Source](#beacon-key-source).
231230
In either case, Cache Identifiers MUST be unique across all key sources.
232231
Cache Identifiers for Searchable Encryption MUST be set as per the section [Searchable Encryption Cache Identifier](#searchable-encryption-cache-identifier).
233232

@@ -325,6 +324,14 @@ exists, get beacon key MUST return the [entry materials](../../submodules/Materi
325324
The `beacon key id` MUST be passed to the configured `KeyStore`'s `GetBeaconKey` operation.
326325
If `GetBeaconKey` fails get beacon key MUST fail.
327326

327+
If using a `Shared` cache across multiple [Beacon Key Sources](#beacon-key-source),
328+
different [Beacon Key Sources](#beacon-key-source) having the same `beaconKey` can have different TTLs.
329+
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.
330+
There MUST be a check (cacheEntryWithinLimits) to make sure that for the cache entry found, who's TTL has NOT expired,
331+
`time.now() - cacheEntryCreationTime <= ttlSeconds` is true and
332+
valid for TTL of the [Beacon Key Source](#beacon-key-source) getting the cache entry.
333+
If this is NOT true, then we MUST treat the cache entry as expired.
334+
328335
For every [standard beacons](beacons.md#standard-beacon-initialization), an HMAC key
329336
MUST be generated in accordance with [HMAC Key Generation](#hmac-key-generation).
330337

@@ -337,19 +344,10 @@ These materials MUST be put into the associated [Key Store Cache](#key-store-cac
337344
with an [Expiry Time](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#expiry-time)
338345
equal to now + configured [cacheTTL](#cachettl).
339346

340-
The Searchable Encryption cache identifier for [Key Store Cache](#key-store-cache)
341-
[Get Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#get-cache-entry)
342-
and the [Key Store Cache](#key-store-cache)
343-
[Put Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#put-cache-entry)
344-
MUST be the same.
345-
346-
If using a `Shared` cache across multiple [Beacon Key Sources](#beacon-key-source),
347-
different [Beacon Key Sources](#beacon-key-source) having the same `branchKey` can have different TTLs.
348-
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.
349-
There MUST be a check (cacheEntryWithinLimits) to make sure that for the cache entry found, who's TTL has NOT expired,
350-
`time.now() - cacheEntryCreationTime <= ttlSeconds` is true and
351-
valid for TTL of the [Beacon Key Source](#beacon-key-source) getting the cache entry.
352-
If this is NOT true, then we MUST treat the cache entry as expired.
347+
The Searchable Encryption cache identifier
348+
used to [Put Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#put-cache-entry)
349+
MUST be the same
350+
as the identifier that was used to attempt [Get Cache Entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/local-cryptographic-materials-cache.md#get-cache-entry).
353351

354352
These cached materials MUST be returned.
355353

@@ -366,6 +364,10 @@ The `expectedLength` MUST be 64 bytes.
366364

367365
## Searchable Encryption Cache Identifier
368366

367+
This section is consistent with the Cache Entry Identifier formulas for the [Hierarchical Keyring](https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#appendix-a-cache-entry-identifier-formulas)
368+
and [Caching CMM](https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/caching-cmm.md#appendix-a-cache-entry-identifier-formulas) in the Material Providers spec. These cache identifier formulas should
369+
not be changed independently.
370+
369371
When accessing the underlying cryptographic materials cache,
370372
Searchable Encryption MUST use the formulas specified in this section
371373
in order to compute the [cache entry identifier](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#cache-identifier).
@@ -480,12 +482,12 @@ If a user has two or more [beacon versions](#beacon-version-initialization) with
480482

481483
then they WILL share the cache entries in the `Shared` Cache.
482484

483-
Any keyring that has access to the `Shared` cache MAY be able to use materials
484-
that it MAY or MAY NOT have direct access to.
485+
Any keyring that has access to the `Shared` cache may be able to use materials
486+
that it may or may not have direct access to.
485487

486-
Users MUST make sure that all of Partition ID, Logical Key Store Name of the Key Store
487-
and Branch Key ID are set to be the same for two [beacon versions](#beacon-version-initialization) if and only they want the keyrings to share
488-
cache entries.
488+
Users should make sure that all of Partition ID, Logical Key Store Name of the Key Store
489+
and Branch Key ID are set to be the same for two [beacon versions](#beacon-version-initialization)
490+
if and only they want the keyrings to share cache entries.
489491

490492
Therefore, there are two important parameters that users need to carefully set while providing the shared cache:
491493

@@ -495,19 +497,21 @@ Partition ID is an optional parameter provided to the [Beacon Key Source](#beaco
495497
which distinguishes Cryptographic Material Providers (i.e: [Beacon Key Sources](#beacon-key-source)) writing to a cache.
496498

497499
- (Default) A a random 16-byte UUID, which makes
498-
it unique for every [Beacon Key Source](#beacon-key-source). In this case, two [Beacon Key Sources](#beacon-key-source) (or another Material Provider)
499-
CANNOT share the same cache entries in the cache.
500+
it unique for every [Beacon Key Source](#beacon-key-source).
501+
In this case, two [Beacon Key Sources](#beacon-key-source) (or another Material Provider)
502+
WILL NOT share the same cache entries in the cache.
500503
- If the Partition ID is set by the user and is the same for two [Beacon Key Sources](#beacon-key-source) (or another Material Provider),
501-
they CAN share the same cache entries in the cache.
504+
they MAY share the same cache entries in the cache.
502505
- If the Partition ID is set by the user and is different for two [Beacon Key Sources](#beacon-key-source) (or another Material Provider),
503-
they CANNOT share the same cache entries in the cache.
506+
they WILL NOT share the same cache entries in the cache.
504507

505508
### Logical Key Store Name
506509

507-
> Note: Users MUST NEVER have two different physical Key Stores with the same Logical Key Store Name.
510+
> Note: Users should not have two different physical Key Stores with the same Logical Key Store Name.
508511
509512
Logical Key Store Name is set by the user when configuring the Key Store for
510-
the [beacon versions](#beacon-version-initialization). This is a logical name for the key store.
513+
the [beacon versions](#beacon-version-initialization).
514+
This is a logical name for the key store.
511515
Logical Key Store Name MUST be converted to UTF8 Bytes to be used in
512516
the cache identifiers.
513517

0 commit comments

Comments
 (0)