From 5cf9b60d2ded95d29827389a1a5901f1068d4337 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Fri, 28 Oct 2022 16:05:40 +0200 Subject: remove sha512 as a tempurl digest option After consulting the Swift source code, we learned that sha512 signatures are formatted using a different scheme. Since sha512 offers no real advantage at this point as long as we support sha256 instead, we can just avoid the complexity of supporting the other scheme for now. --- object.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'object.go') diff --git a/object.go b/object.go index 623818a..0322906 100644 --- a/object.go +++ b/object.go @@ -24,7 +24,6 @@ import ( "crypto/md5" //nolint:gosec // Etag uses md5 "crypto/sha1" //nolint:gosec // Used by swift "crypto/sha256" - "crypto/sha512" "encoding/hex" "fmt" "hash" @@ -668,10 +667,8 @@ func (o *Object) TempURL(key, method string, expires time.Time) (string, error) mac = hmac.New(sha256.New, []byte(key)) } else if contains(allowedDigest, "sha1") { mac = hmac.New(sha1.New, []byte(key)) - } else if contains(allowedDigest, "sha512") { - mac = hmac.New(sha512.New, []byte(key)) } else { - return "", fmt.Errorf("schwift only supports sha1, sha256 and sha512 digests but swift server only supports %s", strings.Join(allowedDigest, ", ")) + return "", fmt.Errorf("schwift supports sha1 and sha256 digests but the Swift server only supports: %s", strings.Join(allowedDigest, ", ")) } payload := fmt.Sprintf("%s\n%d\n%s", method, expires.Unix(), u.Path) -- cgit v1.2.3