Electron Builder代码签名下载证书错误

5
我正在构建一个 Electron 应用,并使用 npm 包 electron-builder 来为 Windows 构建应用和安装程序。我正在尝试使用 CSC_LINKCSC_KEY_PASSWORD 环境变量来签名应用程序,如此处所述:https://github.com/electron-userland/electron-builder#travis-appveyor-and-other-ci-servers 第一次尝试时,错误和堆栈跟踪如下:
Unhandled rejection Error: unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1065:38)
at emitNone (events.js:80:13)
at TLSSocket.emit (events.js:179:7)
at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:593:8)
at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:425:38)
From previous event:
at Object.downloadCertificate (C:\projects\presentation\Electron\node_modules\electron-builder\src\codeSign.ts:97:18)
...

我接着尝试设置环境变量 NODE_TLS_REJECT_UNAUTHORIZED=0,现在出现了不同的错误:

Unhandled rejection Error: Request error, status 400: Bad Request
at ClientRequest.<anonymous> (C:\projects\presentation\Electron\node_modules\electron-builder\src\httpRequest.ts:36:16)
...

这行代码是在electron-builder的httpRequest.ts中调用的,它似乎只是使用了Node的https模块:https.request(...)https://github.com/electron-userland/electron-builder/blob/master/src/httpRequest.ts#L28。这让我认为Windows机器或证书存在问题。我正在运行Windows 10,node 5.9.0。
2个回答

1

1
我不确定问题的根源是什么,但是将文件移动到Dropbox后,我能够使一切正常工作。 我仍然需要设置NODE_TLS_REJECT_UNAUTHORIZED=0,并且CSC_LINK需要在没有引号的情况下设置:
成功: SET CSC_LINK=https://www.dropbox.com/s/path/to/file.p12?dl=1 失败: SET CSC_LINK="https://www.dropbox.com/s/path/to/file.p12?dl=1" 关于electron-builder GitHub上的讨论链接可以在这里找到:https://github.com/electron-userland/electron-builder/issues/291

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接