C # serial number embedded in the program

I am writing my own serial number verification / protection for the software that I wrote.

Assuming the serial number verifier uses pattern matching ... as soon as the serial number is verified, how can I change the program itself so that it no longer asks the user for a serial number?

I really do not want to create a separate license file. Is there a way to incorporate this into the program itself? Or the registry is the only other option (besides online verification, etc.).

+4
source share
4 answers

You should not try to edit the program yourself - it will break the signatures / strong name, the exe / dll file will almost certainly be blocked, and even if you make a shadow copy: many users will not have permission to edit it in program files (or as a one-time pressing).

Something external, such as a license file or registry setting, seems appropriate (unless you want to create an application on your server for each client).

+6
source

Is there any way to embed it in the program itself?

If you are hinting at modifying the assembly, then this is possible *, you will need to have two assemblies: one that is currently being executed, and one that you are modifying, because the executing assembly will be locked by the file system, and you need to reserve enough space for storing any new value that you intend to enter.

* To prove this to myself, I created a small executable file that simply writes the string value and uses a hex editor to change the string value.

You need to be smart enough about what changes you made, otherwise registering the software, and then just copying the modified binary to other machines will cost you the registration process.

Storing credentials in the registry is probably much simpler.

+2
source

Personally, I always generate a unique key from the hardware and save it in the registry.

Here is a simple example of a unique key, but you may need to expand it if you need separate keys for different software versions.

http://www.vcskicks.com/hardware_id.php

+2
source

You can save the serial key that was entered into the file or registry, and simply authenticate it whenever the user launches your application.

0
source

Source: https://habr.com/ru/post/1334328/


All Articles