Skip to content

Commit 55002e4

Browse files
authored
Merge pull request #23 from imikho/master
Fix wrong logic in check signature
2 parents 09710ae + da9712f commit 55002e4

File tree

1 file changed

+8
-4
lines changed
  • app/code/LiqpayMagento/LiqPay/Helper

1 file changed

+8
-4
lines changed

app/code/LiqpayMagento/LiqPay/Helper/Data.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,15 @@ public function checkOrderIsLiqPayPayment(\Magento\Sales\Api\Data\OrderInterface
118118
public function securityOrderCheck($data, $receivedPublicKey, $receivedSignature)
119119
{
120120
if ($this->isSecurityCheck()) {
121-
$privateKey = $this->getPrivateKey();
122121
$publicKey = $this->getPublicKey();
122+
if ($publicKey !== $receivedPublicKey) {
123+
return false;
124+
}
125+
126+
$privateKey = $this->getPrivateKey();
123127
$generatedSignature = base64_encode(sha1($privateKey . $data . $privateKey, 1));
124-
return $privateKey && $publicKey
125-
&& $receivedSignature == $generatedSignature || $publicKey == $receivedPublicKey;
128+
129+
return $receivedSignature === $generatedSignature;
126130
} else {
127131
return true;
128132
}
@@ -132,4 +136,4 @@ public function getLogger()
132136
{
133137
return $this->_logger;
134138
}
135-
}
139+
}

0 commit comments

Comments
 (0)