Skip to content

Commit

Permalink
fix: Correctly check result of function
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>

[skip ci]
  • Loading branch information
nickvergessen authored and backportbot[bot] committed May 22, 2024
1 parent be2ed68 commit 4ff7f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,12 +688,12 @@ public function verifyIntegrity() {
-----END CERTIFICATE-----
EOF;

$validSignature = (bool)openssl_verify(
$validSignature = openssl_verify(
file_get_contents($this->getDownloadedFilePath()),
base64_decode($response['signature']),
$certificate,
OPENSSL_ALGO_SHA512
);
) === 1;

if ($validSignature === false) {
throw new \Exception('Signature of update is not valid');
Expand Down
4 changes: 2 additions & 2 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,12 @@ public function verifyIntegrity() {
-----END CERTIFICATE-----
EOF;

$validSignature = (bool)openssl_verify(
$validSignature = openssl_verify(
file_get_contents($this->getDownloadedFilePath()),
base64_decode($response['signature']),
$certificate,
OPENSSL_ALGO_SHA512
);
) === 1;

if ($validSignature === false) {
throw new \Exception('Signature of update is not valid');
Expand Down

0 comments on commit 4ff7f6e

Please sign in to comment.