|
|
@ -147,7 +147,7 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req |
|
|
|
var writer io.Writer |
|
|
|
var writer io.Writer |
|
|
|
writer = w |
|
|
|
writer = w |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if IsSSECustomerRequest(r.Header) { |
|
|
|
if hasSSECustomerHeader(r.Header) { |
|
|
|
// Response writer should be limited early on for decryption upto required length,
|
|
|
|
// Response writer should be limited early on for decryption upto required length,
|
|
|
|
// additionally also skipping mod(offset)64KiB boundaries.
|
|
|
|
// additionally also skipping mod(offset)64KiB boundaries.
|
|
|
|
writer = ioutil.LimitedWriter(writer, startOffset%(64*1024), length) |
|
|
|
writer = ioutil.LimitedWriter(writer, startOffset%(64*1024), length) |
|
|
@ -397,8 +397,8 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re |
|
|
|
var encMetadata = make(map[string]string) |
|
|
|
var encMetadata = make(map[string]string) |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
var oldKey, newKey []byte |
|
|
|
var oldKey, newKey []byte |
|
|
|
sseCopyC := IsSSECopyCustomerRequest(r.Header) |
|
|
|
sseCopyC := hasSSECopyCustomerHeader(r.Header) |
|
|
|
sseC := IsSSECustomerRequest(r.Header) |
|
|
|
sseC := hasSSECustomerHeader(r.Header) |
|
|
|
if sseC { |
|
|
|
if sseC { |
|
|
|
newKey, err = ParseSSECustomerRequest(r) |
|
|
|
newKey, err = ParseSSECustomerRequest(r) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -668,7 +668,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if IsSSECustomerRequest(r.Header) && !hasSuffix(object, slashSeparator) { // handle SSE-C requests
|
|
|
|
if hasSSECustomerHeader(r.Header) && !hasSuffix(object, slashSeparator) { // handle SSE-C requests
|
|
|
|
reader, err = EncryptRequest(hashReader, r, metadata) |
|
|
|
reader, err = EncryptRequest(hashReader, r, metadata) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
@ -691,7 +691,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req |
|
|
|
|
|
|
|
|
|
|
|
w.Header().Set("ETag", "\""+objInfo.ETag+"\"") |
|
|
|
w.Header().Set("ETag", "\""+objInfo.ETag+"\"") |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if IsSSECustomerRequest(r.Header) { |
|
|
|
if hasSSECustomerHeader(r.Header) { |
|
|
|
w.Header().Set(SSECustomerAlgorithm, r.Header.Get(SSECustomerAlgorithm)) |
|
|
|
w.Header().Set(SSECustomerAlgorithm, r.Header.Get(SSECustomerAlgorithm)) |
|
|
|
w.Header().Set(SSECustomerKeyMD5, r.Header.Get(SSECustomerKeyMD5)) |
|
|
|
w.Header().Set(SSECustomerKeyMD5, r.Header.Get(SSECustomerKeyMD5)) |
|
|
|
} |
|
|
|
} |
|
|
@ -748,7 +748,7 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r |
|
|
|
var encMetadata = map[string]string{} |
|
|
|
var encMetadata = map[string]string{} |
|
|
|
|
|
|
|
|
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if objectAPI.IsEncryptionSupported() { |
|
|
|
if IsSSECustomerRequest(r.Header) { |
|
|
|
if hasSSECustomerHeader(r.Header) { |
|
|
|
key, err := ParseSSECustomerRequest(r) |
|
|
|
key, err := ParseSSECustomerRequest(r) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
@ -903,7 +903,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt |
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
|
writeErrorResponse(w, toAPIErrorCode(err), r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
sseCopyC := IsSSECopyCustomerRequest(r.Header) |
|
|
|
sseCopyC := hasSSECopyCustomerHeader(r.Header) |
|
|
|
if sseCopyC { |
|
|
|
if sseCopyC { |
|
|
|
// Response writer should be limited early on for decryption upto required length,
|
|
|
|
// Response writer should be limited early on for decryption upto required length,
|
|
|
|
// additionally also skipping mod(offset)64KiB boundaries.
|
|
|
|
// additionally also skipping mod(offset)64KiB boundaries.
|
|
|
@ -916,7 +916,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if li.IsEncrypted() { |
|
|
|
if li.IsEncrypted() { |
|
|
|
if !IsSSECustomerRequest(r.Header) { |
|
|
|
if !hasSSECustomerHeader(r.Header) { |
|
|
|
writeErrorResponse(w, ErrSSEMultipartEncrypted, r.URL) |
|
|
|
writeErrorResponse(w, ErrSSEMultipartEncrypted, r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -1105,7 +1105,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if li.IsEncrypted() { |
|
|
|
if li.IsEncrypted() { |
|
|
|
if !IsSSECustomerRequest(r.Header) { |
|
|
|
if !hasSSECustomerHeader(r.Header) { |
|
|
|
writeErrorResponse(w, ErrSSEMultipartEncrypted, r.URL) |
|
|
|
writeErrorResponse(w, ErrSSEMultipartEncrypted, r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|