Constant Encryption


This protection encodes and compresses the constants (numbers, strings and initializers) in the code.


With the © Smart Native Protection System mode the constants are decrypted with the module verification sum, this system ensures the integrity of the applications.


This protection is available in the editions:

Community Professional Enterprise Admits © Smart Native Protection System

Parameters

This option is only available in the professional and enterprise editions.


Elements: Determine what type of constants will be encoded.

  • S Strings
  • N Numeric
  • P Primitives
  • I Matrix Initializers

They can all be combined or selected individually.

Modes

  • Normal: Protect the constants with the checksum of the method and its name.

Ensures the integrity of the code, after this protection you will not be able to modify the code or rename the methods.

  • © Smart native protection system. Enterprise: Protect the constants with the verification sum of the method and its name using native functions that prevent the constants from being debited or decryption methods invoked.

Ensures the integrity of the code, after this protection you will not be able to modify the code or rename the methods.

It may be incompatible with xamarin.

Code example

  • Before
var key = "https://www.dotnetsafer.com";
string password = "admin";
Console.WriteLine($"key: {key}, password: {password}");
Console.ReadKey();
  • After
string text = <Module>.get_Condition(VARFLAG_FREPLACEABLE[(94010 < 500724) ? 0 : 537936],unchecked(checked(unchecked(570830 - -870451) + ConcurrentDictionary__2.TargetedPatchingOptOutAttribute);
<Module>.init(text,(Convert.ToInt32( " 1000011100000110110 ", 2) | 250883 * 2) ^ Marshal.SizeOf(typeof(MoveBufferArea)));

string text2 = <Module>.get_Condition((int) array2[((62301 < 630141) ? -255426 : -270726) + (83010 | 172416)],(ConcurrentDictionary__2.add_ReflectionOnlyNamespaceResolve * checked((array[6] >>
(6 | 4)) - unchecked(833425 + -830673) * Convert.ToInt32( " 334 ", 8)));
<Module>.init(text2,((18665 % 7466 > Convert.ToInt32( " fffd0bb9 ", 16)) ? 1 : 0) == 0 / 2133));

Console.WriteLine($" key: {text}, password: {text2} ");
Console.ReadKey();

Exclusions

  • Exclude with attribute

    Include this attribute in your source code:

[Obfuscation(Exclude = true, Feature = "Constants")]
  • Exclude from the interface

    You can exclude this protection from the methods or classes you want.

Compatibility

Platform Compatibility
.NET Framework Full compatibility, compatible versions: 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, 4.0, 3.5, 3.0, 2.0.
ASP .NET Full compatibility, compatible versions: 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, 4.0, 3.5, 3.0, 2.0.
Windows Phone Compatibility subject to the version of the framework, compatible in general aspects.
WPF Full compatibility, available in all versions.
SQL CLR Applications Compatibility subject to the version of the framework, compatible in general aspects.
Silverlight Compatibility subject to the version of the framework, compatible in general aspects.
Xamarin.iOS Partial compatibility, compatible versions: 10.8. Xamarin is not fully adapted in dotnetsafer
Xamarin.Mac This version is under development, availability has not been checked.
Xamarin.Andoid This version is under development, availability has not been checked.
.NET Core Full compatibility, compatible versions: 3.1, 3.0, 2.2, 2.1, 2.0.
.NET Standard Library Full compatibility, compatible versions: 2.1, 2.0.
Unity Compatibility subject to the version of the framework, compatible in general aspects.
UWP Compatibility subject to the version of the framework, compatible in general aspects.
Satellite Assembly Suppor Compatibility subject to the version of the framework, compatible in general aspects.
WinRT Compatibility subject to the version of the framework, compatible in general aspects.
Integrated ClickOnce Compatibility subject to the version of the framework, compatible in general aspects.
Managed C++ (Mixed Mode) Assembly Support Compatibility subject to the version of the framework, compatible in general aspects.