Windows(在Windows上)的代码Electron应用程序
正如标题中所说的那样,这是IM试图做的:使用Windows 10,使用从第三方供应商(以P12格式)购买的证书代码我的电子应用程序。
我已经在这里阅读了文档: https://wwww.electron.build/configuration/configuration/configuration/win/win 此处: https://wwwww.electron.build/code-signing 并意识到我需要使用适当的键(CERTIFTILEFILE和CELIDEDPASSWORD)提供证书文件和密码(如果设置)的路径。
我还看到了这些答案:
(也有很多问题和答案是指人在Mac上建造Windows的人,但这不是我在这里所做的),
但这似乎并没有解决这个问题。
这些就是我的软件包中的行。将json设置为参考相关路径/密码:
"certificateFile ": "./certificate_file.p12",
"certificatePassword ": "password"
我意识到最好将这些设置设置在.env文件中,然后从那里读取它们,我打算以后进行。但是,据我了解,这应该就足够了吗?
我的构建命令是:
"build": "electron-builder build"
这会产生以下内容:
但根本没有提及签名。如果我在皇家身上很愚蠢,请随时指出 ^ _ ^在哪里非常感谢!
更新
- 与GitHub上的项目维护者查询,如果正确设置了变量,请自动进行代码签名,请参阅此处: https://github.com/electron-userland/electron/electron/electron-builder/issues/6895 )
As it says in the title, this is what im trying to do: using windows 10, codesign my electron app using the certificate purchased from a third party vendor (which is in p12 format).
I've read the docs here: https://www.electron.build/configuration/win and here: https://www.electron.build/code-signing
And realise that I need to provide a path to the certificate file and password (if one is set) using the appropriate keys (certificateFile and certificatePassword).
I've also seen these answers:
(There's also loads of questions and answers referring to people building for windows on mac, but that's not what im doing here)
But this doesnt seem to address the question.
These are how the lines in my package.json are set referring to the relevant path/password:
"certificateFile ": "./certificate_file.p12",
"certificatePassword ": "password"
I realise that it is better to have these set in a .env file and read them from there, which I intend to do later. But as I understand it, this should suffice shouldnt it?
My build command is:
"build": "electron-builder build"
And this produces the following:
But there is no mention of signing taking place at all. If Im being royally stupid, please feel free to point out where ^_^ many thanks in advance!
Updates
- Queried with project maintainers on github, code signing is supposed to take place automatically provided the variables are set correctly, see convo here: https://github.com/electron-userland/electron-builder/issues/6895)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它可能是明显更简单地在电子构建器外签名的EXE。在这种情况下,我采用的方法是使用 ssl。 COM的SSL经理GUI 。
您可以向此页面并查看他们对工具的文档在这里。
大约一个星期来调查与电子构建器的代码,但仍然不确定如何做。
使用此工具约5分钟。完毕。
It may be significantly simpler to sign your exe OUTSIDE of electron builder. In which case, the approach I took was to use SSL.com's SSL manager GUI.
You can read about it toward the bottom of this page and see their documentation of the tool here.
About a week looking into codesigning with electron builder, still not entirely sure how to do it.
About 5 mins using this tool. Done.
我不记得整个过程,但是我不得不弄乱了几天才能使它起作用。
在我的package.json文件中,我有一个这样的构建对象:
然后在发布之前,我在Windows PowerShell中运行此对象以设置Env变量:
然后最后:
I don't remember the whole process but I had to fumble around for a few days to get it working.
In my package.json file I have a build object like this:
Then before publishing I run this in windows powershell to set the env variable:
Then finally:
如果您已经有代码签名证书,则可以在
poffage.json
文件中添加以下配置。请记住,密码是您使用openssl的
.cer
文件的导出.pfx
文件的密码If you already have a code signing certificate, then you can add the following configuration in your
package.json
file.Kindly remember, the password is the same password that you've used to export
.pfx
file from.cer
file using openssl