简体   繁体   中英

How Can I Prevent My Assembly From Being Saved While Running in Memory?

I am using CodeDom to dynamically compile an assembly in memory

(using CompilerParameters.GenerateInMemory=True) 

and would like to know if there is any way, (using additional VB.NET code in my assembly) to prevent someone from being able to save a copy of the assembly to their desktop while the assembly is still running in memory?

Or is this even possible for the assembly to detect when someone is using some hacker type program to save a copy of my assembly, while its running in memory?

Experts let me know if it is possible and how to accomplish this?

A short answer would be "no". The critical problem with any security-through-obscurity measure is that at some point, the code has to run. In the case of a managed library, this applies to metadata as well (unless you write your own IL to native compiler), because it has to be compiled by the JIT compiler. You can't really stop the "hacker types", because even at the lowest point, they can analyze the native code, and observe the memory directly. True, there's more high-level hackers (and script-kiddies) than low-level hackers, but the point stands.

In case of dynamic assemblies, they're definitely in the memory as well, as you've pointed out yourself. In fact, I believe they have a distinct virtual memory space, so it isn't even that hard to find them in the memory :)

Are you trying to implement some copy protection scheme or something? That is pretty much impossible even with native code, managed code only makes it that much easier to remove the protection :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM