Custom Attributes
Last updated
Was this helpful?
Last updated
Was this helpful?
Babel supports declarative obfuscation using the custom attributes and provided by the .NET Framework and .NET.
The System.Reflection.ObfuscateAssemblyAttribute, is an assembly-level attribute that instructs Babel Obfuscator to use obfuscation rules reserved for private assemblies.
A private assembly is an assembly that will not be used as a library: no other software components will use the assembly. Babel fully obfuscates private assemblies, which will rename all public symbols.
The Boolean constructor argument assemblyIsPrivate=true tells Babel that the assembly is used within the scope of one application and the public interface can be safely renamed.
The System.Reflection.ObfuscationAttribute attribute can be used on assembly members like types, methods, events, properties and fields to configure the action taken for a specific obfuscation feature.
The Obfuscation attribute has the following properties:
The Feature property maps a string value to a specific obfuscator feature or a list of features. The default value for the Feature property is “all”.
Please refer to the obfuscation to know more.
Indicates whether the obfuscation feature should be excluded for the associated member.
Specifies whether the action taken by the obfuscator for the associated type should be applied to all its members.
Specifies whether the attribute should be removed after processing.
The following code example shows how ObfuscationAttribute can be used to target a method to enable code encryption:
Babel Obfuscator supports an extended syntax for feature strings that will allow setting feature properties as a list of key-value pairs after the name of each feature.
The extended Feature syntax will allow setting the ObfuscationAttribute at the assembly level to configure features for the entire assembly:
Disable the obfuscation Agent for Serializable types and Reflected enum tasks.
Encrypts values and arrays of methods having several instructions between 10 and 100.
The Obfuscation attribute alone is not sufficient to activate the chosen feature. The attribute can only function if the feature is globally enabled in the configuration.
Do not obfuscate compiler-generated code.