Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriy Svirin committed Feb 23, 2021
1 parent 808d3c2 commit cf6a47a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Models/Crypt/RSA.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,7 @@ private function convertPrivateKey($n, $e, $d, $primes, $exponents, $coefficient
if (!($ivLen = openssl_cipher_iv_length($method))) {
throw new LogicException('Can no determinate cipher length.');
}
$iv = openssl_random_pseudo_bytes($ivLen);
if (is_bool($iv) && false === $iv) {
throw new LogicException('Can no generate random bytes.');
}
$iv = (string)openssl_random_pseudo_bytes($ivLen);

$symkey = pack('H*', md5($this->password . $iv)); // symkey is short for symmetric key
$symkey .= substr(pack('H*', md5($symkey . $this->password . $iv)), 0, 8);
Expand Down Expand Up @@ -1149,10 +1146,7 @@ private function rsaesPkcs1V15Encrypt(string $m)
$ps = '';
while (strlen($ps) != $psLen) {
$length = $psLen - strlen($ps);
$temp = openssl_random_pseudo_bytes($length);
if (is_bool($temp) && false === $temp) {
throw new LogicException('Can not generate random bytes.');
}
$temp = (string)openssl_random_pseudo_bytes($length);
$temp = str_replace("\x00", '', $temp);
$ps .= $temp;
}
Expand Down

0 comments on commit cf6a47a

Please sign in to comment.