S3 Multipart Upload with SSE-KMS

后端 未结 2 1401
别跟我提以往
别跟我提以往 2021-01-07 15:25

I am trying to write a utility using aws-java-sdk (1.11.230). I am able to write a file with SSE-KMS by using PutObjectRequest as follow:

PutObjectRequest pu         


        
相关标签:
2条回答
  • 2021-01-07 15:53

    Finally, I am able to find the solution for this. It can be done by setting headers to InitiateMultipartUploadRequest object as follow:

    InitiateMultipartUploadRequest initRequest = new
                    InitiateMultipartUploadRequest(bucketName, keyName);
            initRequest.putCustomRequestHeader("x-amz-server-side-encryption", "aws:kms");
            initRequest.putCustomRequestHeader("x-amz-server-side-encryption-aws-kms-key-id", kmsKey);
    
    0 讨论(0)
  • 2021-01-07 15:55

    Can also be done like this:

    InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest("example-bucket", "textfile.txt");      SSEAwsKeyManagementParams kms = new SSEAwsKeyManagementParams("KMS-key-alias");
    initRequest.setSSEAwsKeyManagementParams(kms);
    initResponse = s3Client.initiateMultipartUpload(initRequest);
    
    0 讨论(0)
提交回复
热议问题