From ba418da84c5683b5a8630583a237370dc5b7fe7b Mon Sep 17 00:00:00 2001 From: net909 Date: Tue, 4 Nov 2025 20:42:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=81=E4=B9=A6=E7=A7=81=E9=92=A5=20E?= =?UTF-8?q?C=20=E6=8C=87=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Cert.php | 8 ++++++-- app/service/CertOrderService.php | 5 +---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controller/Cert.php b/app/controller/Cert.php index 7768f86..33550cd 100644 --- a/app/controller/Cert.php +++ b/app/controller/Cert.php @@ -304,7 +304,9 @@ class Cert extends BaseController } } - $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); + if ($certInfo['keytype'] == 'ECC') { + $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); + } $order = [ 'aid' => 0, @@ -369,7 +371,9 @@ class Cert extends BaseController if ($certInfo['code'] == -1) return json($certInfo); $domains = $certInfo['domains']; - $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); + if ($certInfo['keytype'] == 'ECC') { + $privatekey = CertHelper::ensureECPrivateKeyFormat($privatekey); + } $order = [ 'aid' => 0, diff --git a/app/service/CertOrderService.php b/app/service/CertOrderService.php index 6b8f276..0935ec4 100644 --- a/app/service/CertOrderService.php +++ b/app/service/CertOrderService.php @@ -342,10 +342,7 @@ class CertOrderService throw $e; } $this->order['issuer'] = $result['issuer']; - - $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'])]); + 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'])]); $this->saveResult(3); $this->resetRetry(); }