mirror of https://github.com/certd/certd
perf: 支持jks
parent
d2ce72e4aa
commit
889eaaea92
|
@ -152,28 +152,28 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
|
||||||
}
|
}
|
||||||
this._result.pipelinePrivateVars.cert = cert;
|
this._result.pipelinePrivateVars.cert = cert;
|
||||||
|
|
||||||
if (cert.pfx == null || cert.der == null) {
|
if (cert.pfx == null || cert.der == null || cert.jks == null) {
|
||||||
try {
|
try {
|
||||||
const converter = new CertConverter({ logger: this.logger });
|
const converter = new CertConverter({ logger: this.logger });
|
||||||
const res = await converter.convert({
|
const res = await converter.convert({
|
||||||
cert,
|
cert,
|
||||||
pfxPassword: this.pfxPassword,
|
pfxPassword: this.pfxPassword,
|
||||||
});
|
});
|
||||||
if (res.pfxPath) {
|
if (cert.pfx == null && res.pfxPath) {
|
||||||
const pfxBuffer = fs.readFileSync(res.pfxPath);
|
const pfxBuffer = fs.readFileSync(res.pfxPath);
|
||||||
cert.pfx = pfxBuffer.toString("base64");
|
cert.pfx = pfxBuffer.toString("base64");
|
||||||
fs.unlinkSync(res.pfxPath);
|
fs.unlinkSync(res.pfxPath);
|
||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.derPath) {
|
if (cert.der == null && res.derPath) {
|
||||||
const derBuffer = fs.readFileSync(res.derPath);
|
const derBuffer = fs.readFileSync(res.derPath);
|
||||||
cert.der = derBuffer.toString("base64");
|
cert.der = derBuffer.toString("base64");
|
||||||
fs.unlinkSync(res.derPath);
|
fs.unlinkSync(res.derPath);
|
||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.jksPath) {
|
if (cert.jks == null && res.jksPath) {
|
||||||
const jksBuffer = fs.readFileSync(res.jksPath);
|
const jksBuffer = fs.readFileSync(res.jksPath);
|
||||||
cert.jks = jksBuffer.toString("base64");
|
cert.jks = jksBuffer.toString("base64");
|
||||||
fs.unlinkSync(res.jksPath);
|
fs.unlinkSync(res.jksPath);
|
||||||
|
|
|
@ -30,7 +30,7 @@ export class CertConverter {
|
||||||
// 转der
|
// 转der
|
||||||
derPath = await this.convertDer(ctx);
|
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 });
|
await certReader.readCertFile({ logger: this.logger, handle });
|
||||||
|
|
Loading…
Reference in New Issue