Oha*_*rry -1 python boto amazon-web-services boto3
我正在boto3使用亚马逊的kms服务.
def __init__(self):
self.kms_client = boto3.client('kms')
def encrypt_text(self, text):
response = self.kms_client.encrypt(
KeyId = self.global_key_alias,
Plaintext = text
)
return response['CiphertextBlob']
def decrypt_text(self, encrypted_text):
# official docs state that encrypted_text should be a byte(doesn't exists in python 2)
# currently it's working when sending a string, but it's dangerous
response = self.kms_client.decrypt(
CiphertextBlob = encrypted_text
)
Run Code Online (Sandbox Code Playgroud)
我正在使用boto3,因为新功能将在那里开发.
正如笔记所说,我发送一个字符串而不是官方文档,声明你需要发送一个字节类型.
我想知道这可能会在未来发生变化吗?然后我对亚马逊的api将没用,因为我没有bytespython 2.7.9中的类型
任何意见 ?想法?
| 归档时间: |
|
| 查看次数: |
346 次 |
| 最近记录: |