Modify: use base64-URLEncoding to encode signature hash
This commit is contained in:
parent
68d4a86166
commit
21ec3fc710
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@ package auth
|
||||||
import (
|
import (
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"encoding/base64"
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -25,7 +25,7 @@ func (auth HMACAuth) Sign(body string, expires int64) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%x", h.Sum(nil)) + ":" + expireTimeStamp
|
return base64.URLEncoding.EncodeToString(h.Sum(nil)) + ":" + expireTimeStamp
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check 对给定Body和Sign进行鉴权,包括对expires的检查
|
// Check 对给定Body和Sign进行鉴权,包括对expires的检查
|
||||||
|
|
Loading…
Reference in a new issue