From 68caf35e58507ed48d83f64e000d96642109bdc3 Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Mon, 19 Apr 2021 13:28:27 +0200 Subject: [PATCH] fix: url safe encryption with no padding --- pkg/utils/crypto.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/crypto.go b/pkg/utils/crypto.go index 4034f48..3ca4963 100644 --- a/pkg/utils/crypto.go +++ b/pkg/utils/crypto.go @@ -15,7 +15,7 @@ func EncryptAES(data string, key string) (string, error) { return "", err } - return base64.URLEncoding.EncodeToString(encrypted), nil + return base64.RawURLEncoding.EncodeToString(encrypted), nil } func EncryptBytesAES(plainText []byte, key string) ([]byte, error) { @@ -37,7 +37,7 @@ func EncryptBytesAES(plainText []byte, key string) ([]byte, error) { } func DecryptAES(data string, key string) (string, error) { - text, err := base64.URLEncoding.DecodeString(data) + text, err := base64.RawURLEncoding.DecodeString(data) if err != nil { return "", err }