我正在使用electron-builder@20.0.6
在我的Mac上签署Windows应用程序。
在package.json
中配置:
"win": {
"icon": "public/icon-win.png",
"certificateFile": "win.p12",
"certificatePassword": "xxx",
"publisherName": "xxx"
},
当签名步骤发生时,它无法使用提供的证书和密码对应用程序进行签名,我已经确认这是正确的。
这是完整的堆栈跟踪:
yarn run v1.3.2
$ /Users/dima/workspace/work/XXX/node_modules/.bin/electron-builder -w
• electron-builder version=20.0.6
• loaded configuration file=package.json ("build" field)
• loaded parent configuration preset=react-cra
• writing effective config file=dist/electron-builder.yaml
• rebuilding native production dependencies platform=win32 arch=x64
• rebuilding native dependency name=fsevents
• packaging platform=win32 arch=x64 electron=1.8.2 appOutDir=dist/win-unpacked
• signing file=dist/win-unpacked/XXX.exe certificateFile=win.p12
Error: Exit code: 255. Command failed: /Users/dima/Library/Caches/electron-builder/winCodeSign/winCodeSign-1.9.0/darwin/10.12/osslsigncode -in /Users/dima/workspace/work/XXX/dist/win-unpacked/XXX.exe -out /Users/dima/workspace/work/XXX/dist/win-unpacked/XXX-signed-sha1.exe -t http://timestamp.verisign.com/scripts/timstamp.dll -pkcs12 win.p12 -h sha1 -n XXX -i http://./ -pass b055944f51fd0c104493963cbd386dfca19e6608862d282279d2b1572ef81f66 (sha256 hash) failed(PKCS7_add_signature)
Failed
Signing failed(PKCS7_add_signature)
Failed
at /Users/dima/workspace/work/XXX/node_modules/builder-util/src/util.ts:124:16
at ChildProcess.exithandler (child_process.js:282:5)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at doSign (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/windowsCodeSign.js:128:22)
at defaultExecutor (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/windowsCodeSign.ts:61:12)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/windowsCodeSign.ts:68:11
at Generator.next (<anonymous>)
From previous event:
at sign (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/windowsCodeSign.js:51:21)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/winPackager.ts:250:15
at Generator.next (<anonymous>)
From previous event:
at WinPackager.doSign (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/winPackager.js:348:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/winPackager.ts:238:16
From previous event:
at WinPackager.sign (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/winPackager.js:328:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/winPackager.ts:327:16
at Generator.next (<anonymous>)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at WinPackager.signAndEditResources (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/winPackager.js:405:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/winPackager.ts:343:18
at Generator.next (<anonymous>)
From previous event:
at WinPackager.signApp (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/winPackager.js:423:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/platformPackager.ts:211:16
at Generator.next (<anonymous>)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at WinPackager.doPack (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/platformPackager.js:268:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/platformPackager.ts:115:16
at Generator.next (<anonymous>)
From previous event:
at WinPackager.pack (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/platformPackager.js:188:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/packager.ts:372:24
at Generator.next (<anonymous>)
at xfs.stat (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
at /Users/dima/workspace/work/XXX/node_modules/graceful-fs/polyfills.js:287:18
at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
at Packager.doBuild (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/packager.js:441:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/packager.ts:316:52
at Generator.next (<anonymous>)
at /Users/dima/workspace/work/XXX/node_modules/graceful-fs/graceful-fs.js:99:16
at /Users/dima/workspace/work/XXX/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
at Packager._build (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/packager.js:385:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/packager.ts:278:23
at Generator.next (<anonymous>)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at Packager.build (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/packager.js:341:11)
at /Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/src/index.ts:50:40
at Generator.next (<anonymous>)
From previous event:
at build (/Users/dima/workspace/work/XXX/node_modules/electron-builder-lib/out/index.js:47:21)
at build (/Users/dima/workspace/work/XXX/node_modules/electron-builder/src/builder.ts:228:10)
at then (/Users/dima/workspace/work/XXX/node_modules/electron-builder/src/cli/cli.ts:48:33)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at Object.args [as handler] (/Users/dima/workspace/work/XXX/node_modules/electron-builder/src/cli/cli.ts:48:33)
at Object.runCommand (/Users/dima/workspace/work/XXX/node_modules/electron-builder/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/Users/dima/workspace/work/XXX/node_modules/electron-builder/node_modules/yargs/yargs.js:1042:24)
at Object.get [as argv] (/Users/dima/workspace/work/XXX/node_modules/electron-builder/node_modules/yargs/yargs.js:957:21)
at Object.<anonymous> (/Users/dima/workspace/work/XXX/node_modules/electron-builder/src/cli/cli.ts:42:15)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
error Command failed with exit code 1.
答案 0 :(得分:0)
原来我没有安装Intermediate Certificated。如果证书层次结构中没有该证书,则证书将无效,签名过程将失败。
这是Microsoft Authenticode证书,最后一个:
https://knowledge.symantec.com/support/ssl-certificates-support/index?page=content&id=INFO4690