10
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
11
# ANY KIND, either express or implied. See the License for the specific
12
12
# language governing permissions and limitations under the License.
13
- """Example showing basic configuration and use of data key caching."""
13
+ """Example of encryption with data key caching."""
14
14
import aws_encryption_sdk
15
15
16
16
@@ -28,13 +28,13 @@ def encrypt_with_caching(kms_cmk_arn, max_age_in_cache, cache_capacity):
28
28
# Max messages (or max bytes per) data key are optional
29
29
MAX_ENTRY_MESSAGES = 100
30
30
31
- # Create an encryption context.
31
+ # Create an encryption context
32
32
encryption_context = {"purpose" : "test" }
33
33
34
- # Create a master key provider for the KMS master key
34
+ # Create a master key provider for the KMS customer master key (CMK)
35
35
key_provider = aws_encryption_sdk .KMSMasterKeyProvider (key_ids = [kms_cmk_arn ])
36
36
37
- # Create a cache
37
+ # Create a local cache
38
38
cache = aws_encryption_sdk .LocalCryptoMaterialsCache (cache_capacity )
39
39
40
40
# Create a caching CMM
@@ -45,8 +45,9 @@ def encrypt_with_caching(kms_cmk_arn, max_age_in_cache, cache_capacity):
45
45
max_messages_encrypted = MAX_ENTRY_MESSAGES ,
46
46
)
47
47
48
- # When the call to encryptData specifies a caching CMM,
49
- # the encryption operation uses the data key cache
48
+ # When the call to encrypt data specifies a caching CMM,
49
+ # the encryption operation uses the data key cache specified
50
+ # in the caching CMM
50
51
encrypted_message , _header = aws_encryption_sdk .encrypt (
51
52
source = my_data , materials_manager = caching_cmm , encryption_context = encryption_context
52
53
)
0 commit comments