I'm trying to decrypt via the boto3 a ecrypted value with kms.
The value is encrypted via the aws cli and then stored:
aws kms encrypt --key-id xxx --plaintext "test"
The code that I'm trying to use to decrypt then is following:
kms_response = kms.decrypt(
CiphertextBlob = token
)
runner_token = kms_response['Plaintext']
The answer is unfortunately like this b'\cf6\pec-'. I'm tried to add following kms_response['Plaintext'].decode() to my script, but I get following error:
{
"errorMessage": "'utf-8' codec can't decode byte 0xb1 in position 0: invalid start byte",
"errorType": "UnicodeDecodeError",
"stackTrace": [
" File \"/var/task/terminate_hook.py\", line 32, in lambda_handler\n runner_token = kms_response['Plaintext'].decode()\n"
]
}
Has anyone an idea why this isn't working?
Thanks, Yannick