5
5
This is true both on encrypt and on decrypt.
6
6
However, sometimes you need more flexibility on decrypt,
7
7
especially if you might not know beforehand which CMK was used to encrypt a message.
8
- To address this need, the KMS keyring also supports " discovery" mode .
9
- In discovery mode, the KMS keyring will do nothing on encrypt
8
+ To address this need, you can use a KMS discovery keyring .
9
+ The KMS discovery keyring will do nothing on encrypt
10
10
but will attempt to decrypt *any* data keys that were encrypted under a KMS CMK.
11
11
12
12
However, sometimes you need to be a *bit* more restrictive than that.
29
29
see the ``keyring/aws_kms/custom_client_supplier``
30
30
and ``keyring/aws_kms/custom_kms_client_config`` examples.
31
31
32
- For examples of how to use the KMS keyring in discovery mode on decrypt,
32
+ For examples of how to use the KMS discovery keyring on decrypt,
33
33
see the ``keyring/aws_kms/discovery_decrypt``
34
34
and ``keyring/aws_kms/discovery_decrypt_in_region_only`` examples.
35
35
"""
@@ -64,8 +64,7 @@ def run(aws_kms_cmk, source_plaintext):
64
64
# To create our decrypt keyring, we need to know our current default AWS region.
65
65
#
66
66
# Create a throw-away boto3 session to discover the default region.
67
- boto3_session = Session ()
68
- local_region = boto3_session .region_name
67
+ local_region = Session ().region_name
69
68
70
69
# Now, use that region name to create two KMS discovery keyrings:
71
70
#
@@ -78,7 +77,7 @@ def run(aws_kms_cmk, source_plaintext):
78
77
79
78
# Finally, combine those two keyrings into a multi-keyring.
80
79
#
81
- # The multi-keyring steps through its member keyrings in the order that you provider them,
80
+ # The multi-keyring steps through its member keyrings in the order that you provide them,
82
81
# attempting to decrypt every encrypted data key with each keyring before moving on to the next keyring.
83
82
# Because of this, other_regions_decrypt_keyring will not be called
84
83
# unless local_region_decrypt_keyring fails to decrypt every encrypted data key.
@@ -92,7 +91,7 @@ def run(aws_kms_cmk, source_plaintext):
92
91
# Demonstrate that the ciphertext and plaintext are different.
93
92
assert ciphertext != source_plaintext
94
93
95
- # Decrypt your encrypted data using the KMS discovery keyring.
94
+ # Decrypt your encrypted data using the multi- keyring.
96
95
#
97
96
# We do not need to specify the encryption context on decrypt
98
97
# because the header message includes the encryption context.
0 commit comments