.NET 程序集会改变吗?
我需要提供所有程序集的 32 位 CRC(循环冗余检查),将其存储(用于发布控制目的),然后可以与稍后系统上存在的程序集进行比较(以便检查该版本是否未以某种方式损坏)。
我计算程序集本身的 CRC 没有问题,我的问题是:
.NET 程序集是否会更改?即,程序集安装到目标系统后,其实际二进制内容是否会发生变化(出于任何原因)?如果确实如此,那么 CRC 也会发生变化。
请注意,我仅指与我的软件一起打包的程序集,而不是标准系统程序集,这些程序集未经过检查。
干杯
I have a need to provide a 32-bit CRC (Cyclic Redundancy Check) of all assemblies, which is stored (for release control purposes), and may then be compared against the assemblies present on a system at a later date (in order to check that the release hasn't been corrupted in some way).
I have no problem calculating the CRC of the assemblies themselves, my question is this:
Do .NET assemblies ever change? I.e. Does the actual binary content of the assembly ever change (for any reason) after it is installed on the target system? If it does, then the CRC would change also.
Note, I am referring only to assemblies that are packaged with my software, not the standard System assemblies, those are not checked.
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你正在重新发明一个轮子,强命名已经做到了这一点。篡改程序集以使其具有正确的 CRC32 非常简单。破坏强名称不是,它是加密安全的。
You are re-inventing a wheel, strong naming already does this. Tampering an assembly so that it has the right CRC32 is pretty simple. Breaking a strong name is not, it is cryptographically secure.
如果您不更新程序集(覆盖它们),它们将永远不会改变。
If you don't update the assemblies (overwrite them), they will never change.
它们应该只在安装或更新时更改,除非程序员在他的程序中包含了一些令人讨厌的黑客攻击。但如果您有疑问,为什么不直接撤销用户写入或修改相应文件的权限呢?
They should only change while installation or update, unless a programmer has included some nasty hack into his program. But if you are in doubt, why don't you just revoke the user rights for writing or modifying the according files?
我记得在某处读过,.net 优化器会搜索并遍历任何程序集来“优化”它们?听说它在安装后做了这个 - 但我自己从来没有研究过 - 我想它们可能不会改变,但我不确定它是否真的可以保证你
尝试一下看看!祝你好运
i recall reading somewhere that the .net optimiser searches for and goes through any assemblies to 'optimise' them? heard it did this after an install - never looked into it myself though - id imagine they probably dont change but im not sure if its something you can really guarantee
try it and see! good luck