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(); }