code signing

This commit is contained in:
antelle 2020-04-05 22:13:06 +02:00
parent 79ca627e7c
commit de4230e0d0
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
3 changed files with 23 additions and 13 deletions

View File

@ -42,16 +42,26 @@ module.exports = function(grunt) {
const taskResult = await runRemoteTask(opt.windows, zipContents);
const signedFile = taskResult.file;
const res = spawnSync('osslsigncode', ['verify', signedFile]);
if (res.status) {
const hasCertHash = res.stdout.includes(`Serial : ${opt.certHash}`);
if (!hasCertHash) {
grunt.warn(
`Verify error ${file}: exit code ${res.status}.\n${res.stdout.toString()}`
);
}
const res = spawnSync('signtool', ['verify', '/pa', '/sha1', opt.certHash, signedFile]);
console.log('res.status', res.status);
const res2 = spawnSync('signtool', [
'verify',
'/pa',
'/sha1',
opt.certHash.replace('1', '2'),
signedFile
]);
console.log('res.status', res2.status);
if (!res.stdout.includes('Successfully verified')) {
grunt.warn(
`Verify error ${file}: exit code ${res.status}.\n${res.stdout.toString()}`
);
}
fs.renameSync(signedFile, file);
fs.unlinkSync(signedFile, file);
fs.writeFileSync(file, taskResult.data);
grunt.log.writeln(`Signed ${file}: ${name}`);
} catch (e) {
grunt.warn(`Sign error ${file}: ${e}`);

6
package-lock.json generated
View File

@ -12386,9 +12386,9 @@
}
},
"run-remote-task": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/run-remote-task/-/run-remote-task-0.1.0.tgz",
"integrity": "sha512-FiEaJDoRxCaPnYh73niWlFq96poLBQzR8gRkfWzKr1MoChwiGMe1+JBoY3xojxzjA4ESGwrsaxSfzvJ339rxjg==",
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/run-remote-task/-/run-remote-task-0.3.0.tgz",
"integrity": "sha512-8dEOgb1wAXvWeCsQFUq6t3NgbUSO0Im78m4QTT1be0lkeYsU26R0kFGdbS/jvoBb0u5Q+MyuBOdZtgum6oyGhg==",
"requires": {
"minimist": "^1.2.5"
},

View File

@ -78,7 +78,7 @@
"prettier": "^1.19.1",
"puppeteer": "^2.1.1",
"raw-loader": "^4.0.0",
"run-remote-task": "^0.1.0",
"run-remote-task": "^0.3.0",
"sass-loader": "^8.0.2",
"stats-webpack-plugin": "0.7.0",
"string-replace-webpack-plugin": "0.1.3",