Encrypt checksums with KMS on CompleteMultipartUpload (#16177)

This commit is contained in:
Klaus Post
2022-12-07 19:18:18 +01:00
committed by GitHub
parent 90d35b70b4
commit 12fd6678ee
3 changed files with 34 additions and 2 deletions

View File

@@ -374,5 +374,16 @@ func completeMultipartOpts(ctx context.Context, r *http.Request, bucket, object
}
opts.MTime = mtime
opts.UserDefined = make(map[string]string)
// Transfer SSEC key in opts.EncryptFn
if crypto.SSEC.IsRequested(r.Header) {
key, err := ParseSSECustomerRequest(r)
if err == nil {
// Set EncryptFn to return SSEC key
opts.EncryptFn = func(baseKey string, data []byte) []byte {
return key
}
}
}
return opts, nil
}