Hi,
How can I prevent someone run a modified executable assembly (ie: modified
with an Hex editor) ??
I use .NET 2.0 and VS 2005.
Steph.
Marc Gravell - 28 Mar 2008 14:43 GMT
In reality, you can't. If they have enough savvy to edit the hex, you have
to assume they have enough to remove any other obstacles. Look at how
quickly games are cracked, and they spend big bucks on trying to prevent it.
The only safe code is code that you don't give to people. For instance, keep
some things on a ring-fenced server accessed with web-service calls or
similar.
Marc
Brian Gideon - 28 Mar 2008 18:56 GMT
> Hi,
>
[quoted text clipped - 4 lines]
>
> Steph.
You can strongly name the assembly.
In a nutshell...your private key is used to encrypt a hash of the
contents of the assembly at compile time. Your public key (or
technically the public key token) is also attached to the assembly.
When the framework loads the assembly it will run the same hash
algorithm and compare it to the decrypted hash that was attached to
the assembly. That hash can be decrypted via the public key.
If you modify the assembly the two hashes will no longer match.
Likewise, if you modify the attached public key the framework will
fail to decrypt the attached hash causing it to be different from the
computed hash.
There is a rumor that you can change a single byte in the assembly to
circumvent all of this in 1.0 and 1.1. Apparently the bug was fixed
in 2.0 and later according to the rumor.
Arne Vajhøj - 28 Mar 2008 19:38 GMT
> How can I prevent someone run a modified executable assembly (ie: modified
> with an Hex editor) ??
Considering that they can decompile your assembly to C# source code
and edit that, then I doubt they will waste time modifying the
binary with a hex editor.
Arne