views:

271

answers:

3

I'm using Xenocode and want to obfuscate the main application (A.exe + B.dll) and, separately, a plug-in component "P.dll" which references B.dll. So I have two Xenocode projects with the same passphrase. For "A/B" I select to obfuscate all B classes/methods/etc. (using a filter B.*) . Then for the plug-in I select to obfuscate all "Type References" using the same filter "B.*".

The main app loads P.dll with Assembly.Load, but gives a C++ exception [rethrow] at 0x000000 when trying to instantiate a type exported from P.

I tried a simpler version of "P" which only references one B type, and it only works when I disable obfuscation of reference to "B.type..ctor". ( ".ctor" does not appear as an option when selecting obfuscation of B itself in the "A/B" project). However this is useless for the real P.dll which references dozens of types from B.

Is there a known trick for matching obfuscation of assemblies referencing each other?

A: 

You should obfuscate all .NET assemblies together, and you should not obfuscate any types that are externally exposed to others (Like another obfuscated program).

The obfuscation process renames types and all type references, but renaming of references doesn't work for your plugin structure.

thijs
A: 

As said by 'thjis', you need to obfuscate both your assemblies together - this is the only way to ensure issue-free 'matching obfuscation of assemblies referencing each other'. Also, exclusion of type references will not work always as you found it - for example, a constructor requires its name to be .ctor.

You need to use an obfuscator which supports corr-assembly obfuscation. Crypto Obfuscator is one such.

logicnp
+1  A: 

Either you disable public types renaming or that you apply cross assembly obfuscation for all assemblies at once. Most likely cross assembly obfuscation renames public types that are referenced by your plugin dll, since those references don't get renamed during the obfuscation process of A/B the plugin dll fails to load. Another idea that comes into my mind is to merge the assemblies first and then obfuscate a single dll, CliSecure is one product who is capable doing that.

Roger Smith