This code below works when the file is not encrypted (plain text) server side. I'm trying to download another file from the same bucket, but this file is encrypted via KMS.
I've tried SSECustomerKey and added .withSSECustomerKey(myKey), but no luck.. Any ideas on how to modify this code, or could point me in the right direction?
AmazonS3 s3bucket = AmazonS3ClientBuilder.standard().withRegion("us-east-2").build();
S3Object download = s3bucket.getObject("mybucket-bucket", "secretfile2.txt");
try
{
download = IOUtils.toString(download.getObjectContent());
}
catch (IOException e1)
{
e1.printStackTrace();
}