mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 22:16:15 +03:00
refactor cmd/crypto code for SSE handling and parsing (#11045)
This commit refactors the code in `cmd/crypto`
and separates SSE-S3, SSE-C and SSE-KMS.
This commit should not cause any behavior change
except for:
- `IsRequested(http.Header)`
which now returns the requested type {SSE-C, SSE-S3,
SSE-KMS} and does not consider SSE-C copy headers.
However, SSE-C copy headers alone are anyway not valid.
This commit is contained in:
committed by
GitHub
parent
35fafb837b
commit
8cdf2106b0
@@ -37,7 +37,6 @@ import (
|
||||
"testing"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/minio/minio/cmd/crypto"
|
||||
xhttp "github.com/minio/minio/cmd/http"
|
||||
"github.com/minio/minio/pkg/auth"
|
||||
ioutilx "github.com/minio/minio/pkg/ioutil"
|
||||
@@ -221,9 +220,9 @@ func testAPIHeadObjectHandlerWithEncryption(obj ObjectLayer, instanceType, bucke
|
||||
key32Bytes = generateBytesData(32 * humanize.Byte)
|
||||
key32BytesMd5 = md5.Sum(key32Bytes)
|
||||
metaWithSSEC = map[string]string{
|
||||
crypto.SSECAlgorithm: crypto.SSEAlgorithmAES256,
|
||||
crypto.SSECKey: base64.StdEncoding.EncodeToString(key32Bytes),
|
||||
crypto.SSECKeyMD5: base64.StdEncoding.EncodeToString(key32BytesMd5[:]),
|
||||
xhttp.AmzServerSideEncryptionCustomerAlgorithm: xhttp.AmzEncryptionAES,
|
||||
xhttp.AmzServerSideEncryptionCustomerKey: base64.StdEncoding.EncodeToString(key32Bytes),
|
||||
xhttp.AmzServerSideEncryptionCustomerKeyMD5: base64.StdEncoding.EncodeToString(key32BytesMd5[:]),
|
||||
}
|
||||
mapCopy = func(m map[string]string) map[string]string {
|
||||
r := make(map[string]string, len(m))
|
||||
@@ -667,9 +666,9 @@ func testAPIGetObjectWithMPHandler(obj ObjectLayer, instanceType, bucketName str
|
||||
key32Bytes = generateBytesData(32 * humanize.Byte)
|
||||
key32BytesMd5 = md5.Sum(key32Bytes)
|
||||
metaWithSSEC = map[string]string{
|
||||
crypto.SSECAlgorithm: crypto.SSEAlgorithmAES256,
|
||||
crypto.SSECKey: base64.StdEncoding.EncodeToString(key32Bytes),
|
||||
crypto.SSECKeyMD5: base64.StdEncoding.EncodeToString(key32BytesMd5[:]),
|
||||
xhttp.AmzServerSideEncryptionCustomerAlgorithm: xhttp.AmzEncryptionAES,
|
||||
xhttp.AmzServerSideEncryptionCustomerKey: base64.StdEncoding.EncodeToString(key32Bytes),
|
||||
xhttp.AmzServerSideEncryptionCustomerKeyMD5: base64.StdEncoding.EncodeToString(key32BytesMd5[:]),
|
||||
}
|
||||
mapCopy = func(m map[string]string) map[string]string {
|
||||
r := make(map[string]string, len(m))
|
||||
@@ -865,9 +864,9 @@ func testAPIGetObjectWithPartNumberHandler(obj ObjectLayer, instanceType, bucket
|
||||
key32Bytes = generateBytesData(32 * humanize.Byte)
|
||||
key32BytesMd5 = md5.Sum(key32Bytes)
|
||||
metaWithSSEC = map[string]string{
|
||||
crypto.SSECAlgorithm: crypto.SSEAlgorithmAES256,
|
||||
crypto.SSECKey: base64.StdEncoding.EncodeToString(key32Bytes),
|
||||
crypto.SSECKeyMD5: base64.StdEncoding.EncodeToString(key32BytesMd5[:]),
|
||||
xhttp.AmzServerSideEncryptionCustomerAlgorithm: xhttp.AmzEncryptionAES,
|
||||
xhttp.AmzServerSideEncryptionCustomerKey: base64.StdEncoding.EncodeToString(key32Bytes),
|
||||
xhttp.AmzServerSideEncryptionCustomerKeyMD5: base64.StdEncoding.EncodeToString(key32BytesMd5[:]),
|
||||
}
|
||||
mapCopy = func(m map[string]string) map[string]string {
|
||||
r := make(map[string]string, len(m))
|
||||
|
||||
Reference in New Issue
Block a user