31.5.6. 在 S3 组件中使用 KMS
要使用 AWS KMS 加密/解密数据,您可以使用 2.21.x 中引入的选项,如下例所示
from("file:tmp/test?fileName=test.txt")
.setHeader(S3Constants.KEY, constant("testFile"))
.to("aws-s3://mybucket?amazonS3Client=#client&useAwsKMS=true&awsKMSKeyId=3f0637ad-296a-3dfe-a796-e60654fb128c");
from("file:tmp/test?fileName=test.txt")
.setHeader(S3Constants.KEY, constant("testFile"))
.to("aws-s3://mybucket?amazonS3Client=#client&useAwsKMS=true&awsKMSKeyId=3f0637ad-296a-3dfe-a796-e60654fb128c");
通过这种方式,您将要求 S3 使用 KMS 密钥 3f0637ad-296a-3dfe-a796-e60654fb128c 来加密文件 test.txt。当您需要下载此文件时,在下载前将直接进行解密。