首页 > 解决方案 > AmazonS3Encryption 忽略提供的 EncryptionMaterials

问题描述

我正在尝试从 S3 检索加密对象(由 SES 放在那里)。

我不明白的是,无论我提供什么参数KMSEncryptionMaterialsProvider(x),对象都未加密并成功检索。

即使提供加密过程未使用的 CMK 也是可行的。

没有withEncryptionMaterials(x)它会失败。

我误解了什么?

BasicAWSCredentials credentials = new BasicAWSCredentials(awsId, awsSecret);

CryptoConfiguration cryptoConf = new CryptoConfiguration()
           .withAwsKmsRegion(RegionUtils.getRegion(Regions.EU_WEST_1.getName()));

AmazonS3Encryption s3Encryption = AmazonS3EncryptionClientBuilder
            .standard()
            .withRegion(Regions.EU_WEST_1)
            .withCredentials(new AWSStaticCredentialsProvider(credentials))
            .withCryptoConfiguration(cryptoConf)
            //.withEncryptionMaterials(new SimpleMaterialProvider())
            //.withEncryptionMaterials(new KMSEncryptionMaterialsProvider("aws/ses"))
            //.withEncryptionMaterials(new KMSEncryptionMaterialsProvider("ses-dev-emaildrop"))
            .build();

S3Object s3object = s3Client.getObject(new GetObjectRequest(bucketName, s3ObjKey));

标签: amazon-web-servicesencryptionamazon-s3

解决方案


推荐阅读