我准备了一个应用程序和网站,客户可以在下载之前为此应用程序设置多个选项.设置以二进制格式存储在文件末尾(附加),然后编辑的文件将发送给最终用户.问题是文件"内容"的更改将破坏文件签名 - 是否有机会使用任何命令行工具重新签名此更改的文件?我曾尝试使用微软的SignTool,但它在Linux上无法正常运行.
我想在C#中实现这个
我看过这里:http: //www.codeproject.com/KB/cpp/PEChecksum.aspx
并且我知道ImageHlp.dll MapFileAndCheckSum函数.
但是,出于各种原因,我想自己实现.
我找到的最好的是:http: //forum.sysinternals.com/optional-header-checksum-calculation_topic24214.html
但是,我不明白这个解释.任何人都可以澄清如何计算校验和吗?
谢谢!
更新
我从代码示例中,我不明白这意味着什么,以及如何将其转换为C#
sum -= sum < low 16 bits of CheckSum in file // 16-bit borrow
sum -= low 16 bits of CheckSum in file
sum -= sum < high 16 bits of CheckSum in file
sum -= high 16 bits of CheckSum in file
Run Code Online (Sandbox Code Playgroud)
更新#2
谢谢,遇到了一些Python代码,不会太相似这里
def generate_checksum(self):
# This will make sure that the data representing the PE image
# is updated with …Run Code Online (Sandbox Code Playgroud)