Home - Forums-.NET - Spices.Net - Exclude entire namespace from obfuscation?

Spices.Net

NET code security, tools to protect, obfuscate, tamper defense, code and data safety, recover, convert, optimize, explore, browse and analyze .Net software.

This forum related to following products: Spices.Net Suite, Spices.Net Obfuscator, Spices.Net Decompiler

Exclude entire namespace from obfuscation?
Link Posted: 27-Dec-2005 10:15
Hello,

I'd like to use "full" obfuscation for an assembly, but keep the obfuscator from renaming any public types in a given namespace within it. How can I achieve this using the project file (.iloprj)? Spices.Net UI doesn't let me pick "Namespace" for "MemberInfoType" member property in the "Excludes" list...

Thanks,
Pavel.
Link Posted: 13-Jan-2006 08:47
Now it is not possible via Excludes list of spices.Project,
but you can exclude all members of certain namespace by attaching NotObfuscateMembersAttribute to the assembly attributes.
Source code (c#, vb, pas) and examples of usage of this attribute you can find in the \SDK folder.
Example [c#] that shows hoat to exclude all members of MyCompany.MyNamespace  from obfuscation:

[assembly:NineRays.Obfuscator.NotObfuscateMembersAttribute("MyCompany.MyNamespace.*")]
Link Posted: 13-Jan-2006 09:22
[quote="NineRays"]Now it is not possible via Excludes list of spices.Project,
but you can exclude all members of certain namespace by attaching NotObfuscateMembersAttribute to the assembly attributes.
Source code (c#, vb, pas) and examples of usage of this attribute you can find in the \SDK folder.
Example [c#] that shows hoat to exclude all members of MyCompany.MyNamespace  from obfuscation:

[assembly:NineRays.Obfuscator.NotObfuscateMembersAttribute("MyCompany.MyNamespace.*")]


Well, I DO want to obfuscate them, but I do not want the types themselves renamed - they are loaded at runtime via reflection. In other words, all private and internal fields/properties/methods of a type should be obfuscated, but the type name, its public methods, and the namespace name it resides under should remain unchanged.

Also, does NotObfuscateMembersAttribute support more complex wildcards that just ".*"? Regular expressions, perhaps?

Is it possible to achieve the effect of NotObfuscateMembersAttribute via the project file? I would prefer not to tie our source code to any specific obfuscator product...

Thanks!
Link Posted: 13-Jan-2006 09:37
Well, I DO want to obfuscate them, but I do not want the types themselves renamed - they are loaded at runtime via reflection. In other words, all private and internal fields/properties/methods of a type should be obfuscated, but the type name, its public methods, and the namespace name it resides under should remain unchanged.


If these types is public types you can use ObfuscationOptions.Members = KeepSerialization predefine in the assembly obfuscation settings of Spices.Project.
In this case classes that probably is used in serialization and their's public members will untouchable, but private/internal members will obfuscated.