-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Adding Caching CMM #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,3 +158,58 @@ structure CreateRequiredEncryptionContextCMMInput { | |
| @javadoc("A list of Encryption Context keys which are required to be supplied during encryption and decryption, and correspond to Encryption Context key-value pairs which are not stored on the resulting message.") | ||
| requiredEncryptionContextKeys: EncryptionContextKeys | ||
| } | ||
|
|
||
| @positional | ||
| @javadoc("Outputs for creating a Caching Cryptographic Materials Manager.") | ||
| structure CreateCachingCMMOutput { | ||
| @required | ||
| @javadoc("The created Caching Cryptographic Materials Manager.") | ||
| materialsManager: CryptographicMaterialsManagerReference | ||
| } | ||
|
|
||
| @javadoc("Creates a Caching Cryptographic Materials Manager.") | ||
| operation CreateCachingCMM { | ||
| input: CreateCachingCMMInput, | ||
| output: CreateCachingCMMOutput, | ||
| } | ||
|
|
||
| @javadoc("Inputs for creating a Caching Cryptographic Materials Manager.") | ||
| structure CreateCachingCMMInput { | ||
|
|
||
| //= aws-encryption-sdk-specification/framework/caching-cmm.md#initialization | ||
| //= type=implication | ||
| //# On caching CMM initialization, | ||
| //# the caller MUST provide the following values: | ||
| //# - [Underlying Cryptographic Materials Cache (CMC)](#underlying-cryptographic-materials-cache) | ||
| //# - [Cache Limit TTL](#cache-limit-ttl) | ||
| @required | ||
| @javadoc("The Cryptographic Materials Cache the Caching Cryptographic Materials Manager will use to cache requests.") | ||
| underlyingCMC: CryptographicMaterialsCacheReference, | ||
| @required | ||
| @javadoc("Sets the maximum lifetime for entries in the cache, for both encrypt and decrypt operations. When the specified amount of time passes after initial creation of the entry, the entry will be considered unusable, and the next operation will incur a cache miss.") | ||
| cacheLimitTtlSeconds: PositiveInteger, | ||
|
|
||
| //= aws-encryption-sdk-specification/framework/caching-cmm.md#initialization | ||
| //= type=implication | ||
| //# Additionally, the caller MUST provide one of the following values: | ||
| //# - [Underlying Cryptographic Materials Manager (CMM)](#underlying-cryptographic-materials-manager) | ||
| //# - [Keyring](keyring-interface.md) | ||
| @javadoc("The Cryptographic Materials Manager that the created Caching Cryptographic Materials Manager will delegate to. Either a Keyring or underlying Cryptographic Materials Manager must be specified.") | ||
| underlyingCMM: CryptographicMaterialsManagerReference, | ||
| @javadoc("The Keyring that the created Cryptographic Materials Manager will use to wrap data keys. The created Caching CMM will delegate to a Default Cryptographic Materials Manager created with this Keyring. Either a Keyring or an underlying Cryptographic Materials Manager must be specified as input.") | ||
| keyring: KeyringReference, | ||
|
|
||
| //= aws-encryption-sdk-specification/framework/caching-cmm.md#initialization | ||
| //= type=implication | ||
| //# Finally, the caching CMM MUST optionally accept the following values: | ||
| //# - [Partition ID](#partition-id) | ||
| //# - [Limit Bytes](#limit-bytes) | ||
| //# - [Limit Messages](#limit-messages) | ||
| @javadoc("Sets the partition ID for this CMM. By default, two CMMs will never use each other's cache entries. This helps ensure that CMMs with different delegates won't incorrectly use each other's encrypt and decrypt results. However, in certain special circumstances it can be useful to share entries between different CMMs - for example, if the backing CMM is constructed based on some parameters that depend on the operation, you may wish for delegates constructed with the same parameters to share the same partition. To accomplish this, set the same partition ID and backing cache on both CMMs; entries cached from one of these CMMs can then be used by the other. This should only be done with careful consideration and verification that the CMM delegates are equivalent for your application's purposes. By default, the partition ID is set to a random UUID to avoid any collisions.") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This content comes from the ESDK-Java. |
||
| partitionKey: Utf8Bytes, | ||
| @javadoc("Sets the maximum number of plaintext bytes that can be encrypted under the same cached data key. This does not affect decrypt operations. Specifying this limit is optional; by default, the limit is set to 2^63 - 1. If this limit is set to zero, keys can only be cached if they are used for zero-length messages.") | ||
| limitBytes: Long, | ||
| @javadoc("Sets the maximum number of individual messages that can be encrypted under the same cached data key. This does not affect decrypt operations. Specifying this limit is optional; by default, the limit is set to 2^32. This is also the maximum accepted value.") | ||
| limitMessages: Integer, | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit/Suggestion: we cache materials, not operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, I think I want operations but I'm not sure.
The point here is that there is 1 cache.
But that items put in from encrypt are not hits on decrypt.