forked from Mirrors/oauth2
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 <adg@golang.org>
This commit is contained in:
parent
e347d2238c
commit
d4780cd8b5
|
@ -161,6 +161,8 @@ func base64Encode(b []byte) string {
|
||||||
func base64Decode(s string) ([]byte, error) {
|
func base64Decode(s string) ([]byte, error) {
|
||||||
// add back missing padding
|
// add back missing padding
|
||||||
switch len(s) % 4 {
|
switch len(s) % 4 {
|
||||||
|
case 1:
|
||||||
|
s += "==="
|
||||||
case 2:
|
case 2:
|
||||||
s += "=="
|
s += "=="
|
||||||
case 3:
|
case 3:
|
||||||
|
|
Loading…
Reference in New Issue