Skip to content

Commit 31d83aa

Browse files
cleanup
1 parent 189cdfc commit 31d83aa

14 files changed

+30
-17
lines changed

examples/src/aws_kms_discovery_keyring_example.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def encrypt_and_decrypt_with_keyring(
161161
encryption_context=encryption_context,
162162
)
163163

164+
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
165+
# (This is an example for demonstration; you do not need to do this in your own code.)
166+
assert plaintext_bytes == EXAMPLE_DATA, \
167+
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"
168+
164169
# 11. Demonstrate that if a discovery keyring (Bob's) doesn't have the correct AWS Account ID's,
165170
# the decrypt will fail with an error message
166171
# Note that this assumes Account ID used here ('888888888888') is different than the one used
@@ -185,6 +190,9 @@ def encrypt_and_decrypt_with_keyring(
185190
plaintext_bytes, _ = client.decrypt(
186191
source=ciphertext,
187192
keyring=discovery_keyring_bob,
193+
# Verify that the encryption context in the result contains the
194+
# encryption context supplied to the encryptData method
195+
encryption_context=encryption_context,
188196
)
189197

190198
raise AssertionError("Decrypt using discovery keyring with wrong AWS Account ID should"

examples/src/aws_kms_discovery_multi_keyring_example.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,8 @@ def encrypt_and_decrypt_with_keyring(
158158
# encryption context supplied to the encryptData method
159159
encryption_context=encryption_context,
160160
)
161+
162+
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
163+
# (This is an example for demonstration; you do not need to do this in your own code.)
164+
assert plaintext_bytes == EXAMPLE_DATA, \
165+
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/aws_kms_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def encrypt_and_decrypt_with_keyring(
105105
encryption_context=encryption_context,
106106
)
107107

108-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
108+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
109109
# (This is an example for demonstration; you do not need to do this in your own code.)
110110
assert plaintext_bytes == EXAMPLE_DATA, \
111111
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/aws_kms_mrk_discovery_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ def encrypt_and_decrypt_with_keyring(
171171
encryption_context=encryption_context,
172172
)
173173

174-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
174+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
175175
# (This is an example for demonstration; you do not need to do this in your own code.)
176176
assert plaintext_bytes == EXAMPLE_DATA

examples/src/aws_kms_mrk_discovery_multi_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ def encrypt_and_decrypt_with_keyring(
180180
encryption_context=encryption_context,
181181
)
182182

183-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
183+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
184184
# (This is an example for demonstration; you do not need to do this in your own code.)
185185
assert plaintext_bytes == EXAMPLE_DATA

examples/src/aws_kms_mrk_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def encrypt_and_decrypt_with_keyring(
140140
encryption_context=encryption_context,
141141
)
142142

143-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
143+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
144144
# (This is an example for demonstration; you do not need to do this in your own code.)
145145
assert plaintext_bytes == EXAMPLE_DATA, \
146146
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/aws_kms_mrk_multi_keyring_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def encrypt_and_decrypt_with_keyring(
132132
encryption_context=encryption_context,
133133
)
134134

135-
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
135+
# 7. Demonstrate that the decrypted plaintext is identical to the original plaintext.
136136
# (This is an example for demonstration; you do not need to do this in your own code.)
137137
assert plaintext_bytes == EXAMPLE_DATA, \
138138
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"
@@ -141,7 +141,7 @@ def encrypt_and_decrypt_with_keyring(
141141
# multi-keyring used to encrypt the data is also capable of decrypting the data.
142142
# (This is an example for demonstration; you do not need to do this in your own code.)
143143

144-
# 9. Create a single AwsKmsMrkKeyring with the replica KMS MRK from the second region.
144+
# 8. Create a single AwsKmsMrkKeyring with the replica KMS MRK from the second region.
145145

146146
# Create a boto3 client for KMS in the second region which is the region for mrk_replica_key_id.
147147
second_region_kms_client = boto3.client('kms', region_name=mrk_replica_decrypt_region)
@@ -155,7 +155,7 @@ def encrypt_and_decrypt_with_keyring(
155155
input=second_region_mrk_keyring_input
156156
)
157157

158-
# 10. Decrypt your encrypted data using the second region AwsKmsMrkKeyring
158+
# 9. Decrypt your encrypted data using the second region AwsKmsMrkKeyring
159159
plaintext_bytes_second_region, dec_header_second_region = client.decrypt(
160160
source=ciphertext,
161161
keyring=second_region_mrk_keyring,
@@ -164,7 +164,7 @@ def encrypt_and_decrypt_with_keyring(
164164
encryption_context=encryption_context,
165165
)
166166

167-
# 12. Demonstrate that the decrypted plaintext is identical to the original plaintext.
167+
# 10. Demonstrate that the decrypted plaintext is identical to the original plaintext.
168168
# (This is an example for demonstration; you do not need to do this in your own code.)
169169
assert plaintext_bytes_second_region == EXAMPLE_DATA
170170

examples/src/aws_kms_rsa_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def encrypt_and_decrypt_with_keyring(
111111
encryption_context=encryption_context,
112112
)
113113

114-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
114+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
115115
# (This is an example for demonstration; you do not need to do this in your own code.)
116116
assert plaintext_bytes == EXAMPLE_DATA, \
117117
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/default_cryptographic_materials_manager_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def encrypt_and_decrypt_with_default_cmm(
117117
encryption_context=encryption_context,
118118
)
119119

120-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
120+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
121121
# (This is an example for demonstration; you do not need to do this in your own code.)
122122
assert plaintext_bytes == EXAMPLE_DATA, \
123123
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/hierarchical_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def encrypt_and_decrypt_with_keyring(
221221
except AWSEncryptionSDKClientError:
222222
pass
223223

224-
# 10. Demonstrate that data encrypted by one tenant's branch key can be decrypted by that tenant,
224+
# 11. Demonstrate that data encrypted by one tenant's branch key can be decrypted by that tenant,
225225
# and that the decrypted data matches the input data.
226226
plaintext_bytes_a, _ = client.decrypt(
227227
source=ciphertext_a,

examples/src/migration/migration_set_commitment_policy_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def encrypt_and_decrypt_with_keyring(
113113
encryption_context=encryption_context,
114114
)
115115

116-
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
116+
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
117117
# (This is an example for demonstration; you do not need to do this in your own code.)
118118
assert plaintext_bytes == EXAMPLE_DATA, \
119119
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/raw_aes_keyring_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def encrypt_and_decrypt_with_keyring():
115115
encryption_context=encryption_context,
116116
)
117117

118-
# 10. Demonstrate that the decrypted plaintext is identical to the original plaintext.
118+
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
119119
# (This is an example for demonstration; you do not need to do this in your own code.)
120120
assert plaintext_bytes == EXAMPLE_DATA, \
121121
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

examples/src/raw_rsa_keyring_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def encrypt_and_decrypt_with_keyring(public_key_file_name=None, private_key_file
213213
encryption_context=encryption_context,
214214
)
215215

216-
# 8. Demonstrate that the decrypted plaintext is identical to the original plaintext.
216+
# 7. Demonstrate that the decrypted plaintext is identical to the original plaintext.
217217
# (This is an example for demonstration; you do not need to do this in your own code.)
218218
assert plaintext_bytes == EXAMPLE_DATA, \
219219
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"
@@ -222,14 +222,14 @@ def encrypt_and_decrypt_with_keyring(public_key_file_name=None, private_key_file
222222
# decryption of the original ciphertext is not possible with a different keyring (Bob's).
223223
# (This is an example for demonstration; you do not need to do this in your own code.)
224224

225-
# 9. Create a new Raw RSA keyring for Bob
225+
# 8. Create a new Raw RSA keyring for Bob
226226
# Generate new keys
227227
public_key_bob, private_key_bob = generate_rsa_keys()
228228

229229
# Create the keyring
230230
raw_rsa_keyring_bob = create_rsa_keyring(public_key=public_key_bob, private_key=private_key_bob)
231231

232-
# 10. Test decrypt for the original ciphertext using raw_rsa_keyring_bob
232+
# 9. Test decrypt for the original ciphertext using raw_rsa_keyring_bob
233233
try:
234234
plaintext_bytes_bob, _ = client.decrypt( # pylint: disable=unused-variable
235235
source=ciphertext,

examples/src/set_encryption_algorithm_suite_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def encrypt_and_decrypt_with_keyring():
136136
encryption_context=encryption_context,
137137
)
138138

139-
# 10. Demonstrate that the decrypted plaintext is identical to the original plaintext.
139+
# 9. Demonstrate that the decrypted plaintext is identical to the original plaintext.
140140
# (This is an example for demonstration; you do not need to do this in your own code.)
141141
assert plaintext_bytes == EXAMPLE_DATA, \
142142
"Decrypted plaintext should be identical to the original plaintext. Invalid decryption"

0 commit comments

Comments
 (0)