From d4780cd8b5fffdab1cc8ef7a4f9050dc37755847 Mon Sep 17 00:00:00 2001 From: David Symonds Date: Mon, 9 Nov 2015 11:52:04 +1100 Subject: [PATCH] jws: fix base64Decode for strings of length 1 (mod 4). Change-Id: I5369e4d5454de2cf041363af1328f69d526b17d4 Reviewed-on: https://go-review.googlesource.com/16750 Reviewed-by: Andrew Gerrand --- jws/jws.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jws/jws.go b/jws/jws.go index e300001..8ca5978 100644 --- a/jws/jws.go +++ b/jws/jws.go @@ -161,6 +161,8 @@ func base64Encode(b []byte) string { func base64Decode(s string) ([]byte, error) { // add back missing padding switch len(s) % 4 { + case 1: + s += "===" case 2: s += "==" case 3: