如何加密文件,但保持其完整性? [英] How do I encrypt file, yet retain it's integrity?

查看:93
本文介绍了如何加密文件,但保持其完整性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何加密文件,但保持其完整性。例如加密exe并保持其图标?全部在vb.net

解决方案

要添加到其他回复中,请记住它可能对你没有任何好处。



为了执行您的应用程序,它需要使用解密密钥对其进行解密 - 解密密钥无法加密,或者您需要一个未加密的密钥。所以无论你做什么来加密你的应用程序也将释放任何人需要的所有信息,以便用exe解密它...所以它并没有真正保护它,只是让它稍微更难(更明显你真的想要保护它,这可以使一些人更加坚定地绕过它。)


你可以通过使用以下方法来做到这一点。为了保持可执行文件的完整性,有些部分必须保持未加密状态。这些将是一个小型加载器,它能够动态解密加密部分。然后,当双击图标时,加载程序将加密数据读入内存,解密并执行。


您不能加密包含图标资源的整个可执行文件并期望这样资源不受这个过程的影响。



您可能需要的是混淆 [ ^ ]。

How would I go about encrypting a file, but keeping its integrity. e.g. Encrypt exe and keeping its icon? All in vb.net

解决方案

To add to the other replies, do bear in mind that it probably won't do you any good.

In order to execute your application, it will need to decrypt it using the decryption key - which can't be encrypted or you would need an unencrypted key for that. So whatever you do to encrypt your application will also release all the information anyone would need in order to decrypt it with the exe...so it doesn't really protect it, just makes it slightly harder (and more obvious that you really want to protect it, which can make some people even more determined to get round it).


You can do that by using the following approach. To keep the integrity of an executable, there are parts that must remain unencrypted. These will be a small "loader" which will have the ability to decrypt the encrypted part on the fly. Then, when the icon is double clicked, the loader will read the encrypted data into memory, decrypt it and execute it.


You cannot encrypt a whole executable file containing an icon resource and expect this resource is not affected by the process.

What you may need could be obfuscation[^].


这篇关于如何加密文件,但保持其完整性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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