DeployLX CodeVeil supports a powerful rule system for selecting and excluding specific members from the obfuscation process. This topic discusses the use of those rules.
Obfuscation is the process of renaming various symbols stored in the meta-data of an assembly to nonsensical values to prevent unauthorized users from reading your source code and reverse-engineering your assemblies.
The names of Types, Methods, Properties, Fields and other assembly members are renamed during the obfuscation stage of the veiling process. This can sometimes cause problems at runtime because .NET expects some classes, resources and other assembly members to follow specific naming conventions to relate to each other. Using obfuscation rules will allow you to easily exclude or include specific symbols from the obfuscation process.
See the What is Obfuscation topic for a complete discussion of obfuscation.
|Rename matching objects||Indicates if types and members that match the rule should be renamed.|
|Pattern||The search pattern for a custom obfuscation selection rule. You can use the * and ? wildcards to match multiple and individual characters.|
|Treat as a regular expression||When selected the Pattern is treated as a regular expression.|
The types of objects to match.
The visibility of the objects to match.
|Comments||Comments and / or notes about the rule.|
CodeVeil considers a number of factors to determine if an assembly member should be obfuscated. Certain types, like auto-serializable types, and members, such as constructors, cannot be renamed and will not be considered when evaluating the rules.
If CodeVeil determines that the member does not have any special naming requirements, then it will first check for explicit obfuscation options selected in the Member Override or defined with Compile Time Attributes. If no explicit option has been applied, then CodeVeil finally considers the assembly defined obfuscation selection rules.
For each assembly member that is evaluated, the full name of the member is resovled. For types this includes the containing namespace and any parent types of nested types. For type members (methods, properties, fields, events) this will include the full name of the parent type followed by the member name. The parameters of a method or property are not included in the full name of the member so you cannot distinguish between overloaded members in a rule.
If the rule pattern matches the full name of the member, then the object type is considered. Finally the visibility of the member is evaluated to determine if it is within the range of visibilities chosen by the rule.
If the member matches all the conditions of the rule then the obfuscation option will be applied to that member. If the rule does not match, evaluation continues through all the custom rules in the assembly. If no custom rules match, then one of the intrinsic rules will be applied.
When no rules match, or there are no custom rules defined, CodeVeil will apply one of the following intrinsic rules.
|When Private Assembly is not selected|
|* | Don't Obfuscate | All Members | All Public||
Excludes all members that are publicly visible (Public, Protected and Protected Internal) from obfuscation.
|* | Obfuscate | All Members | Private||
Include all members that have private visibility (Private, Internal)
|When Private Assembly is selected|
|* | Obfuscate | All Members | All||
Obfuscates all assembly members.
Child members of a member that matches a rule do not automatically match the rule. Instead they follow the same inheritance logic as if the parent member had its obfuscation property set explicitly.
Examine the following class tree. The examples will reference this tree. Private members are shown in a light gray, public in full black.
|*.IInterface* | Obfuscate | All Members | Public||Obfuscates IInterfacePublic, IInterfacePublic.PublicMethod and IInterfacePublic.PublicProperty.|
|*.InternalProperty | Don't Obfuscate | All Members | All||Excludes IInterfaceInternal.InternalProperty and InterfacePublicClassImplicit.InternalProperty from obfuscation.|
|*Public* | Obfuscate | Properties | All||Obfuscates IInterfacePublic.PublicProperty, InterfacePublicClassImplicit.PublicProperty.|