Skip to content

Commit

Permalink
fix base64
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Apr 7, 2021
1 parent 77f9491 commit b131c50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/UrlSecurityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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);
Expand Down

0 comments on commit b131c50

Please sign in to comment.