-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kms#decrypt throws 'utf8' codec error #31
Comments
@bilalaslam this appears to be a bug in Botocore where the import base64
kms.decrypt(CiphertextBlob=base64.b64encode(result['CiphertextBlob']).decode('utf-8')) You can use that as a workaround for now, but once we make the underlying fix you'll need to remove the manual base64-encoding. |
I can confirm the bug on my end too. |
@spgta does the workaround work for you? This should get fixed in Botocore soon. |
The workaround worked for me, but I had to base64 encode the Plaintext as well. encrypted=kms.encrypt(KeyId='', Plaintext='Test')
decrypted=kms.decrypt(CiphertextBlob=base64.b64encode(encrypted['CiphertextBlob']).decode('utf-8'))
base64.b64encode(decrypted['Plaintext']).decode('utf-8') |
This pull request modifies the code added in ffcef5f to also support arguments passed in as bytes, such as those you might encounter when using KMS. See this related issue: boto/boto3#31 Since the JSON data for serialization tests doesn't support specifying bytes as input, I've added a new test class to cover this case.
This works for me:
decrypt: kms = boto3.client("kms") |
@spgta, @jstnblau, @bilalaslam this should be fixed upstream with boto/botocore#397, which was just merged. It'll go out with the next release. |
Released in version 0.0.5 |
kms#decrypt
throws this error every time:Repro steps:
May be related to this issue
The text was updated successfully, but these errors were encountered: