Abstract: This paper mainly introduces the computer software registration and encryption technology: Software registration and encryption, Windows system software registration and encryption, and shared software network registration methods under the DOS system. Many of the methods described in the text are still being used, and there are also methods and technologies have already been out of time, but most of us worth learning from learning. At the same time as the registration process and method are analyzed, there are many source code to highlight their implementation process.
Keywords: software encryption, software registration, sharing software
introduction
With the development of computer science and technology, computer software discipline has become an important part of computer science, and software products are also important in computer product markets. Due to the reproducibility and tamperization of software products, it can be easily replicated and sold, which seriously damages the legitimate rights and interests of software designers. To this end, the software designers have been unremitting efforts to encrypt their software to ensure that their rights are not violated. They have succeeded, but they have also caused a bad impact on computer security. In order to crack down on piracy, some designers joined "logical bombs" in the program code, and more, it is designed with "suicide" and viruses. Software, when there is a replication operation, use this code to destroy yourself and spread the virus, these moves have threatened the safety of computer systems.
To understand today's popular computer software registration and encryption technology, we must first go deep into the DOS system, deeply understand the principles and implementation methods of software registration and encryption in the DOS environment. Although Windows has already lost its world, DOS has long lost its rays, but many software design ideas based on this platform are worth learning, because it has a Windows system irreplaceable feature: more convenient for hardware operations, software encryption method More diverse is also easier to implement. The emergence of the Windows system has brought new opportunities to software designers: registry, dynamic connection library, multi-threaded technology, and computer networks provide new ways to software registration and encryption. If you can register the software under the system of the two fully different structures, I think, the effect that can be implemented is not comparable.
The focus of this paper is not in the data encryption process, but how to make full use of the characteristics of the operating system and the API provided to make software encryption more secure. Or, for how to achieve data encryption and how to achieve software encryption, we care about the latter. Software encryption and data encryption are different, the method is different, the purpose is also different, but the software encryption does not open the data encryption.
First, software registration and encryption technology under the DOS system
Many shared software have the characteristics: After using a period of time, the user is required to enter the username and registration code. The username is defined by the user, and the registration code needs to obtain the way to the software copyman, after the registration code After the user fills the encoding into the dialog, the software will continue to use, otherwise it will not be able to run. This process is a process of equivalent exchange: the designer gets its value, the user gets the value, the software has become a product. So, how does the software itself know how the user fill in is legal? In fact, it is very simple: the workman and the software itself uses the same set of registration mechanisms, or called "agreement", the user does not know this agreement, so you can't crack the registration code, you can only purchase it from the work. In fact, all registered software has a program code similar to the following:
Program MyProgram (Input, Output);
Function getKey (username, OtherInfo: string): keytype;
Begin
// ...
END;
Function Registered (username, OtherInfor: string; userinput: keytype): boolean
Begin
IF getKey (username, otherinfo) = userinput the begin
RESULT: = TRUE;
EXIT;
END;
Result: = FALSE;
END;
Begin
// ...
IF (not registered) THEN Begin
ShowMessage ('not registered !!');
EXIT;
END;
// ...
End.
In this code, the getKey function is used to generate a registration code through the user's username and some other information, and the registered function is used to return to the user correctly. The above has been mentioned that software encryption is different from data encryption, and software encryption is more focused on data password while focusing on data encryption algorithm. The following is introduced from three aspects to the commonly used encryption technology under the DOS system.
1. Improve encryption using the hidden sector of the disk
This is the oldest encryption technology. Still the above question, why is the software after a while or how many times have been used, will it prompt to register? How can it know how many times the user has used or how many times? We can think this way: When the software is installed, some information about the user legality and installation time is written to the local computer. When running the software in the future, as long as the information is legal, it can be determined that the user will continue Use or register now. This approach also enhances the anti-redeability of the software itself to some extent, as the replica does not find legitimate user information on other machines that have not been installed, and cannot be operated correctly. In a computer device, the most direct place to save the data is the disk, and save these password information is most reliable with the hidden sector of the hard disk. In the hard disk's data structure, the first cylinder of each hard disk logic partition is hidden, and the last few cylinders of the entire physical hard disk are also hidden. Say it is hidden, that is, in the DOS system, the interrupt calls provided by the ordinary int 21H cannot be judged from this part of the area. To operate this part of the hidden disk space, you must pass INT 13h. get on.
The following function code implements the read and write operation of any part of the disk (including hidden sector), which can read the information of a sector into the buffer, and can store the information in the buffer into a sector of the disk. . It is worth noting that this function can only operate with a data area of less than 8.4GB, more than 8.4GB data area requires Int 13 Extension support, not discussed more, interested readers can refer to the "big" written by the author Capacity hard disk read and write operation ". For general hidden sector encryption, use this function is already enough.
#include
#include
Int Diskio (int Drive,
Int Operation,
Unsigned int Cylinder,
Unsigned int head,
Unsigned Short Seig,
Unsigned char * buffer)
{
Union regs regs;
Struct Sregs Sregs;
Regs.h.ah = Operation; regs.h.al = 1;
Regs.x.bx = fp_off (buffer); Sregs.es = fp_seg (buffer);
Regs.h.ch = cylinder; regs.h.cl = sector;
Regs.h.dh = head; regs.h.dl = drive;
INT86X (0x13, & Regs, & Regs, & Sregs);
Return regs.h.ah;
}
Last describes that when the GetKey function in the design software, try to use the hardware information of this unit to generate a password, then deposit it into a hidden sector, so that the password is both confidential and security. 2, use laser perforation method to achieve software anti-copy encryption
This method is mainly implemented by "trap technology" in programming. Basic design ideas are this: in the surface of the floppy disk, the partial sector is damaged, which is physical damage and cannot be repaired with tool software. Before developing software, the designer used a general-purpose detection tool to fully scan the disk surface, find the damaged sector, record them, when designing the software, as long as the software determines if these sectors can be damaged to determine if the software is Has been copied.
For the production of small amounts of software products, this method is not a cost-effective encryption method, but if the software is to be produced, this method becomes more complicated: the location of each perforation is not necessarily, the software should judge The sector number is different, and it is quite difficult, but the design idea is worth reference.
3, special track anti-copy encryption technology
Although laser perforation techniques can achieve a good anti-re-encryption effect, its implementation process is quite complicated. Special track anti-replication encryption technology is simple, and it is also possible to enlighten the software. For the sake of simplicity, only the floppy disk is discussed here.
Usually we discuss the disk sector refers to the data area, in fact, one sector consists of the identification area and the data area, and the two gaps, and some of the tracks (cylinders) are stored in the non-data area. When the DOS system is started, the floppy disk base table is loaded into the memory cell of the start address for 0000: 0525, and many of the operations of INT 13h are based on this base table to determine the sector size. Then, as long as we modify the disk base table, use normal int 13h to operate the disk, it will easily write the software key to the disk sector gap. In general, for this special sector, the disk controller cannot be written on the disk, so that the general replication program cannot be copied, but the key at the clearance can be used in encrypted software programs. Part of the special sector reads, determines whether the software has been copied if the key information is determined.
The following is an example in which a sector length is 4096b is read, and the 0 side of the floppy disk is read, and the read information is stored in a memory cell of the DS segment offset of 1000 h.
C: / windows> Debug
-e0000: 0525
0000: 0525 02.05
3F
.01
-a100
1288: 0100 MOV AX, 201
1288: 0103 MOV BX, 1000
1288: 0106 MOV CX, 0
1288: 0109 MOV DX, 0
1288:
010c
INT 13
1288: 010e INT 3
1288:
010f
-g = 100
Special track encryption is achieved: INT 13H AH = 05h function is formatted to disk according to the parameters of the memory cell points to BX. It has been mentioned above, each sector has an ID, the ID is composed of the column number, the head number, and the sector byte length, then the ID parameter is modified, and the disk is formatted with this strange parameter, it will be generated. Special track. The rest of the work is the same as the special sector: write the key to a special track, you can implement software anti-copy. Below is a C language function that is formatted 360K, DSDD disk track, where the TrkTBL array is stored in the ID parameters of the disk sector.
INT FMT_TRK (int DSK, INT TRK, INT HEAD)
{
Union regs regs;
Struct Sregs Sregs;
Char trktbl [36];
INT I;
For (i = 0; i <9; i ) {TRKTBL [i * 4] = trk;
Trktbl [i * 4 1] = head;
Trktbl [i * 4 2] = i;
Trktbl [i * 4 3] = 2;
}
Regs.h.ah = 0x05; regs.h.ch = trk;
Regs.h.dh = head; regs.h.dl = dsk;
Regs.x.bx = fp_off (trktbl); Sregs.es = fp_seg (trktbl);
INT86X (0x13, & Regs, & Regs, & Sregs);
Return (Regs.h.ah);
}
Second, the software registration encryption technology under the Windows system
1. Use the Windows Registry to implement software registration encryption
I believe that most software use this method to implement registration function. Windows system registry information is quite large, almost all Windows systems and computer system configuration information are saved in the registry. If the software key is written to the registry, then look for key storage locations without having a key, without a certain technique (such as thread tracking, etc.) that cannot be obtained.
The Windows system registration form has six primary keys: hkey_class_root, hkey_current_user, hkey_local_machine, hkey_users, hkey_current_config and hkey_dyn_data. Each primary key is divided into several sub-keys, and each subkey can be newly created, and the entire registration form is a tree structure. Each item has a name and value, the value can be binary, decimal, hexadecimal and string.
The operation of implementing the registry is quite simple. The following Delphi program is used to create a sub-key called Arcobet under the sub-key Software of HKEY_CURRENT_USER and write strings "chenqingyang" into the string.
Unit unit1;
Interface
Uses
Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Registry, Stdctrls
Type
TFORM1 = Class (TFORM)
Button1: tbutton;
Procedure Button1Click (Sender: TOBJECT);
Private
{Private Declarations}
public
{Public declarations}
END;
VAR
FORM1: TFORM1;
IMPLEMENTATION
{$ R * .dfm}
Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);
Var Regs: Tregistry;
Begin
Regs: = tregistry.create;
Regs.RootKey: = HKEY_CURRENT_USER;
IF (NOT Regs.openkey ('Software / Arcobet', False)) THEN
Regs.createKey ('Software / Arcobet');
Regs.writestring ('UserName', 'chenqingyang');
Regs.closekey;
Regs.destroy;
END;
End.
2, special tracking under the Windows system
The basic principle of this method is the same as the special track method under the above DOS. The basic way to solve this problem is to use the virtual device driver "vwin32.vxd", and the VXD is implemented by DeviceioControl, which can complete the various functions of INT 13H, INT 25H, INT 26H. After opening vwin32.vxd via createfile, you can get a control handle to perform various control commands. Open the vwin32.vxd format as follows:
Handle HDevice = CreateFile (".//vwin32", generic_write | generic_read, 0, null, open_existing, 0, null;
After all operations are completed, CloseHandle (HDEVICE) should be used to close the open VWIN32.vxd.
How to read and write disks without discussing this, please refer to the relevant literature.
Third, shared software online registration method introduction
With the development of the Internet, sharing software also appears. Sharing software allows users to purchase software trials and to purchase software online. Sharing software has a biggest benefit is its trial, through the user's free trial, it can feedback to the software author in time, the authors can improve the structure and function of software based on these feedback information. It can be said that shared software provides users with a broader communication space. On the other hand, software purchases also varies more simple, greatly reduces the period of software in the market, making the software version update faster.
Many excellent software such as "Windows Optimization Master" will require user registration to continue to use after being used by the user for a while. At this time, the user should fill in the user name according to the interface prompt, the program will automatically generate a serial number, as long as this serial number and registration fees are mailed to the software author, they can get the registration code, and finally fill the registration code to the software specified. Location and confirmation, the shared software registration process is completed.
In order to facilitate the user's registration, many shared software websites have a service-registered service, which is equivalent to a bridge between users and authors to help their parties are convenient to complete the registration process. Users only need to hand over the serial number and registration fee to the website, and the website regularly transfer the user list, serial number, and registration fee to the author. According to the information sent by the website, it will generate each user's registration code and feedback to the website, the last website. The obtained registration code will then be distributed to each user.
in conclusion
There are still many software encryption registration methods, such as CRC error check, weak position, hard disk lock, software dog, etc., with hardware dogs, etc. In short, as long as we can use the operating system to bring us procedures and interfaces, we can use these interfaces and features to design a good registration encryption method. Interested readers can try it in accordance with the methods introduced here or refer to other documents, I believe this can give you a bigger gain.
references
1. "Software Encryption and Computer Security Technology" Sun Zhaolin Editor-in-Chief China Water Conservancy Press September 2001
2, "DOS programmer reference manual" TERRY DETTMANN Tsinghua University Press, January 1996
3, "For Win9X system under additional track anti-replication technology" Liu Xingping ("Computer Programming Skills and Maintenance" 2000-5)
4, "Windows System Registry is completely proficient" Computer Lovers Magazine in May 2001
5, "Encryption Decryption Method and Example" E-AGE TECHNOLOGY & DEVELOPMENT Beijing Tengrto Electronic Press
6, "Deepening DOS Programming" seeking Bo Jun in 1993
7. "Microsoft Software Developer Network (MSDN)" Microsoft Press, July 20018, "Using Mutual Exclusive Disk Lock Protection Disk Data" Jiang Tian Delivery ("Computer Programming Skills and Maintenance" 2000-10)
9, "DOS6.22 core analysis and memory management technology" Xiao Jinxiu, China Earth Press, January 1998
10,9CBS website: http://www.9cbs.net
11, DDCOPY: Hard Disk Copy Software: http://ddcopy.yeah.net