Fishery
Catch many information here
Archives
- January 2012
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009
- February 2009
- January 2009
-
No Comments
Another possible diversion is using a technique I’ve discussed before: strong-naming your assembly. Unfortunately, the best you can do with strong-naming your assembly is that you can prevent others from reverse-engineering your code and putting your brand on it. It doesn’t prevent others from at least being able to see the underlying code.
-
No Comments
There are a couple of options you may try to prevent a user from reverse-engineering your assembly. In this section, I’ll cover the following techniques:
• Native image generation
• Strong-naming the assembly
• Hiding the implementation via a Web service
• Obfuscation
Native Image Generation
One technique you may try is to create a native image of your assembly. This is done via the ngen tool that comes with .NET. This tool doesn’t work with CIL source files; rather, it takes a .NET assembly and transforms it into a native assembly. For example, you can create a native image of AI.dll as follows:
ngen AI.dll
The tool creates a native image of the assembly, but it puts the result into the Native Image Cache (NIC). You can see what’s in the cache by using the /show argument of ngen:
ngen /show
Unfortunately, the results aren’t what you might expect. The problem is that you still need the original assembly for the client code to run properly. ngen essentially creates implementations of your methods, but the metadata is contained in the original assembly. If you try to run an assembly that uses AI.dll after you employed ngen on it and deleted (or renamed) the source AI.dll, the client will throw a FileNotFoundException.
The runtime will always load the CIL-based assembly, but it’s smart enough to use the native implementations if they exist in the NIC. Therefore, you can’t distribute a native image without the regular assembly. Someone will always be able to reengineer the code like I did before, and if you rename the resulting assembly and target the client to use this new assembly, you can prevent the runtime from using the native implementations.

