fix: url safe encryption with no padding (#93)
This commit is contained in:
parent
5cd7bae505
commit
b258b3cadb
1 changed files with 2 additions and 2 deletions
|
@ -15,7 +15,7 @@ func EncryptAES(data string, key string) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return base64.URLEncoding.EncodeToString(encrypted), nil
|
return base64.RawURLEncoding.EncodeToString(encrypted), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func EncryptBytesAES(plainText []byte, key string) ([]byte, error) {
|
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) {
|
func DecryptAES(data string, key string) (string, error) {
|
||||||
text, err := base64.URLEncoding.DecodeString(data)
|
text, err := base64.RawURLEncoding.DecodeString(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue