mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Encrypt checksums with KMS on CompleteMultipartUpload (#16177)
This commit is contained in:
@@ -993,15 +993,35 @@ func (er erasureObjects) CompleteMultipartUpload(ctx context.Context, bucket str
|
||||
//
|
||||
// Therefore, we adjust all ETags sent by the client to match what is stored
|
||||
// on the backend.
|
||||
kind, isEncrypted := crypto.IsEncrypted(fi.Metadata)
|
||||
kind, _ := crypto.IsEncrypted(fi.Metadata)
|
||||
|
||||
var objectEncryptionKey []byte
|
||||
if isEncrypted && kind == crypto.S3 {
|
||||
switch kind {
|
||||
case crypto.SSEC:
|
||||
if checksumType.IsSet() {
|
||||
if opts.EncryptFn == nil {
|
||||
return oi, crypto.ErrMissingCustomerKey
|
||||
}
|
||||
baseKey := opts.EncryptFn("", nil)
|
||||
if len(baseKey) != 32 {
|
||||
return oi, crypto.ErrInvalidCustomerKey
|
||||
}
|
||||
objectEncryptionKey, err = decryptObjectMeta(baseKey, bucket, object, fi.Metadata)
|
||||
if err != nil {
|
||||
return oi, err
|
||||
}
|
||||
}
|
||||
case crypto.S3, crypto.S3KMS:
|
||||
objectEncryptionKey, err = decryptObjectMeta(nil, bucket, object, fi.Metadata)
|
||||
if err != nil {
|
||||
return oi, err
|
||||
}
|
||||
}
|
||||
if len(objectEncryptionKey) == 32 {
|
||||
var key crypto.ObjectKey
|
||||
copy(key[:], objectEncryptionKey)
|
||||
opts.EncryptFn = metadataEncrypter(key)
|
||||
}
|
||||
|
||||
for i, part := range partInfoFiles {
|
||||
partID := parts[i].PartNumber
|
||||
|
||||
Reference in New Issue
Block a user