diff --git a/php/src/Kernel/Util/AntCertificationUtil.php b/php/src/Kernel/Util/AntCertificationUtil.php index 8d69d19..177ccb1 100644 --- a/php/src/Kernel/Util/AntCertificationUtil.php +++ b/php/src/Kernel/Util/AntCertificationUtil.php @@ -48,7 +48,7 @@ public function getRootCertSN($certPath) for ($i = 0; $i < count($array) - 1; $i++) { $ssl[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----"); if (strpos($ssl[$i]['serialNumber'], '0x') === 0) { - $ssl[$i]['serialNumber'] = $this->hex2dec($ssl[$i]['serialNumber']); + $ssl[$i]['serialNumber'] = $this->hex2dec($ssl[$i]['serialNumberHex']); } if ($ssl[$i]['signatureTypeLN'] == "sha1WithRSAEncryption" || $ssl[$i]['signatureTypeLN'] == "sha256WithRSAEncryption") { if ($SN == null) { @@ -72,7 +72,7 @@ function hex2dec($hex) { $dec = 0; $len = strlen($hex); - for ($i = (false === strpos(strtolower($hex), '0x') ? 1 : 3); $i <= $len; $i++) { + for ($i = 1; $i <= $len; $i++) { $dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i)))); } return $dec; @@ -609,4 +609,4 @@ function stripSignerAsn($der = null) } return substr($der, 4, $len + 4); } -} +} \ No newline at end of file