4
4
When you give the KMS keyring specific key IDs it will use those CMKs and nothing else.
5
5
This is true both on encrypt and on decrypt.
6
6
However, sometimes you need more flexibility on decrypt,
7
- especially if you might not know beforehand which CMK was used to encrypt a message.
7
+ especially when you don't know which CMKs were used to encrypt a message.
8
8
To address this need, you can use a KMS discovery keyring.
9
- The KMS discovery keyring will do nothing on encrypt
10
- but will attempt to decrypt *any* data keys that were encrypted under a KMS CMK.
9
+ The KMS discovery keyring does nothing on encrypt,
10
+ but attempts to decrypt *any* data keys that were encrypted under a KMS CMK.
11
11
12
- This example shows how to configure and use a KMS keyring in discovery mode .
12
+ This example shows how to configure and use a KMS discovery keyring .
13
13
14
14
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html#use-kms-keyring
15
15
20
20
see the ``keyring/aws_kms/custom_client_supplier``
21
21
and ``keyring/aws_kms/custom_kms_client_config`` examples.
22
22
23
- For examples of how to use the KMS keyring in discovery mode on decrypt,
23
+ For examples of how to use the KMS discovery keyring on decrypt,
24
24
see the ``keyring/aws_kms/discovery_decrypt_in_region_only``
25
25
and ``keyring/aws_kms/discovery_decrypt_with_preferred_region`` examples.
26
26
"""
30
30
31
31
def run (aws_kms_cmk , source_plaintext ):
32
32
# type: (str, bytes) -> None
33
- """Demonstrate configuring a KMS keyring to use discovery mode for decryption.
33
+ """Demonstrate configuring a KMS discovery keyring for decryption.
34
34
35
35
:param str aws_kms_cmk: The ARN of an AWS KMS CMK that protects data keys
36
36
:param bytes source_plaintext: Plaintext to encrypt
@@ -48,7 +48,7 @@ def run(aws_kms_cmk, source_plaintext):
48
48
# Create the keyring that determines how your data keys are protected.
49
49
encrypt_keyring = KmsKeyring (generator_key_id = aws_kms_cmk )
50
50
51
- # Create the KMS discovery keyring that we will use on decrypt.
51
+ # Create a KMS discovery keyring to use on decrypt.
52
52
#
53
53
# Because we do not specify any key IDs, this keyring is created in discovery mode.
54
54
decrypt_keyring = KmsKeyring ()
@@ -63,8 +63,8 @@ def run(aws_kms_cmk, source_plaintext):
63
63
64
64
# Decrypt your encrypted data using the KMS discovery keyring.
65
65
#
66
- # We do not need to specify the encryption context on decrypt
67
- # because the header message includes the encryption context.
66
+ # You do not need to specify the encryption context on decrypt
67
+ # because the header of the encrypted message includes the encryption context.
68
68
decrypted , decrypt_header = aws_encryption_sdk .decrypt (source = ciphertext , keyring = decrypt_keyring )
69
69
70
70
# Demonstrate that the decrypted plaintext is identical to the original plaintext.
0 commit comments