Skip to content

Commit

Permalink
Merge pull request #2367 from earlrob/restore_key_id_to_kms_decrypt
Browse files Browse the repository at this point in the history
restore KeyId to kms decrypt response
  • Loading branch information
mikegrima authored Aug 14, 2019
2 parents 9a3a992 + bbaff4b commit c0c86be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion moto/kms/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def decrypt(self):

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})
Expand Down
1 change: 1 addition & 0 deletions tests/test_kms/test_kms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c0c86be

Please sign in to comment.