|
@@ -82,11 +82,11 @@ discard block |
|
|
block discarded – undo |
|
82
|
82
|
$iv = openssl_random_pseudo_bytes($this->ivSize); |
|
83
|
83
|
$cipherText = openssl_encrypt($string, $this->cipher, $key, OPENSSL_RAW_DATA, $iv); |
|
84
|
84
|
|
|
85
|
|
- if(false === $cipherText) { |
|
|
85
|
+ if (false === $cipherText) { |
|
86
|
86
|
$this->throwOpensslError(); |
|
87
|
87
|
} |
|
88
|
88
|
|
|
89
|
|
- return $this->encode(base64_encode($cipherText).'::'.base64_encode($iv)); |
|
|
89
|
+ return $this->encode(base64_encode($cipherText) . '::' . base64_encode($iv)); |
|
90
|
90
|
} |
|
91
|
91
|
|
|
92
|
92
|
public function decrypt(string $string, string $key): string |
|
@@ -133,7 +133,7 @@ discard block |
|
|
block discarded – undo |
|
133
|
133
|
$key = $this->legacyPrepareKey($key); |
|
134
|
134
|
$iv = substr($string, 0, $this->ivSize); |
|
135
|
135
|
$string = substr($string, $this->ivSize); |
|
136
|
|
- $string = openssl_decrypt($string, $this->cipher, $key, OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING, $iv); |
|
|
136
|
+ $string = openssl_decrypt($string, $this->cipher, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); |
|
137
|
137
|
|
|
138
|
138
|
preg_match_all('#([\\000]+)$#', $string, $matches); |
|
139
|
139
|
if (isset($matches[1][0]) && mb_strlen($matches[1][0], '8bit') > 1) { |