Commit b1c2dab9 authored by Dave Grijalva's avatar Dave Grijalva

Merge branch 'fixBase64PaddingInGo13rc1' of github.com:cryptix/jwt-go

parents cdfe0621 679bf0f3
......@@ -217,12 +217,8 @@ func EncodeSegment(seg []byte) string {
// Decode JWT specific base64url encoding with padding stripped
func DecodeSegment(seg string) ([]byte, error) {
// len % 4
switch len(seg) % 4 {
case 2:
seg = seg + "=="
case 3:
seg = seg + "==="
if l := len(seg) % 4; l > 0 {
seg += strings.Repeat("=", 4-l)
}
return base64.URLEncoding.DecodeString(seg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment