【发布时间】:2019-11-18 22:51:47
【问题描述】:
对于如何使用 AWS KMS 客户端解密密文 blob,我有点困惑。这是 AWS Docs 中的一个示例:
// Encrypt a data key
//
// Replace the following fictitious CMK ARN with a valid CMK ID or ARN
String keyId = "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-
56ef-1234567890ab";
ByteBuffer plaintext = ByteBuffer.wrap(new byte[]{1,2,3,4,5,6,7,8,9,0});
EncryptRequest req = new
EncryptRequest().withKeyId(keyId).withPlaintext(plaintext);
ByteBuffer ciphertext = kmsClient.encrypt(req).getCiphertextBlob();
// Decrypt a data key
//
ByteBuffer ciphertextBlob = Place your ciphertext here;
DecryptRequest req = new DecryptRequest().withCiphertextBlob(ciphertextBlob);
ByteBuffer plainText = kmsClient.decrypt(req).getPlaintext();
解密方法中没有提供 KMS 密钥。这是否意味着 KMS 密钥以某种方式在密文 blob 中加密?如果是这样……
- 如何授予解密加密密文 blob 的权限?
- 如果我想解密来自 AWS 服务的值,是否需要创建一个 IAM 角色来执行此操作并配置 KMS 密钥以允许该角色解密?
【问题讨论】:
标签: amazon-web-services aws-kms