An offline product license generation and validation method
Patent Information
- Application Number
- CN202410021973.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2044-01-05
AI Technical Summary
离线许可证也存在容易被破解的缺点,如果被破解,会导致盗版和未授权使用、重要数据和资料泄露、恶意软件和病毒传播等危险情况发生
[0046]本发明通过加强许可证生成的复杂性和随机性来加强破解难度,提升了离线的许可证的安全性,进而减少非法修改软件的可能性,降低潜在的安全漏洞和恶意软件的风险;
Smart Images

Figure CN117874718B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of license issuance technology, and more specifically, to an offline product license generation and verification method. Background Technology
[0002] An offline license is a type of software license that allows users to use software without a continuous internet connection. It is suitable for software that needs to operate or be accessed in an environment without a network connection.
[0003] Generally, in a networked environment, users first request an offline license from the software vendor through a specific authorization method. The software vendor generates an offline license file, which contains the user's license information and usage rights. The user then deploys this offline license file to the target device in the offline environment, such as copying it to a computer without a network connection. In the offline environment, the software reads and verifies the offline license file to confirm the validity of the user's license. However, offline licenses are also vulnerable to cracking. If cracked, this can lead to dangerous situations such as piracy and unauthorized use, leakage of important data and information, and the spread of malware and viruses.
[0004] Therefore, it is necessary to optimize the generation of licenses, increase the difficulty of cracking them, and thus enhance their security. Summary of the Invention
[0005] The purpose of this invention is to provide an offline product license generation and verification method, which can increase the difficulty of cracking the license and thus enhance its security.
[0006] The embodiments of the present invention are achieved through the following technical solutions:
[0007] This invention first provides an offline product license generation method, including the following steps:
[0008] Obtain the CPU model number, hard drive UUID code, and product serial number, and concatenate them in order to obtain the first string;
[0009] The first string is divided into n substrings based on its length, and each substring is numbered sequentially to obtain a sequence code.
[0010] Randomly sort the n substrings to obtain the second string;
[0011] Generate an encryption method pool, which includes m encryption methods, and assign an encryption code number to each encryption method;
[0012] For each substring, an encryption method is randomly selected from the encryption method pool to encrypt it, resulting in a sub-encryption string and a sub-key string. The corresponding encryption code number is obtained, and the number of characters in the substring and the encryption code number are concatenated into the sequential encoding of the substring to obtain the sub-encoded information string.
[0013] The first key, the second key, and the disordered encryption string are obtained based on the sub-encoded information string, the sub-key, and the sub-encryption string;
[0014] The first key, the second key, and the out-of-order encrypted string are placed in the product license template file and issued as a license.
[0015] Preferably, the method for obtaining the first key, the second key, and the disordered encryption string based on the sub-encoded information string, the sub-key, and the sub-encryption string is as follows:
[0016] The first key is obtained by concatenating the sub-encoded information string according to the order of the substrings in the second string;
[0017] The subkey string is concatenated according to the order of the substrings in the second string, with delimiters connecting the subkey strings to obtain the second key;
[0018] The sub-encrypted strings are concatenated according to the order of the substrings in the second string, with separators connecting the sub-encrypted strings to obtain a disordered encrypted string.
[0019] Preferably, the method for dividing the first string into n substrings based on the length of the first string is as follows:
[0020] Get the first length p:
[0021]
[0022] Where A is the total number of characters in the first string. This is a floor function;
[0023] Get the remaining length e:
[0024]
[0025] Where mod(.) is the operation for taking the remainder after division;
[0026] Generate a random number t from 1 to n;
[0027] Get the second length q:
[0028] q = p + e;
[0029] The length of the t-th substring in the first string is the second length q, and the length of the remaining substrings is the first length p.
[0030] Preferably, the sequential encoding uses a four-digit binary code.
[0031] Preferably, the encryption code number is represented by a single letter.
[0032] Preferably, the encryption method includes symmetric encryption algorithms, asymmetric encryption algorithms, salted encryption algorithms, and hash encryption algorithms.
[0033] This invention also provides an offline product license verification method, applied to any of the above-described offline product license generation methods, comprising the following steps:
[0034] Read the license to obtain the first key, the second key, and the out-of-order encryption string;
[0035] The sub-encoded information string of each sub-string is obtained according to the first key;
[0036] The encryption method for each substring in the second string is obtained according to the sub-encoded information string;
[0037] According to the encryption method, each substring is reconstructed using the subkey string and the corresponding sub-encryption string;
[0038] The sequential encoding and character count of each substring are obtained based on the sub-encoding information string;
[0039] The substrings are re-sorted and restored to their original order according to the specified encoding.
[0040] Read the CPU model number, hard disk UUID code, and product serial number of the current machine, and compare them with the corresponding information in the first string. If they match, the verification passes; otherwise, the verification fails.
[0041] Preferably, the license also includes the license's authorization start time and authorization end time;
[0042] During the verification process, the machine's current time is also read.
[0043] Verify whether the current time is between the authorization start time and the authorization end time. If it is, the verification passes; otherwise, the verification fails.
[0044] Preferably, the method for obtaining the sub-encoded information string of each substring according to the first key is to divide the first key into equal segments according to the length of the sub-encoded information string.
[0045] The technical solutions of the embodiments of the present invention have at least the following advantages and beneficial effects:
[0046] This invention increases the difficulty of cracking by enhancing the complexity and randomness of license generation, thereby improving the security of offline licenses, reducing the possibility of unauthorized software modification, and lowering the risk of potential security vulnerabilities and malware.
[0047] This invention can also reduce the risk of unauthorized distribution and use of software, thereby protecting user data and privacy.
[0048] This invention can better protect the copyright of software developers, thereby preventing unauthorized copying, distribution, and use of software, and reducing piracy.
[0049] This invention is reasonably designed, can increase the difficulty of cracking based on existing algorithms, has a high cost-performance ratio, and is easy to implement and promote. Attached Figure Description
[0050] Figure 1 This is a flowchart illustrating the offline product license generation method provided in Embodiment 1 of the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0052] Example 1
[0053] This invention first provides an offline product license generation method, which involves... Figure 1 This includes the following steps:
[0054] Obtain the CPU model number, hard drive UUID code, and product serial number, and concatenate them in order to obtain the first string;
[0055] The first string is divided into n substrings based on its length, and each substring is numbered sequentially to obtain a sequence code.
[0056] Randomly sort the n substrings to obtain the second string;
[0057] Generate an encryption method pool, which includes m encryption methods, and assign an encryption code number to each encryption method;
[0058] For each substring, an encryption method is randomly selected from the encryption method pool to encrypt it, resulting in a sub-encryption string and a sub-key string. The corresponding encryption code number is obtained, and the number of characters in the substring and the encryption code number are concatenated into the sequential encoding of the substring to obtain the sub-encoded information string.
[0059] The first key, the second key, and the disordered encryption string are obtained based on the sub-encoded information string, the sub-key, and the sub-encryption string;
[0060] The first key, the second key, and the out-of-order encrypted string are placed in the product license template file and issued as a license.
[0061] In this embodiment, the method for obtaining the first key, the second key, and the out-of-order encryption string based on the sub-encoded information string, the sub-key, and the sub-encryption string is as follows:
[0062] The first key is obtained by concatenating the sub-encoded information string according to the order of the substrings in the second string;
[0063] The subkey string is concatenated according to the order of the substrings in the second string, with delimiters connecting the subkey strings to obtain the second key;
[0064] The sub-encrypted strings are concatenated according to the order of the substrings in the second string, with separators connecting the sub-encrypted strings to obtain the disordered encrypted string.
[0065] The core of this embodiment lies in segmenting the first string, randomly sorting it, and then encrypting it segment by segment. The original order and the encoding method of each segment are stored as the first key, and the encryption key of each specific segment is used as the second key. This increased encryption complexity enhances the difficulty of cracking, thereby improving the reliability and security of offline licenses.
[0066] Example 2
[0067] This embodiment is based on the technical solution of embodiment 1, and further explains the acquisition of each string and key.
[0068] In this embodiment, the method for dividing the first string into n substrings based on the length of the first string is as follows:
[0069] Get the first length p:
[0070]
[0071] Where A is the total number of characters in the first string. This is a floor function;
[0072] Get the remaining length e:
[0073]
[0074] Where mod(.) is the operation for taking the remainder after division;
[0075] Generate a random number t from 1 to n;
[0076] Get the second length q:
[0077] q = p + e;
[0078] The length of the t-th substring in the first string is the second length q, and the length of the remaining substrings is the first length p.
[0079] In this embodiment, instead of adding the length that cannot be divided equally to a substring, it is added randomly to a substring, also to increase the difficulty of cracking. The following is an implementation example:
[0080] Assuming the CPU model number is A1234567, the hard drive UUID is B789012345, and the product serial number is ABCDEFGHIJKL, the first string after concatenation is: A1234567B789012345ABCDEFGHIJKL, which has 30 characters. Assuming n is 4 in this example, we can calculate p to be 7 and e to be 2. The system automatically generates a random number 3 from 1 to 4. Therefore, we know that the substrings of the first, second, and fourth segments are all 7 characters long, while the third segment is 9 characters long. Thus, the result of the segmentation is:
[0081] The first string is: A123456;
[0082] The second substring: 7B78901;
[0083] The third substring: 2345ABCDE;
[0084] The fourth substring: FGHIJKL;
[0085] This segmentation method allows for greater randomness in length and avoids the situation where each substring has a complete meaning.
[0086] Because this embodiment is based on the technical solution of embodiment 1, the substrings will be sorted out of order in the following steps.
[0087] As a preferred embodiment, the sequential encoding adopts a four-digit two-level code.
[0088] According to the four segments in this embodiment, the sequential encoding is as follows: 0001, 0010, 0011, 0100;
[0089] Assuming the randomized order is 3241, which is 0011, 0010, 0100, 0001, the corresponding length is 9 / 7 / 7 / 7. At this time, the second string is 2345ABCDE7B78901FGHIJKLA123456.
[0090] Furthermore, the encryption code number is represented by a single letter.
[0091] Furthermore, the encryption methods include symmetric encryption algorithms, asymmetric encryption algorithms, salted encryption algorithms, and hash encryption algorithms.
[0092] Assuming that the encryption codes for the symmetric encryption algorithm, asymmetric encryption algorithm, salted encryption algorithm, and hash encryption algorithm in this embodiment are T, P, Q, and R respectively, when encrypting the substrings in the second string sequentially, the random method selects the asymmetric encryption algorithm, salted encryption algorithm, and symmetric encryption algorithm respectively. At this time, the sub-encoded information strings are: 00119P, 00107P, 01007Q, 00017T. The concatenated first key is 00117P00107P01009Q00017T. The second key and the scrambled encryption string can be obtained according to the corresponding encryption methods. All of the above encryption methods can be implemented using existing methods.
[0093] Example 3
[0094] This embodiment provides an offline product license verification method, applied to any of the offline product license generation methods described above, including the following steps:
[0095] Read the license to obtain the first key, the second key, and the out-of-order encryption string;
[0096] The sub-encoded information string of each sub-string is obtained according to the first key;
[0097] The encryption method for each substring in the second string is obtained according to the sub-encoded information string;
[0098] According to the encryption method, each substring is restored using the subkey string and the corresponding sub-encryption string, which means the second string is restored;
[0099] Obtain the sequential encoding of each substring based on the sub-encoding information string;
[0100] The substrings are re-sorted and restored to their original order according to the specified encoding.
[0101] Read the CPU model number, hard disk UUID code, and product serial number of the current machine, and compare them with the corresponding information in the first string. If they match, the verification passes; otherwise, the verification fails.
[0102] In this embodiment, the license also includes the license's authorization start time and authorization end time;
[0103] During the verification process, the machine's current time is also read.
[0104] Verify whether the current time is between the authorization start time and the authorization end time. If it is, the verification passes; otherwise, the verification fails.
[0105] Furthermore, the method for obtaining the sub-encoded information string of each substring according to the first key is to divide the first key into equal segments according to the length of the sub-encoded information string.
[0106] This embodiment uses the case of Embodiment 2 for verification and explanation:
[0107] First, based on 00117P00107P01009Q00017T, we can see that each sub-encoded information string has 6 characters, which can be split into 00119P, 00107P, 01007Q, and 00017T.
[0108] Therefore, we can know that the encryption codes of the encryption methods corresponding to the second key are P, P, Q and T respectively. Through the mapping table, we can know that the corresponding encryption methods are asymmetric encryption algorithm, asymmetric encryption algorithm, salted encryption algorithm and symmetric encryption algorithm. So, according to the concatenation of the separator identifier of the second key and the concatenation of the separator identifier of the disordered encryption string, we can perform corresponding, segmented and separate decryption to restore the second string 2345ABCDE7B78901FGHIJKLA123456.
[0109] Meanwhile, through 00117P, 00107P, 01009Q, and 00017T, we can know that in the second string, the first segment has 9 characters 2345ABCDE, and the actual position should be 0011, which is 3. Similarly, we can know that the actual position of the second segment 7B78901 is also 2, the position of the third segment FGHIJKL is 4, and the position of the fourth segment A123456 is 1.
[0110] Restore the string in order to obtain the first string: A1234567B789012345ABCDEFGHIJKL;
[0111] After obtaining the first string, when reading the CPU model number, hard disk UUID code, and product serial number of the current machine and comparing them with the corresponding information in the first string, the information can be reconstructed according to the length of each of the CPU model number, hard disk UUID code, and product serial number recorded in advance, and then compared one by one.
[0112] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for generating an offline product license, characterized in that, Includes the following steps: Obtain the CPU model number, hard drive UUID code, and product serial number, and concatenate them in order to obtain the first string; The first string is divided into n substrings based on its length, and each substring is numbered sequentially to obtain a sequence code. Randomly sort the n substrings to obtain the second string; Generate an encryption method pool, which includes m encryption methods, and assign an encryption code number to each encryption method; For each substring, an encryption method is randomly selected from the encryption method pool to encrypt it, resulting in a sub-encryption string and a sub-key string. The corresponding encryption code number is obtained, and the number of characters in the substring and the encryption code number are concatenated into the sequential encoding of the substring to obtain the sub-encoded information string. The first key, the second key, and the disordered encryption string are obtained respectively based on the sub-encoded information string, the sub-key, and the sub-encryption string; The first key, the second key, and the out-of-order encrypted string are placed in the product license template file and issued as a license. The method for obtaining the first key, the second key, and the disordered encryption string based on the sub-encoded information string, the sub-key, and the sub-encryption string is as follows: The first key is obtained by concatenating the sub-encoded information string according to the order of the substrings in the second string; The subkey string is concatenated according to the order of the substrings in the second string, with delimiters connecting the subkey strings to obtain the second key; The sub-encrypted strings are concatenated according to the order of the substrings in the second string, with separators connecting the sub-encrypted strings to obtain a disordered encrypted string.
2. The offline product license generation method according to claim 1, characterized in that, The method for dividing the first string into n substrings based on the length of the first string is as follows: Get the first length p: ; Where A is the total number of characters in the first string. This is a floor function; Get the remaining length e: ; in, This refers to the operation of taking the remainder after division; Generate a random number t from 1 to n; Get the second length q: ; The length of the t-th substring in the first string is the second length q, and the length of the remaining substrings is the first length p.
3. The offline product license generation method according to claim 1, characterized in that, The sequential encoding uses a four-digit two-level code.
4. The offline product license generation method according to claim 3, characterized in that, The encryption code number is represented by a single letter.
5. The offline product license generation method according to claim 1, characterized in that, The encryption methods include symmetric encryption algorithms, asymmetric encryption algorithms, salted encryption algorithms, and hash encryption algorithms.
6. An offline product license verification method, applied to the offline product license generation method according to any one of claims 1-5, characterized in that, Includes the following steps: Read the license to obtain the first key, the second key, and the out-of-order encryption string; The sub-encoded information string of each sub-string is obtained according to the first key; The encryption method for each substring in the second string is obtained according to the sub-encoded information string; According to the encryption method, each substring is reconstructed using the subkey string and the corresponding sub-encryption string; The sequential encoding and character count of each substring are obtained based on the sub-encoding information string; The substrings are re-sorted and restored to their original order according to the specified encoding. Read the CPU model number, hard disk UUID code, and product serial number of the current machine, and compare them with the corresponding information in the first string. If they match, the verification passes; otherwise, the verification fails.
7. The offline product license verification method according to claim 6, characterized in that, The license also includes the start and end dates of the license authorization; During the verification process, the machine's current time is also read. Verify whether the current time is between the authorization start time and the authorization end time. If it is, the verification passes; otherwise, the verification fails.
8. The offline product license verification method according to claim 6, characterized in that, The method for obtaining the sub-encoded information string of each sub-string based on the first key is to divide the first key into equal segments according to the length of the sub-encoded information string.
Citation Information
Patent Citations
RSA offline encryption technology suitable for CAA secondary development software
CN114239012A
Authentication method and device of business processing process, equipment, storage medium and product
CN117118593A