LogoLogo
  • Welcome to Cyphor
  • .NET Code Obfuscation
    • Getting Started
    • How to Obfuscate
    • Basic Code Obfuscation
      • Symbol Renaming
      • Body Mutation
      • Control Flow
      • Constant Encryption
      • Call Hiding
      • Debug Protection
      • Integrity Checks
      • Self Healing
    • Advanced Obfuscation
      • Attribute-Based Obfuscation
      • Guide to obfuscation
      • Code Inlining
      • What is RASP?
      • Protections that protect each other
      • Program not working after obfuscation
      • Keeping performance with obfuscation
      • Virtualization
  • Dashboard
    • Files
    • Billing
      • Pay as you go
      • Examples
    • Projects
      • Code Guard Tasks
      • Permissions
        • Roles
      • Files
      • SAML and SSO
  • Code Guard
    • Introduction
    • Implement with your licensing system
      • Setting up a gateway
      • Setting up the SDK
    • Secured values
      • Dynamic values
      • Code Encryption
        • Page 1
    • Preventing analysis
    • Enhanced visibility
      • Disabling tracing on production
      • Logging external methods
      • Optimizing Memory Usage
    • Edge connectivity
    • Preventing modifications
      • Preventing assembly load
      • Allowing partial tampering
      • Enterprise EDRs and XDRs
      • Dynamic Hook protection
      • Thread hijacking
      • Guard Checksums
      • DLL Injection
      • Handling complex RE attacks
        • Custom payload detection
    • Granular Integrity Checks
    • Virtualized Environments
    • Troubleshooting
    • Threat database
    • Real time alerts
      • Alert Insights
  • CLI Tool
    • Introduction
    • Global options
    • Profiles
    • Projects
    • Obfuscator
      • Obfuscation Schemes
      • Task templates
      • Protecting files
        • Global obfuscation flags
        • Using templates to obfuscate files
        • Quick obfuscation
      • Monitoring obfuscation jobs
    • Securing local storage
Powered by GitBook
On this page
  • Performance: Medium Potency: High Resilience: High
  • Understanding the protection

Was this helpful?

  1. .NET Code Obfuscation
  2. Basic Code Obfuscation

Constant Encryption

PreviousControl FlowNextCall Hiding

Last updated 2 years ago

Was this helpful?

Performance: Medium Potency: High Resilience: High

Understanding the protection

Constant encryption obfuscation is a technique used to encrypt constants in a program, such as string literals, integer values, and other constant types. This is done to make it harder for attackers to access sensitive information and to make the program more difficult to reverse engineer.

It is important to note that constant encryption obfuscation should not be used to protect business critical values such as database passwords or other forms of logins. These values should be stored and managed securely using other methods, and not encrypted within the program code.

The main reasons why constant encryption obfuscation is a good idea for C# or .NET applications are:

  • Protection of sensitive information: By encrypting constants in the program, it makes it harder for attackers to access sensitive information.

  • Improved security: Constant encryption obfuscation can make it harder for attackers to reverse engineer the code and find vulnerabilities to exploit.

  • Resistance to tampering: The encrypted constants are made resistant to tampering, and can detect when they have been modified and prevent the program from running.

Before Obfuscation:

        public static void Main(string[] args) {
          int i, sum = 0, n;
          Console.Write("Enter the Nth Number : ");
          n = int.Parse(Console.ReadLine());
          for (i = 0; i <= n; i++) {
            sum = sum + i;
          }
          Console.WriteLine("\nSum of N Numbers : " + sum);
          Console.ReadLine();
        }

After Obfuscation:

       public static void Main(string[] args) {
          int i, sum = 0, n;
          Console.Write(().());
          n = int.Parse(Console.ReadLine());
          for (i = 0; i <= n; i++) {
            sum = sum + i;
          }
          Console.WriteLine(().() + sum);
          Console.ReadLine();
        }

⏩
🔐
🧠