mirror of
https://github.com/minio/minio.git
synced 2025-07-13 11:01:05 -04:00
Fix GetObject encrypted etag (#17302)
Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
parent
e53f49e9a9
commit
c9e26401fa
@ -499,18 +499,22 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj
|
|||||||
objInfo.UserDefined = objectlock.FilterObjectLockMetadata(objInfo.UserDefined, getRetPerms != ErrNone, legalHoldPerms != ErrNone)
|
objInfo.UserDefined = objectlock.FilterObjectLockMetadata(objInfo.UserDefined, getRetPerms != ErrNone, legalHoldPerms != ErrNone)
|
||||||
|
|
||||||
// Set encryption response headers
|
// Set encryption response headers
|
||||||
switch kind, _ := crypto.IsEncrypted(objInfo.UserDefined); kind {
|
|
||||||
case crypto.S3:
|
if kind, isEncrypted := crypto.IsEncrypted(objInfo.UserDefined); isEncrypted {
|
||||||
w.Header().Set(xhttp.AmzServerSideEncryption, xhttp.AmzEncryptionAES)
|
switch kind {
|
||||||
case crypto.S3KMS:
|
case crypto.S3:
|
||||||
w.Header().Set(xhttp.AmzServerSideEncryption, xhttp.AmzEncryptionKMS)
|
w.Header().Set(xhttp.AmzServerSideEncryption, xhttp.AmzEncryptionAES)
|
||||||
w.Header().Set(xhttp.AmzServerSideEncryptionKmsID, objInfo.KMSKeyID())
|
case crypto.S3KMS:
|
||||||
if kmsCtx, ok := objInfo.UserDefined[crypto.MetaContext]; ok {
|
w.Header().Set(xhttp.AmzServerSideEncryption, xhttp.AmzEncryptionKMS)
|
||||||
w.Header().Set(xhttp.AmzServerSideEncryptionKmsContext, kmsCtx)
|
w.Header().Set(xhttp.AmzServerSideEncryptionKmsID, objInfo.KMSKeyID())
|
||||||
|
if kmsCtx, ok := objInfo.UserDefined[crypto.MetaContext]; ok {
|
||||||
|
w.Header().Set(xhttp.AmzServerSideEncryptionKmsContext, kmsCtx)
|
||||||
|
}
|
||||||
|
case crypto.SSEC:
|
||||||
|
w.Header().Set(xhttp.AmzServerSideEncryptionCustomerAlgorithm, r.Header.Get(xhttp.AmzServerSideEncryptionCustomerAlgorithm))
|
||||||
|
w.Header().Set(xhttp.AmzServerSideEncryptionCustomerKeyMD5, r.Header.Get(xhttp.AmzServerSideEncryptionCustomerKeyMD5))
|
||||||
}
|
}
|
||||||
case crypto.SSEC:
|
objInfo.ETag = getDecryptedETag(r.Header, objInfo, false)
|
||||||
w.Header().Set(xhttp.AmzServerSideEncryptionCustomerAlgorithm, r.Header.Get(xhttp.AmzServerSideEncryptionCustomerAlgorithm))
|
|
||||||
w.Header().Set(xhttp.AmzServerSideEncryptionCustomerKeyMD5, r.Header.Get(xhttp.AmzServerSideEncryptionCustomerKeyMD5))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Header.Get(xhttp.AmzChecksumMode) == "ENABLED" && rs == nil {
|
if r.Header.Get(xhttp.AmzChecksumMode) == "ENABLED" && rs == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user