perf: 支持jks

pull/243/head
xiaojunnuo 2024-11-13 11:34:34 +08:00
parent d2ce72e4aa
commit 889eaaea92
2 changed files with 5 additions and 5 deletions

View File

@ -152,28 +152,28 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
}
this._result.pipelinePrivateVars.cert = cert;
if (cert.pfx == null || cert.der == null) {
if (cert.pfx == null || cert.der == null || cert.jks == null) {
try {
const converter = new CertConverter({ logger: this.logger });
const res = await converter.convert({
cert,
pfxPassword: this.pfxPassword,
});
if (res.pfxPath) {
if (cert.pfx == null && res.pfxPath) {
const pfxBuffer = fs.readFileSync(res.pfxPath);
cert.pfx = pfxBuffer.toString("base64");
fs.unlinkSync(res.pfxPath);
isNew = true;
}
if (res.derPath) {
if (cert.der == null && res.derPath) {
const derBuffer = fs.readFileSync(res.derPath);
cert.der = derBuffer.toString("base64");
fs.unlinkSync(res.derPath);
isNew = true;
}
if (res.jksPath) {
if (cert.jks == null && res.jksPath) {
const jksBuffer = fs.readFileSync(res.jksPath);
cert.jks = jksBuffer.toString("base64");
fs.unlinkSync(res.jksPath);

View File

@ -30,7 +30,7 @@ export class CertConverter {
// 转der
derPath = await this.convertDer(ctx);
//jksPath = await this.convertJks(ctx, opts.pfxPassword);
jksPath = await this.convertJks(ctx, opts.pfxPassword);
};
await certReader.readCertFile({ logger: this.logger, handle });