如何对由py2exe生成的二进制文件进行数字签名? [英] How to digitally sign a binary produced with py2exe?

查看:135
本文介绍了如何对由py2exe生成的二进制文件进行数字签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用py2exe 0.9.2.2将我所有的python脚本打包到Windows二进制文件中。
我正在尝试将代码符号应用于二进制文件。直接使用signtool会生成损坏的二进制文件。

I use py2exe 0.9.2.2 to pack all my python script into a Windows binary. I'm trying to apply a code sign to the binary. Using signtool directly produces a broken binary.

是否可以对py2exe生成的二进制文件进行签名?
如何?

Is it possible to sign a binary produced with py2exe? How?

推荐答案

这只是我自己找到的解决方案的提醒,因为我找不到

This is just a reminder of the solution I found by myself, because I can't find a specific information on StackOverflow.

该解决方案对py2exe的任何版本均有效。

The solution is valid for any version of py2exe.

可以应用签名证书,但需要将zip库与py2exe的exe加载器分离。因此,在py2exe项目的setup.py中放入 zipfile规范,即:

It is possible to apply a sign certificate but it is needed to detach the zip library from the exe loader of py2exe. So in the setup.py of your py2exe project put the "zipfile" specification, i.e.:

setup(name="name",
      # console based executables
      console=[],

      # windows subsystem executables (no console)
      windows=[myapp],

      # py2exe options
      zipfile = "myapp.lib", # this is the detached zip library code
      data_files = DATA,
      options={"py2exe": py2exe_options},
      )

比起您可以将 .pfx证书应用于二进制加载器:

Than you can apply your ".pfx" certificate to the binary loader:

signtool sign /d "my_description" /du "www.mysite.eu" ^
   /f my_certificate.pfx ^
   /v myapp.exe

这篇关于如何对由py2exe生成的二进制文件进行数字签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆