diff --git a/app/controller/Cert.php b/app/controller/Cert.php index 33550cd..7768f86 100644 --- a/app/controller/Cert.php +++ b/app/controller/Cert.php @@ -304,9 +304,7 @@ class Cert extends BaseController } } - if ($certInfo['keytype'] == 'ECC') { - $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); - } + $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); $order = [ 'aid' => 0, @@ -371,9 +369,7 @@ class Cert extends BaseController if ($certInfo['code'] == -1) return json($certInfo); $domains = $certInfo['domains']; - if ($certInfo['keytype'] == 'ECC') { - $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); - } + $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); $order = [ 'aid' => 0, diff --git a/app/service/CertOrderService.php b/app/service/CertOrderService.php index 0935ec4..6b8f276 100644 --- a/app/service/CertOrderService.php +++ b/app/service/CertOrderService.php @@ -342,7 +342,10 @@ class CertOrderService throw $e; } $this->order['issuer'] = $result['issuer']; - Db::name('cert_order')->where('id', $this->order['id'])->update(['fullchain' => $result['fullchain'], 'privatekey' => $result['private_key'], 'issuer' => $result['issuer'], 'issuetime' => date('Y-m-d H:i:s', $result['validFrom']), 'expiretime' => date('Y-m-d H:i:s', $result['validTo'])]); + + $private_key = CertHelper::ensureECPrivateKeyFormat($result['private_key']); + + Db::name('cert_order')->where('id', $this->order['id'])->update(['fullchain' => $result['fullchain'], 'privatekey' => $private_key, 'issuer' => $result['issuer'], 'issuetime' => date('Y-m-d H:i:s', $result['validFrom']), 'expiretime' => date('Y-m-d H:i:s', $result['validTo'])]); $this->saveResult(3); $this->resetRetry(); }