开发者

C# Wrapping an application within another application

开发者 https://www.devze.com 2022-12-27 00:13 出处:网络
I want to secure some applications for some people without teaching them how to add an encryption or authentication, so I thought about mocking up a simple application that launches another applicatio

I want to secure some applications for some people without teaching them how to add an encryption or authentication, so I thought about mocking up a simple application that launches another application if some password or authentication function returns true. How would I wrap the application so that only the launcher would be able to 开发者_如何学编程access the file?


If the wrapped (protected) application is managed, you can embed it as an encrypted byte array, then call Assembly.Load(rawBytes) and use reflection to start the application.
(The application should agree to expose some static method or attribute that launches itself, which you can call using reflection)

Note that you'll still be vulnerable to Reflector, unless you get the decryption key from a web service. (In which case you'll be vulnerable to a combination of Reflector, Fiddler, and a valid password)


You could do a variant of what SLaks suggested that would work for any EXE (.Net or native), and include the EXE as an embedded resource within your application. In your application they could click a button, and your code would then extract the EXE from itself, save it out to a temporary location, and start it with the Process class. Your app would then wait for the Process to finish and delete the temporary file.

This would be as secure as anything else you might do (without a massive amount of effort). A savvy user could locate the EXE file while it's running and make a copy of it, but a savvy user could just extract it from your program easily anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消