Software license verification method
By generating a licensee group based on CPUID and MAC address and combining it with key encryption and verification, the security and flexibility issues of traditional licenses are resolved, and multiple security protection and flexible management of licenses are achieved.
Patent Information
- Application Number
- CN202310852612.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2043-07-12
AI Technical Summary
Traditional licenses lack security, are easily cracked or misused, and cannot distinguish functional permissions, affecting user experience and the economic interests of software developers.
By generating a license group based on CPUID, MAC address, and validity period, using key encryption combined with checksum and CRC verification, it is divided into multiple sub-licenses for verification to ensure the security and flexibility of the license.
Improves license security and flexibility, prevents network card damage from affecting permission verification, and supports differentiated management and on-demand function settings.
Smart Images

Figure CN117131471B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software authorization management, and in particular to a software license verification method. Background Art
[0002] Licenses are widely used in software for electronic devices. They are a prerequisite for software use and must be verified and activated to protect the rights of software developers. They also ensure information security and software security, preventing software from being abused or stolen.
[0003] However, traditional licenses have the following problems: 1. They are generated based on a single MAC address or SN code and stored in plain text, without verification or validity period verification, resulting in poor security. 2. MAC is the unique identifier of an electronic device. For example, the MAC address of a network card is unique. If the network card is damaged and needs to be replaced, the MAC address bound to the original license will become invalid. At this time, the user needs to find a buyer to reactivate and bind a new license, which seriously affects the user experience. 3. There is no way to distinguish functional permissions. Different licenses have the same functions, making it impossible to manage users differently.
[0004] In summary, traditional licenses are relatively easy to crack or "greenwash." If a license is cracked, it can lead to significant economic losses for software developers, and key technologies can be easily disclosed or stolen. Furthermore, traditional licenses are inflexible. Therefore, providing a software license verification method to improve the security and flexibility of license usage has become a pressing technical challenge. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a software license verification method to improve the security and flexibility of license use.
[0006] The present invention is implemented as follows: a software Licesen verification method comprises the following steps:
[0007] Step S10: Set a Licensee generation rule, generate a license.cx file based on the Licensee generation rule, and store the license.cx file in the software root directory;
[0008] Step S20: automatically reading the license.cx file from the software root directory when the software is opened;
[0009] Step S30: The software obtains the CPUID of the device, the MAC addresses of all network cards, and the current time;
[0010] Step S40: Decrypt the license.cx file using a preset key to obtain a Licesen string including a Licesen group and a checksum value, and verify the Licesen group based on the checksum value;
[0011] Step S50: Segment the Licesen group to obtain a plurality of sub-Licens;
[0012] Step S60: verify each sub-licesen in turn based on the CPUID, MAC address, and current time until one of the sub-licesens passes the verification;
[0013] Step S70: The software displays a corresponding function menu based on the permission function carried by the verified sub-Licen.
[0014] Furthermore, in step S10, the Licesen generation rule is specifically:
[0015] Obtain the device's CPUID and the MAC addresses of all network cards, set a validity period, generate a Licensen string based on the format of "Licesen group + checksum value", and use the preset key to MD5 encrypt the Licensen string to obtain the license.cx file;
[0016] The format of the Licesen group is "sub-Licesen+delimiter+sub-Licesen+delimiter+sub-Licesen...";
[0017] The format of the sub-license is “CPUID+MAC address+validity period+authority function group+CRC check value”.
[0018] Furthermore, the checksum verification value is the result of performing a checksum calculation on the Licesen group;
[0019] The CRC check value is the result of CRC calculation on the CPUID, MAC address, validity period and permission function group.
[0020] Furthermore, the separator is “;”
[0021] The permission function group includes several permission functions, and each permission function is separated by ",".
[0022] Further, the length of the CPUID is 8 bytes; the length of the MAC address is 6 bytes; and the length of the validity period is 8 bytes.
[0023] Further, the validity period includes a start date and an end date.
[0024] Further, the step S40 specifically includes:
[0025] The license.cx file is decrypted by using a preset key to obtain a Licesen string including a Licesen group and a checksum check value, the Licesen group is subjected to checksum calculation, and it is determined whether the calculation result is consistent with the checksum check value. If yes, the verification is passed, and the step S50 is entered. If no, the verification fails, and the process is ended.
[0026] Further, the step S50 specifically includes:
[0027] The Licesen group is segmented based on a delimiter to obtain a plurality of sub-Licesens.
[0028] Further, the step S60 specifically includes:
[0029] In step S61, a first sub-Licesen is selected, the CPUID, the MAC address, the validity period and the permission function group are intercepted from the sub-Licesen for CRC calculation, and it is determined whether the calculation result is consistent with the CRC check value carried by the sub-Licesen. If yes, the CRC verification is passed, and the step S62 is entered. If no, the CRC verification is not passed, and the verification of the next sub-Licesen is entered.
[0030] In step S62, it is determined whether the CPUID carried by the sub-Licesen is consistent with the locally obtained CPUID. If yes, the CPUID verification is passed, and the step S63 is entered. If no, the CPUID verification is not passed, and the verification of the next sub-Licesen is entered.
[0031] In step S63, it is determined whether the MAC address carried by the sub-Licesen is consistent with the locally obtained MAC address. If yes, the MAC address verification is passed, and the step S64 is entered. If no, the MAC address verification is not passed, and the verification of the next sub-Licesen is entered.
[0032] In step S64, it is determined whether the current time is within the validity period carried by the sub-Licesen. If yes, the validity period verification is passed, and the step S65 is entered. If no, the validity period verification is not passed, and the verification of the next sub-Licesen is entered.
[0033] Step S65: Determine whether the permission function group carried by the sub-licensen is empty. If not, the permission function verification passes, and the process proceeds to step S70; if not, the permission function verification fails, and the process proceeds to the next sub-licensen verification, until one of the sub-licensens passes the verification.
[0034] The advantages of the present invention are:
[0035] Generate a license.cx file through the set Licesen generation rules and store it in the software root directory. When the software is opened, it automatically reads the license.cx file from the software root directory and obtains the device's CPUID, MAC addresses of all network cards, and the current time. The software uses the key to decrypt the license.cx file to obtain the Licesen group and checksum verification value. After verifying the Licesen group based on the checksum verification value, the Licesen group is divided into several sub-Licens. Then, each sub-Licen is verified in turn based on the CPUID, MAC address, and current time until one of the sub-Licens passes the verification. Finally, the corresponding function menu is displayed based on the permission function carried by the verified sub-Licens. That is, the software uses the CPUID and MAC address to verify the license. , validity period, permission function group, CRC checksum checksum value generates a Licensesen string and uses key encryption to obtain the license.cx file. The structure is more complex than the traditional license and uses key encryption to prevent it from being stolen in plain text. Combined with the verification of checksum, CRC, CPUID, MAC address, validity period and permission function group, seven security measures are taken before and after, which greatly improves the security of license use. By generating corresponding sub-Licesen based on different MAC addresses, as long as one of the sub-Licesen verification passes, it can avoid the situation where one of the network cards is damaged and affects the permission verification. By setting a permission function group containing several permission functions, each permission function can be set as needed to match different management needs, which ultimately greatly improves the flexibility of license use. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0037] Figure 1 The present invention is a flowchart of a software Licesen verification method. DETAILED DESCRIPTION
[0038] The technical solution in the embodiments of the present application has the following overall concept: through the verification of checksum, CRC, CPUID, MAC address, validity period and permission function group, combined with key encryption, seven security measures are taken before and after to improve the security of license use; by generating corresponding sub-licenses based on different MAC addresses, as long as one of the sub-licenses passes the verification, it is sufficient to avoid the situation where one of the network cards is damaged and affects the permission verification. By setting a permission function group containing several permission functions, each permission function can be set as needed to match different management requirements, thereby improving the flexibility of license use.
[0039] Please refer to Figure 1 As shown, a preferred embodiment of a software Licesen verification method of the present invention includes the following steps:
[0040] Step S10: Set a Licensee generation rule, generate a license.cx file based on the Licensee generation rule, and store the license.cx file in the software root directory;
[0041] Step S20: automatically reading the license.cx file from the software root directory when the software is opened;
[0042] Step S30: The software obtains the CPUID of the device, the MAC addresses of all network cards, and the current time;
[0043] Step S40: Decrypt the license.cx file using a preset key to obtain a Licesen string including a Licesen group and a checksum value, and verify the Licesen group based on the checksum value;
[0044] Step S50: Segment the Licesen group to obtain a plurality of sub-Licens;
[0045] Step S60: verify each sub-licesen in turn based on the CPUID, MAC address, and current time until one of the sub-licesens passes the verification;
[0046] Step S70: The software displays a corresponding function menu based on the permission function carried by the verified sub-Licen.
[0047] In step S10, the Licesen generation rule is specifically:
[0048] Obtain the device's CPUID and the MAC addresses of all network cards, set a validity period, generate a Licensen string based on the format of "Licesen group + checksum value", and use the preset key to MD5 encrypt the Licensen string to obtain the license.cx file;
[0049] The format of the Licesen group is "sub-Licesen+delimiter+sub-Licesen+delimiter+sub-Licesen...";
[0050] The format of the sub-license is “CPUID+MAC address+validity period+authority function group+CRC check value”.
[0051] The checksum verification value is the result of performing checksum calculation on the Licesen group;
[0052] The CRC check value is the result of CRC calculation on the CPUID, MAC address, validity period and permission function group.
[0053] The separator is ";"
[0054] The permission function group includes several permission functions, and each permission function is separated by ",".
[0055] The length of the CPUID is 8 bytes; the length of the MAC address is 6 bytes; and the length of the validity period is 8 bytes.
[0056] The validity period includes the starting year, month, and day and the ending year, month, and day.
[0057] An example of the Licesen string in plain text is as follows:
[0058] CPUID+MAC1+starting year, month, and day+ending year, month, and day+authority function+CRC checksum;
[0059] +CPUID+MAC2+starting year, month, and day+ending year, month, and day+authority function+CRC checksum;
[0060] +CPUID+MAC3+starting year, month, and day+ending year, month, and day+authority function+CRC checksum;
[0061] +checksum verification value.
[0062] The generation process of the license.cx file is as follows:
[0063] Get the device's 8-byte CPUID: BF-EB-FB-FF-00-08-06-EB;
[0064] Get the 6-byte MAC addresses of all network cards in the device:
[0065] (MAC1:10-5B-AD-05-02-01,
[0066] MAC2:92-5B-AD-05-6F-37,
[0067] MAC3:E8-6A-64-F4-B1-ED)
[0068] Set the validity period to 8 bytes: 2023050120241230, which means the validity period is from May 1, 2023 to December 30, 2024.
[0069] Set the permission function of Licesen. The length is determined by the number of permission functions, such as: function1, function2, function3, which means that this licesen has the functions of function1, function2, and function3 (function represents the function code in the software, which is an integer type, such as 01 for user management, 02 for test operation, 03 for solution management, etc.).
[0070] Concatenate CPUID+MAC1+start year-month-day+end year-month-day+authorization function to obtain BFEBFBFF000806EB105BAD0502012023050120241230010203. Perform CRC calculation on the concatenated string to obtain the CRC check value: 98AD.
[0071] Concatenate the concatenated string and CRC checksum to get the first sub-Licesen:
[0072] BFEBFBFF000806EB105BAD050201202305012024123001020398AD;
[0073] Similarly, the second and third sub-Licens of MAC2 and MAC3 are obtained, and the first, second and third sub-Licens are concatenated with “;” to obtain the Licesen group: BFEBFBFF000806EB105BAD050201202305012024123001020398AD; BFEBF BFF000806EB925BAD056F3720230501202412300102039424; BFEBFBFF000806EBE86A64F4B1ED202305012024123001020358EF;
[0074] Perform checksum calculation on the Licesen group to obtain the checksum verification value, concatenate the Licesen group and the checksum verification value and encrypt them with the key to obtain the license.cx file.
[0075] The step S40 is specifically as follows:
[0076] The license.cx file is decrypted using MD5 using a preset key to obtain a Licesen string including a Licesen group and a checksum value. A checksum is calculated for the Licesen group to determine whether the calculation result is consistent with the checksum value. If so, the verification passes and the process proceeds to step S50; if not, the verification fails and the process ends.
[0077] The step S50 is specifically as follows:
[0078] The Licesen group is divided based on a separator to obtain a plurality of sub-Licens.
[0079] The step S60 specifically includes:
[0080] Step S61: Select the first sub-licensen, extract the CPUID, MAC address, validity period, and permission function group from the sub-licensen, perform CRC calculation, and determine whether the calculation result is consistent with the CRC check value carried by the sub-licensen. If so, the CRC verification passes, and the process proceeds to step S62; if not, the CRC verification fails, and the process proceeds to the next sub-licensen verification; identify the CPUID, MAC address, validity period, permission function group, and CRC check value based on the length and position of each field;
[0081] Step S62, judging whether the CPUID carried by the sub Licesen is consistent with the CPUID obtained locally, if yes, the CPUID verification is passed, entering step S63; if not, the CPUID verification is not passed, entering the verification of the next sub Licesen;
[0082] Step S63, judging whether the MAC address carried by the sub Licesen is consistent with the MAC address obtained locally, if yes, the MAC address verification is passed, entering step S64; if not, the MAC address verification is not passed, entering the verification of the next sub Licesen;
[0083] Step S64, judging whether the current time is within the validity period carried by the sub Licesen, if yes, the validity period verification is passed, entering step S65; if not, the validity period verification is not passed, entering the verification of the next sub Licesen;
[0084] Step S65, judging whether the permission function group carried by the sub Licesen is empty, if not, the permission function verification is passed, entering step S70; if not, the permission function verification is not passed, entering the verification of the next sub Licesen, until one of the sub Licesens is verified. That is, as long as one of the sub Licesens is verified, the verification efficiency can be improved, and the problem of Licesen invalidation due to the replacement of a network card can be solved.
[0085] In summary, the advantages of the present application are:
[0086] Generate a license.cx file through the set Licesen generation rules and store it in the software root directory. When the software is opened, it automatically reads the license.cx file from the software root directory and obtains the device's CPUID, MAC addresses of all network cards, and the current time. The software uses the key to decrypt the license.cx file to obtain the Licesen group and checksum verification value. After verifying the Licesen group based on the checksum verification value, the Licesen group is divided into several sub-Licens. Then, each sub-Licen is verified in turn based on the CPUID, MAC address, and current time until one of the sub-Licens passes the verification. Finally, the corresponding function menu is displayed based on the permission function carried by the verified sub-Licens. That is, the software uses the CPUID and MAC address to verify the license. , validity period, permission function group, CRC checksum checksum value generates a Licensesen string and uses key encryption to obtain the license.cx file. The structure is more complex than the traditional license and uses key encryption to prevent it from being stolen in plain text. Combined with the verification of checksum, CRC, CPUID, MAC address, validity period and permission function group, seven security measures are taken before and after, which greatly improves the security of license use. By generating corresponding sub-Licesen based on different MAC addresses, as long as one of the sub-Licesen verification passes, it can avoid the situation where one of the network cards is damaged and affects the permission verification. By setting a permission function group containing several permission functions, each permission function can be set as needed to match different management needs, which ultimately greatly improves the flexibility of license use.
[0087] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A software Licesen verification method, characterized by: The steps include: Step S10: Set a Licensee generation rule, generate a license.cx file based on the Licensee generation rule, and store the license.cx file in the software root directory; the Licensee generation rule is specifically: Obtain the device's CPUID and the MAC addresses of all network cards, set a validity period, generate a License string based on the "Licesen group + checksum" format, and use a preset key to MD5 encrypt the License string to obtain the license.cx file; The format of the licensen group is "sub-licesen+delimiter+sub-licesen+delimiter+sub-licesen..."; The format of the sub-license is "CPUID+MAC address+validity period+authority function group+CRC check value"; Step S20: automatically reading the license.cx file from the software root directory when the software is opened; Step S30: The software obtains the CPUID of the device, the MAC addresses of all network cards, and the current time; Step S40: Decrypt the license.cx file using a preset key to obtain a Licesen string including a Licesen group and a checksum value, and verify the Licesen group based on the checksum value; Step S50: Segment the Licesen group to obtain a plurality of sub-Licens; Step S60: verify each sub-licesen in turn based on the CPUID, MAC address, and current time until one of the sub-licesens passes the verification; Step S70: The software displays a corresponding function menu based on the permission function carried by the verified sub-Licen.
2. A software Licesen verification method according to claim 1, characterized in that: The checksum verification value is the result of performing checksum calculation on the Licesen group; The CRC check value is the result of CRC calculation on the CPUID, MAC address, validity period and permission function group.
3. A software Licesen verification method according to claim 1, characterized in that: The delimiter is ";" The permission function group includes several permission functions, and each permission function is separated by ",".
4. A software Licesen verification method according to claim 1, characterized in that: The length of the CPUID is 8 bytes; the length of the MAC address is 6 bytes; and the length of the validity period is 8 bytes.
5. A software Licesen verification method according to claim 1, characterized in that: The validity period includes the starting year, month, and day and the ending year, month, and day.
6. A software Licesen verification method according to claim 1, characterized in that: The step S40 is specifically as follows: The license.cx file is decrypted using MD5 using a preset key to obtain a Licesen string including a Licesen group and a checksum value. A checksum is calculated for the Licesen group to determine whether the calculation result is consistent with the checksum value. If so, the verification passes and the process proceeds to step S50; if not, the verification fails and the process ends.
7. A software Licesen verification method according to claim 1, characterized in that: The step S50 is specifically as follows: The Licesen group is divided based on a separator to obtain a plurality of sub-Licens.
8. A software Licesen verification method according to claim 1, characterized in that: The step S60 specifically includes: Step S61: Select the first sub-licensen, extract the CPUID, MAC address, validity period, and permission function group from the sub-licensen, perform CRC calculation, and determine whether the calculation result is consistent with the CRC check value carried by the sub-licensen. If so, the CRC verification passes, and the process proceeds to step S62; if not, the CRC verification fails, and the process proceeds to the next sub-licensen verification. Step S62: Determine whether the CPUID carried by the sub-license is consistent with the CPUID obtained locally. If so, the CPUID verification passes, and the process proceeds to step S63; if not, the CPUID verification fails, and the process proceeds to the next sub-license verification. Step S63: Determine whether the MAC address carried by the sub-licensen is consistent with the locally obtained MAC address. If so, the MAC address verification passes, and the process proceeds to step S64; if not, the MAC address verification fails, and the process proceeds to the next sub-licensen verification. Step S64: Determine whether the current time is within the validity period carried by the sub-license. If so, the validity period verification is successful, and the process proceeds to step S65; if not, the validity period verification fails, and the process proceeds to the next sub-license verification. Step S65: Determine whether the permission function group carried by the sub-licensen is empty. If not, the permission function verification passes, and the process proceeds to step S70; if not, the permission function verification fails, and the process proceeds to the next sub-licensen verification, until one of the sub-licensens passes the verification.
Citation Information
Patent Citations
Software licensing protection method
CN107391971A
Software License verification method and system based on filtering, intercepting and encrypting technologies
CN113486305A