Merge pull request #2133 from earlrob/add_keyid_to_kms_encrypt_and_decrypt
add KeyId value to kms.responses.encrypt and kms.responses.decrypt
This commit is contained in:
commit
51ef03b03b
@ -249,11 +249,11 @@ class KmsResponse(BaseResponse):
|
||||
value = self.parameters.get("Plaintext")
|
||||
if isinstance(value, six.text_type):
|
||||
value = value.encode('utf-8')
|
||||
return json.dumps({"CiphertextBlob": base64.b64encode(value).decode("utf-8")})
|
||||
return json.dumps({"CiphertextBlob": base64.b64encode(value).decode("utf-8"), 'KeyId': 'key_id'})
|
||||
|
||||
def decrypt(self):
|
||||
value = self.parameters.get("CiphertextBlob")
|
||||
return json.dumps({"Plaintext": base64.b64decode(value).decode("utf-8")})
|
||||
return json.dumps({"Plaintext": base64.b64decode(value).decode("utf-8"), 'KeyId': 'key_id'})
|
||||
|
||||
def disable_key(self):
|
||||
key_id = self.parameters.get('KeyId')
|
||||
|
@ -171,6 +171,7 @@ def test_encrypt():
|
||||
conn = boto.kms.connect_to_region("us-west-2")
|
||||
response = conn.encrypt('key_id', 'encryptme'.encode('utf-8'))
|
||||
response['CiphertextBlob'].should.equal(b'ZW5jcnlwdG1l')
|
||||
response['KeyId'].should.equal('key_id')
|
||||
|
||||
|
||||
@mock_kms_deprecated
|
||||
@ -178,6 +179,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
|
||||
|
Loading…
Reference in New Issue
Block a user