You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Electron Forge结合Wix-MSI Maker使用Sectigo EV USB为Windows端Electron应用实现完整代码签名?

如何通过Electron Forge结合Wix-MSI Maker使用Sectigo EV USB为Windows端Electron应用实现完整代码签名?

我想要使用Sectigo EV USB为我的Electron应用做代码签名,目前用的是Electron Forge打包,搭配Wix-MSI Maker生成安装包。

查阅Wix-MSI的配置选项后,我已经能通过signWithParams参数给生成的MSI文件签名,但问题在于Forge本身并没有给打包出来的exe和dll文件签名,导致安装包安装完成后,应用程序依然是未签名状态,这个问题该怎么解决?

我已经尝试过以下两种方案,但都没成功:

  • 使用postpackage钩子来做签名,但这个方案不太可靠:我需要手动指定签名文件的路径,而且electron-windows-sign这个工具也没法正常使用——因为它是ES模块,而我的forge.config.js里只能用require导入模块,没法正确引入它。另外我不需要electron osx或者notarize的方案,那是给MacOS用的。

    我尝试的代码如下:

    const sign = require('electron-windows-sign');
    
    const appPath = 'sample/Path'; 
    const certificateSubjectName = 'certificateSubjectName';
    
    // Sign all .exe and .dll files in the packaged app
    await sign({
      appPath,
      certificateSubjectName,
    });
    
  • 在packagerConfig里添加签名配置,但看起来Forge的配置里并没有这个选项:

    win: {
              // The subject name of the certificate
              certificateSubjectName: 'Name of certificate',
              signWithParams: '/v /td sha256 /fd sha256 /n "Name of certificate"',
            },
    

P.S. 我不想用electron-builder。

备注:内容来源于stack exchange,提问作者Akshat Parashar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 16:29:38