How to protect .NET code from reverse engineering

How to protect .NET code from reverse engineering using net reactor, eziriz, obfuscation

Step 1Click New Project, then select Visual C# on the left, then Windows and then select Class Library. Name your project "MyMath" and then click OK

math c#Step 2Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "NetReactor" and then click OK

c# reflectorStep 3Design your form as below

c# math

Step 4: Add a MyMath class to the MyMath library

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyMath
{
    public class Math
    {
        public int Add(int a, int b)
        {
            return a + b;
        }

        public int Sub(int a, int b)
        {
            return a - b;
        }

        public int Mul(int a, int b)
        {
            return a * b;
        }

        public double Div(double a, double b)
        {
            return a / b;
        }
    }
}

Step 5: Add code to handle your form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NetReactor
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            txtResult.Text = string.Format("a+b={0}", new MyMath.Math().Add(Convert.ToInt32(txta.Text), Convert.ToInt32(txtb.Text)));
        }

        private void btnSub_Click(object sender, EventArgs e)
        {
            txtResult.Text = string.Format("a-b={0}", new MyMath.Math().Sub(Convert.ToInt32(txta.Text), Convert.ToInt32(txtb.Text)));
        }

        private void btnMul_Click(object sender, EventArgs e)
        {
            txtResult.Text = string.Format("a*b={0}", new MyMath.Math().Mul(Convert.ToInt32(txta.Text), Convert.ToInt32(txtb.Text)));
        }

        private void btnDiv_Click(object sender, EventArgs e)
        {
            txtResult.Text = string.Format("a:b={0}", new MyMath.Math().Div(Convert.ToDouble(txta.Text), Convert.ToDouble(txtb.Text)));
        }
    }
}

Download .Net Reactor tool to protect your code. .NET Reactor is a powerful code protection and software licensing system for software written for the .NET Framework, and supports all languages that generate .NET assemblies

Why you need to protect your intellectual property

When you compile a program written for the Microsoft .NET framework, the program you provide to your users is not compiled into a native executable program, but instead is translated into something called the Common Intermediate Language instructions (CIL). CIL is half way between source code and native code, and is interpreted by the .NET framework when your program is run, rather than executed directly as machine code. Because of this, the source code of your application or library can be easily reproduced.

So why is obsfucation not enough?

Obfuscation is the process of making your source code more difficult (but not impossible) for humans to understand. Obfuscation works by replacing the meaningful names you assign to classes, methods, properties and variables with meaningless ones.

For example, it may replace a variable name of "counter" with "F6DF3CV89X" - to humans these obfuscated names are confusing and difficult to remember, but have no effect on the NET Framework interpreter. Note that obfuscation does nothing to the source code within your methods, so it is not protected at all by obfuscation. .NET Reactor does everything an obfuscator does, but then wraps your intellectual property in several more layers of protection, denying access to your source code to even those who are determined to steal your hard work.

.NET Reactor prevents decompilation by a variety of methods which convert your .NET assemblies into processes which no existing tool can decompile. .NET Reactor builds a native code wall between potential hackers and your .NET assemblies by producing a file which cannot be understood directly as CIL. Because the CIL in your assembly is emitted intact only at run time or design time, no tool is capable of decompiling .NET Reactor protected assemblies.

VIDEO TUTORIAL