From 5347a577da36a114cb8931430737bd8d42bf669a Mon Sep 17 00:00:00 2001 From: Earl Robinson Date: Wed, 14 Aug 2019 08:19:32 -0400 Subject: [PATCH 1/2] restore KeyId to kms decrypt response regression introduced in #2071 "KMS generate_data_key" --- moto/kms/responses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moto/kms/responses.py b/moto/kms/responses.py index 8cd6e7663..53012b7f8 100644 --- a/moto/kms/responses.py +++ b/moto/kms/responses.py @@ -238,7 +238,7 @@ class KmsResponse(BaseResponse): value = self.parameters.get("CiphertextBlob") try: - return json.dumps({"Plaintext": base64.b64decode(value).decode("utf-8")}) + return json.dumps({"Plaintext": base64.b64decode(value).decode("utf-8"), 'KeyId': 'key_id'}) except UnicodeDecodeError: # Generate data key will produce random bytes which when decrypted is still returned as base64 return json.dumps({"Plaintext": value}) From bbaff4b273f37386f660eb3acde7edac1b04854b Mon Sep 17 00:00:00 2001 From: Earl Robinson Date: Wed, 14 Aug 2019 08:39:54 -0400 Subject: [PATCH 2/2] restore KeyId to test_decrypt in test_kms --- tests/test_kms/test_kms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_kms/test_kms.py b/tests/test_kms/test_kms.py index 8fe0620f1..f189fbe41 100644 --- a/tests/test_kms/test_kms.py +++ b/tests/test_kms/test_kms.py @@ -191,6 +191,7 @@ def test_decrypt(): conn = boto.kms.connect_to_region('us-west-2') response = conn.decrypt('ZW5jcnlwdG1l'.encode('utf-8')) response['Plaintext'].should.equal(b'encryptme') + response['KeyId'].should.equal('key_id') @mock_kms_deprecated