views:

117

answers:

8

I have a console application references assembly A. I want to ensure that the application will not run if A.dll is tampered or replaced.

One option is to use strong-name signing. But do I need to worry about strong name bypass?

Are there any other good options?

Thanks

+5  A: 

If you can build the protection, a hacker can break it. Don't worry too much about preventing tampering, the guys who can break it in a heartbeat probably won't care, and even if they did, almost nothing you could do would deter them.

The best advice would be to license a product that's built by a team specifically for the purpose of protecting your applications in this way. Just like with cryptography, it's usually best not to roll your own.

jMerliN
A: 

Have you considered static linking?

TMN
A: 

According to the author of that page:

Instead, for integrety checking, you really need to use Authenticode signatures.

compie
A: 

What you need is products like www.red-gate.com/products/smartassembly/ , and there're plenty of such products. However, they only protect your assembly to certain extent, none is 100% safe.

VOX
A: 

Do what web browsers do and rely on a certificate from a trusted third party.

Gary
+1  A: 

You can use an MD5 hash of your dll, but even that's not terribly foolproof because anyone who wants to break your app will just use a reflector and find out what you're really doing and probably just modify your program straight-up. You can get code obfuscators that will help with that, but nothing is perfectly hack-proof. It's really a trade off - what is your value of preventing someone from changing your dll? What is the likelihood that someone will? and how much will it cost you in terms of time = money to protect against that?

Wayne Werner
A: 

Actually, do not even try to anyhow defend your code / assembly, or whatever else. I mean, if it is possible (and it is designed) to be run on a computer, for public and such, it is impossible to protect it - you can do WHATEVER you want on your own computer, with good tools and such you deassemble it in a second.

So, don't try, you will just waste your time.

Aurel300
A: 

Can't be, impossible.

Erik Escobedo