mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
sse-kms: fix single-part object decryption (#12257)
This commit fixes a bug in the single-part object decryption that is triggered in case of SSE-KMS. Before, it was assumed that the encryption is either SSE-C or SSE-S3. In case of SSE-KMS the SSE-C branch was executed. This lead to an invalid SSE-C algorithm error. This commit fixes this by inverting the `if-else` logic. Now, the SSE-C branch only gets executed when SSE-C headers are present. Signed-off-by: Andreas Auernhammer <aead@mail.de>
This commit is contained in:
parent
d09806c887
commit
adaae26bbc
@ -375,15 +375,14 @@ func decryptObjectInfo(key []byte, bucket, object string, metadata map[string]st
|
||||
// DecryptRequestWithSequenceNumberR - same as
|
||||
// DecryptRequestWithSequenceNumber but with a reader
|
||||
func DecryptRequestWithSequenceNumberR(client io.Reader, h http.Header, bucket, object string, seqNumber uint32, metadata map[string]string) (io.Reader, error) {
|
||||
if crypto.S3.IsEncrypted(metadata) {
|
||||
return newDecryptReader(client, nil, bucket, object, seqNumber, metadata)
|
||||
if crypto.SSEC.IsEncrypted(metadata) {
|
||||
key, err := ParseSSECustomerHeader(h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return newDecryptReader(client, key, bucket, object, seqNumber, metadata)
|
||||
}
|
||||
|
||||
key, err := ParseSSECustomerHeader(h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return newDecryptReader(client, key, bucket, object, seqNumber, metadata)
|
||||
return newDecryptReader(client, nil, bucket, object, seqNumber, metadata)
|
||||
}
|
||||
|
||||
// DecryptCopyRequestR - same as DecryptCopyRequest, but with a
|
||||
|
Loading…
x
Reference in New Issue
Block a user