Skip to content

Instantly share code, notes, and snippets.

@liks79
Created December 19, 2016 06:12
Show Gist options
  • Save liks79/89ebb7ff125cb10a5e78b8dd2055c67b to your computer and use it in GitHub Desktop.
Save liks79/89ebb7ff125cb10a5e78b8dd2055c67b to your computer and use it in GitHub Desktop.
AWS KMS enc/dec code snippet
import boto3
keyId = '<Key ARN>'
text = 'Hello Cloud!'
kms = boto3.client('kms', region_name='ap-northeast-1')
enc = kms.encrypt(KeyId = keyId, Plaintext = text)['CiphertextBlob']
print (enc)
dec = kms.decrypt(CiphertextBlob = enc)['Plaintext']
print (dec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment