Plugin

Ben1628Ben1628 Posts: 12
edited July 1, 2010 12:04PM in SmartAssembly 5
Are we able to obsfuscate plugins that are called by the main exe?

What do we need to do to make sure the interface is visible to the main exe?

While we're on this subject, is there anyway we can embed or merge the plugin using smartassembly. Currently, the main exe is loading the dll from a directory, we would like to change it so it is loading it from the embed assembly instead.

Comments

  • Paul.MartinPaul.Martin Posts: 83 New member
    edited July 1, 2010 12:10PM
    You can obfuscate any pure .NET assembly, you just need to create a new SmartAssembly project for the plugin assembly and build it with the protection you want to apply.

    If your plugin is a library (.dll) then SmartAssembly will leave all public interfaces, types and methods visible.
    If your plugin is an executable (.exe) then SmartAssembly will obfuscate (effectively hiding) everything by default.
    You can override the default behavior by using the <ExcludePublicMembers> attribute in the SmartAssembly project file (*.saproj). This enables you to treat EXE files in a similar way to DLL files.

    To exclude public members from obfuscation, specify a value of '1' for the project file:
    &lt;Obfuscation ExcludePublicMembers="1" Obfuscate="1"&gt;...
    &lt;/Obfuscation&gt;
    


    As long as your main exe references the plugin you can embed or merge the plugin.

    If you don't have a reference to the plugin in the executable and can't add one (for instance if you want dynamically choose which plugins to load at runtime) then it is not currently possible to embed or merge the the plugin using SmartAssembly.
    If you can't embed the plugin you can manually do it, see http://www.codeproject.com/KB/DLL/EmbedAssemblyAsResource.aspx, although this is more of a pain to do and doesn't do any encryption or compression on the embedded plugin assembly.
  • Paul.MartinPaul.Martin Posts: 83 New member
    You can obfuscate any pure .NET assembly, you just need to create a new SmartAssembly project for the plugin assembly and build it with the protection you want to apply.

    If your plugin is a library (.dll) then SmartAssembly will leave all public interfaces, types and methods visible.
    If your plugin is an executable (.exe) then SmartAssembly will obfuscate (effectively hiding) everything by default.
    The section "Excluding public members from obfuscation" on our support page http://www.red-gate.com/supportcenter/Content.aspx?c=SmartAssembly\help\5.0\SA_ObfuscatingCode.htm&p=SmartAssembly#o11193 describes how to change the default behaviour.


    As long as your main exe references the plugin you can embed or merge the plugin.

    If you don't have a reference to the plugin in the executable and can't add one (for instance if you want dynamically choose which plugins to load at runtime) then it is not currently possible to embed or merge the the plugin using SmartAssembly.
    If you can't embed the plugin you can manually do it, see http://www.codeproject.com/KB/DLL/EmbedAssemblyAsResource.aspx, although this is more of a pain to do and doesn't do any encryption or compression on the embedded plugin assembly.
Sign In or Register to comment.