diff --git a/src/UrlSecurityManager.php b/src/UrlSecurityManager.php index 5f8356a..16eba80 100644 --- a/src/UrlSecurityManager.php +++ b/src/UrlSecurityManager.php @@ -528,7 +528,7 @@ protected function encryptString(string $input): string $cipherText = openssl_encrypt($input, $this->cipherMethod, $this->secretKey, $options=OPENSSL_RAW_DATA, $iv); $hmac = hash_hmac('sha256', $cipherText, $this->secretKey, $as_binary=true); - return urlencode(base64_encode($iv.$hmac.$cipherText)); + return base64_encode(base64_encode($iv.$hmac.$cipherText)); } /** @@ -538,7 +538,7 @@ protected function encryptString(string $input): string */ protected function decryptString(string $input): string { - $c = base64_decode(urldecode($input)); + $c = base64_decode(base64_decode($input)); $ivLen = openssl_cipher_iv_length($this->cipherMethod); $iv = substr($c, 0, $ivLen); $hmac = substr($c, $ivLen, $sha2len=32);