Browse Source

feat: reverify and renew functions

master
dnomd343 3 years ago
parent
commit
c7dbb9c159
  1. 44
      encryption365.php

44
encryption365.php

@ -680,7 +680,7 @@ class listCtr {
public static function list() { // 列出所有证书 public static function list() { // 列出所有证书
$list = Storage::getHostList(); $list = Storage::getHostList();
if (count($list) === 0) { if (count($list) === 0) {
Output::line('There are not any host yet.'); Output::line('There are not any host yet.', 'yellow');
return; return;
} }
Output::line("Host\t\tID\tDomains\t\t\tCreate Time\t\tExpire Time"); Output::line("Host\t\tID\tDomains\t\t\tCreate Time\t\tExpire Time");
@ -699,17 +699,17 @@ class listCtr {
class issueCtr { class issueCtr {
public static function entry($params) { public static function entry($params) {
if (count($params) === 0) { if (count($params) === 0) {
Output::line('You must specify encryption method.'); Output::line('You must specify encryption method.', 'red');
return; return;
} }
if ($params[0] === 'ECC') { $isEcc = true; } if ($params[0] === 'ECC') { $isEcc = true; }
if ($params[0] === 'RSA') { $isEcc = false; } if ($params[0] === 'RSA') { $isEcc = false; }
if (!isset($isEcc)) { if (!isset($isEcc)) {
Output::line('You must specify RSA or ECC.'); Output::line('You must specify RSA or ECC.', 'red');
return; return;
} }
if (count($params) === 1) { if (count($params) === 1) {
Output::line('You must specify at least one IP or domain name.'); Output::line('You must specify at least one IP or domain name.', 'red');
return; return;
} }
unset($params[0]); unset($params[0]);
@ -723,7 +723,7 @@ class issueCtr {
} }
$productId = self::getProductId(); $productId = self::getProductId();
if (!is_numeric($productId)) { if (!is_numeric($productId)) {
Output::line('Illegal product ID.'); Output::line('Illegal product ID.', 'red');
return; return;
} }
Certificate::createNewOrder($productId, $domains, $isEcc); Certificate::createNewOrder($productId, $domains, $isEcc);
@ -761,6 +761,34 @@ class issueCtr {
} }
} }
class ReverifyCtr {
public static function entry($params) {
if (count($params) === 0) {
Output::line('Host must be specified.', 'red');
return;
}
if (count($params) > 1) {
Output::line('Too many parameters to reverify command.', 'red');
return;
}
Certificate::reValidate($params[0]);
}
}
class RenewCtr {
public static function entry($params) {
if (count($params) === 0) {
Output::line('Host must be specified.', 'red');
return;
}
if (count($params) > 1) {
Output::line('Too many parameters to reverify command.', 'red');
return;
}
Certificate::renewCert($params[0]);
}
}
function noParam($params) { // 命令不含参数情况 function noParam($params) { // 命令不含参数情况
if (count($params) === 0) { return; } if (count($params) === 0) { return; }
echo 'Unknow params' . PHP_EOL; echo 'Unknow params' . PHP_EOL;
@ -798,6 +826,12 @@ function main($argv) { // 脚本入口
case 'issue': case 'issue':
IssueCtr::entry($params); IssueCtr::entry($params);
break; break;
case 'reverify':
ReverifyCtr::entry($params);
break;
case 'renew':
RenewCtr::entry($params);
break;
default: default:
echo 'Unknow command, please use "encryption365 help" to show the usage.' . PHP_EOL; echo 'Unknow command, please use "encryption365 help" to show the usage.' . PHP_EOL;
} }

Loading…
Cancel
Save