mirror of https://github.com/certd/certd
chore:
parent
6410e34bf3
commit
86dd03c917
|
@ -49,15 +49,14 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
|
||||||
email!: string;
|
email!: string;
|
||||||
|
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: "PFX证书密码",
|
title: "证书密码",
|
||||||
component: {
|
component: {
|
||||||
name: "input-password",
|
name: "input-password",
|
||||||
vModel: "value",
|
vModel: "value",
|
||||||
},
|
},
|
||||||
required: false,
|
required: false,
|
||||||
order: 100,
|
order: 100,
|
||||||
// helper: "PFX、jks格式证书是否加密;jks必须设置密码,不传则默认123456",
|
helper: "PFX、jks格式证书是否加密;jks必须设置密码,不传则默认123456",
|
||||||
helper: "PFX证书是否加密",
|
|
||||||
})
|
})
|
||||||
pfxPassword!: string;
|
pfxPassword!: string;
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,8 @@ export class CertConverter {
|
||||||
const p12Path = path.join(os.tmpdir(), "/certd/tmp/", randomStr + `_cert.p12`);
|
const p12Path = path.join(os.tmpdir(), "/certd/tmp/", randomStr + `_cert.p12`);
|
||||||
const { tmpCrtPath, tmpKeyPath } = opts;
|
const { tmpCrtPath, tmpKeyPath } = opts;
|
||||||
let passwordArg = "-passout pass:";
|
let passwordArg = "-passout pass:";
|
||||||
if (pfxPassword) {
|
if (jksPassword) {
|
||||||
passwordArg = `-password pass:${pfxPassword}`;
|
passwordArg = `-password pass:${jksPassword}`;
|
||||||
}
|
}
|
||||||
await this.exec(`openssl pkcs12 -export -in ${tmpCrtPath} -inkey ${tmpKeyPath} -out ${p12Path} -name certd ${passwordArg}`);
|
await this.exec(`openssl pkcs12 -export -in ${tmpCrtPath} -inkey ${tmpKeyPath} -out ${p12Path} -name certd ${passwordArg}`);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ export class CertConverter {
|
||||||
fs.mkdirSync(dir, { recursive: true });
|
fs.mkdirSync(dir, { recursive: true });
|
||||||
}
|
}
|
||||||
await this.exec(
|
await this.exec(
|
||||||
`keytool -importkeystore -srckeystore ${p12Path} -srcstoretype PKCS12 -srcstorepass "${pfxPassword}" -destkeystore ${jksPath} -deststoretype PKCS12 -deststorepass "${jksPassword}" `
|
`keytool -importkeystore -srckeystore ${p12Path} -srcstoretype PKCS12 -srcstorepass "${jksPassword}" -destkeystore ${jksPath} -deststoretype PKCS12 -deststorepass "${jksPassword}" `
|
||||||
);
|
);
|
||||||
fs.unlinkSync(p12Path);
|
fs.unlinkSync(p12Path);
|
||||||
return jksPath;
|
return jksPath;
|
||||||
|
|
Loading…
Reference in New Issue