There are three key points for creating a firmware:
- How to protect objects (Program), Check the license when creating the object ).
- Encrypt/decrypt user information and registration information.
- Program disturbing (obfuscate) or Program Encryption, anti-cracking.
. NET provides basic support for the first two, which is very convenient. Check the license first. The license can be in the form of a general registration code, a registration code for the authentication user name, and a registration code for the authentication user machine. When a user pays for the ware program, the owner of the ware program will send a registration code to the user. (Share-it provides the online registration code generation function. The registration code is automatically generated immediately upon receipt of the money ).
When running the program, ware checks and verifies whether the user has a valid registration code to determine whether the user can execute the program.
. Net programs are object-oriented, so. NET provides an interface for license detection in the object creation mechanism. The development of the ware program can add its own registration code for verification.Algorithm.
The. NET licensing article describes how to detect a license:
[Licenseproviderattribute ( Typeof ( Licfilelicenseprovider )]
Public Class Licensedclass: idisposable
{
Private License license = Null ;
Public Licensedclass ()
{
License = licensemanager. Validate ( Typeof (Licensedclass ), This );
Console. writeline ( "Hello from the licensed class ." );
}
Public Void Dispose ()
{
If (License! = Null )
{
License. Dispose ();
License = Null ;
}
}
}
With such a structure, program development can hand over the detection license to. net, and concentrate on designing how to verify the registration code. Put the aboveLicfilelicenseproviderChange to your own m licenseprovider. For example, to read the Registry without reading the file, see: codeguru: licensed applications using the. NET Framework. Some of my articles are added to Favorites (RSS format ).
Whether it is getting a registration code from a file or from the registry, it contains information about whether the user can run the program, and it must be determined only by the owner of the ware program. Therefore, this information must be encrypted.
. NET provides an asymmetric encryption tool that can be used to process registration codes. Next articleArticle.