mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 22:16:15 +03:00
signature: Use a layered approach for signature verification.
Signature calculation has now moved out from being a package to top-level as a layered mechanism. In case of payload calculation with body, go-routines are initiated to simultaneously write and calculate shasum. Errors are sent over the writer so that the lower layer removes the temporary files properly.
This commit is contained in:
@@ -19,18 +19,17 @@ package main
|
||||
import (
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/minio/pkg/probe"
|
||||
)
|
||||
|
||||
// isValidMD5 - verify if valid md5
|
||||
func isValidMD5(md5 string) bool {
|
||||
if md5 == "" {
|
||||
return true
|
||||
// checkValidMD5 - verify if valid md5, returns md5 in bytes.
|
||||
func checkValidMD5(md5 string) ([]byte, *probe.Error) {
|
||||
md5Bytes, e := base64.StdEncoding.DecodeString(strings.TrimSpace(md5))
|
||||
if e != nil {
|
||||
return nil, probe.NewError(e)
|
||||
}
|
||||
_, err := base64.StdEncoding.DecodeString(strings.TrimSpace(md5))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return md5Bytes, nil
|
||||
}
|
||||
|
||||
/// http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html
|
||||
|
||||
Reference in New Issue
Block a user