Encryption method, verification method, device, electronic equipment and computer storage medium
By generating and encrypting ciphertext containing the number of licenses, the problem of software license numbers being easily tampered with is solved, achieving the security and uniqueness of the ciphertext and protecting the economic interests of software manufacturers.
Patent Information
- Application Number
- CN202211547498.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-05
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-12-05
AI Technical Summary
In existing technologies, the encryption methods used to count software licenses are easily cracked, allowing users to change the number of licenses and causing economic losses to software manufacturers.
A string is generated using a preset key and the number of licenses. This string is then encrypted using a linear hash algorithm such as MD5 to form the first ciphertext. The number of licenses is then added at a preset position to generate the second ciphertext, ensuring the uniqueness and irreversibility of the ciphertext.
This effectively prevents the number of licenses from being tampered with, improves the security of encrypted data, and protects the commercial interests of software manufacturers.
Smart Images

Figure CN116070177B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of information security technology, and in particular relates to an encryption method, verification method, device, electronic device and computer storage medium. Background Technology
[0002] A software license is an agreement between a rights holder and a user that establishes the rights and obligations of both parties. Currently, the vast majority of software transactions take the form of licenses, such as distribution licenses and reproduction licenses. To maintain the legal use of software, only a valid license can unlock and access or use the software.
[0003] To protect their commercial interests, software manufacturers often limit the number of licenses issued during software distribution. Currently, the encryption methods used to control the number of licenses are easily cracked, allowing users to alter the number of licenses and causing financial losses for software manufacturers. Summary of the Invention
[0004] This application provides an encryption method, verification method, apparatus, electronic device, and computer storage medium that can effectively prevent users from changing the number of software licenses and improve security.
[0005] In a first aspect, embodiments of this application provide an encryption method, the method comprising:
[0006] Obtain the preset key and the number of software licenses;
[0007] A string is obtained based on the preset key and the number of licenses;
[0008] The string is encrypted using a linear hash algorithm to obtain the first ciphertext;
[0009] Based on the number of licenses and the first ciphertext, the second ciphertext is obtained.
[0010] Secondly, embodiments of this application provide a verification method, the method comprising:
[0011] Obtain the preset key and the third ciphertext from the software information;
[0012] Based on the third ciphertext, obtain the number of software licenses;
[0013] A string is obtained based on the preset key and the number of licenses;
[0014] The string is encrypted using a linear hash algorithm to obtain the first ciphertext;
[0015] Based on the number of licenses and the first ciphertext, the second ciphertext is obtained;
[0016] If the third ciphertext is the same as the second ciphertext, then it is determined that the number of licenses has not been tampered with.
[0017] Thirdly, embodiments of this application provide an encryption device, the device comprising:
[0018] The first acquisition module is used to acquire the preset key and the number of software licenses;
[0019] The second acquisition module is used to obtain a string based on the preset key and the number of licenses;
[0020] The first encryption module is used to encrypt the string using a linear hash algorithm to obtain the first ciphertext;
[0021] The second encryption module is used to obtain the second ciphertext based on the number of licenses and the first ciphertext.
[0022] Fourthly, embodiments of this application provide a verification device, the device comprising:
[0023] The first acquisition module is used to acquire a preset key and to acquire a third ciphertext from the software information of the software.
[0024] The second acquisition module is used to obtain the number of software licenses based on the third ciphertext;
[0025] The third acquisition module is used to obtain a string based on the preset key and the number of licenses;
[0026] The fourth acquisition module is used to encrypt the string using a linear hash algorithm to obtain the first ciphertext;
[0027] The fifth acquisition module is used to obtain the second ciphertext based on the number of licenses and the first ciphertext;
[0028] The verification module is used to determine that the number of licenses has not been tampered with if the third ciphertext is the same as the second ciphertext.
[0029] Fifthly, embodiments of this application provide an electronic device, the device including: a processor and a memory storing computer program instructions;
[0030] When the processor executes the computer program instructions, it implements the method as described in the first or second aspect.
[0031] In a sixth aspect, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the method described in the first or second aspect.
[0032] In a seventh aspect, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the method described in the first or second aspect.
[0033] The encryption method, verification method, apparatus, device, and computer storage medium of this application can effectively prevent the number of licenses set in the ciphertext of the software from being tampered with, improve the security of the ciphertext, and avoid economic losses for software manufacturers. Attached Figure Description
[0034] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart illustrating an encryption method provided in one embodiment of this application;
[0036] Figure 2a This is a schematic diagram of encrypted text provided in one embodiment of this application;
[0037] Figure 2b This is another ciphertext illustration provided in one embodiment of this application;
[0038] Figure 3 This is a flowchart illustrating a verification method provided in one embodiment of this application;
[0039] Figure 4 This is a schematic diagram of the structure of an encryption device provided in one embodiment of this application;
[0040] Figure 5 This is a schematic diagram of the structure of a verification device provided in one embodiment of this application;
[0041] Figure 6 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0042] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0043] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0044] To address the problems of the prior art, embodiments of this application provide an encryption method, a verification method, an apparatus, an electronic device, and a computer storage medium. The encryption method provided in the embodiments of this application will be described first.
[0045] Figure 1 A flowchart illustrating an embodiment of the encryption method provided in this application is shown. Figure 1 As shown, the encryption method provided in this application embodiment includes the following steps 101-104, wherein:
[0046] Step 101: Obtain the preset key and the number of software licenses.
[0047] The default key is set in advance and can be set by the software developer; it can also be called a password. The number of licenses can be understood as the number of people a software vendor authorizes to use the software. This number can be determined based on the number of users logging in. For example, customers need to log in before using the software, and the number of online users cannot exceed the number of licenses.
[0048] Step 102: Obtain a string based on the preset key and the number of licenses.
[0049] The preset key and the number of licenses can be concatenated to obtain a string. The concatenation method can be determined according to preset rules, which can also be set by the software developer (or software vendor). For example, the preset rule could be to concatenate the preset key and the number of licenses from the beginning and end, or to insert the number of licenses into the preset key. For instance, if the preset key is "secretKey" and the number of licenses is 50, the resulting string could be "secretKey50", "50secretKey", or "secret50Key", etc.
[0050] Step 103: Encrypt the string using a linear hash algorithm to obtain the first ciphertext.
[0051] When encrypting strings, a linear hash algorithm can be used. Linear hash algorithms are one-way encryption; the original data cannot be obtained from the encrypted content, effectively ensuring that the first ciphertext obtained after encryption cannot be decrypted.
[0052] Preferably, the string is encrypted using Message-Digest Algorithm 5 (MD5). The string is encrypted using MD5 to form 32-bit ciphertext. MD5 is a cryptographic hash function that produces a 128-bit (16-byte) hash value. The first ciphertext obtained after MD5 encryption is a 128-bit hash value.
[0053] Step 104: Obtain the second ciphertext based on the number of licenses and the first ciphertext.
[0054] Specifically, in one implementation of this step, the number of licenses can be added to a preset position in the first ciphertext. This preset position can be set by the software developer (or software vendor). For example, the preset position could be at the 1 / 2 mark of the first ciphertext, i.e., the 16th bit, or at the 1 / 4 mark of the first ciphertext, i.e., the 8th bit.
[0055] For example, if the preset key is "secretKey" and the number of licenses is 50, the string obtained based on both is "secretKey50". Encrypting "secretKey50" using MD5 results in a 32-bit first ciphertext: 9df631175b75a65d0f6d6288c1784483. This ciphertext is globally unique and irreversible. The license quantity 50 is then inserted into the 16th position of the first ciphertext, forming the second ciphertext: 9df631175b75a65d500f6d6288c1784483. Figure 2a The image shows the first ciphertext obtained after MD5 encryption. Figure 2b The image shows the second ciphertext obtained after adding the number of licenses to the first ciphertext, where label 11 indicates the number of licenses.
[0056] Furthermore, if the number of licenses is two, three, or more digits, the preset positions can also include two or more positions. That is, the number of positions included in the preset positions is the same as the number of digits included in the license quantity. For example, if the license quantity is 50 (including two digits), then the preset positions include two positions, which can be adjacent positions. Figure 2bThe preset positions shown; these two positions can also be non-adjacent, for example, the first position is the beginning of the first ciphertext and the second position is the end of the first ciphertext, which is not limited here.
[0057] Preferably, the second ciphertext includes the number of licenses. Even if the preset key is leaked, the number of licenses in the second ciphertext obtained in the above manner cannot be tampered with, provided the concatenation rules of the first ciphertext and the number of licenses are unknown. This effectively prevents the number of licenses in the second ciphertext from being altered.
[0058] Furthermore, the second ciphertext is added to the software information of the software, which includes a database or configuration file. When the software is distributed to the customer, the software information is also distributed to the customer.
[0059] The encryption method in this embodiment involves obtaining a preset key and the number of software licenses; obtaining a string based on the preset key and the number of licenses; encrypting the string using a linear hash algorithm to obtain a first ciphertext; and obtaining a second ciphertext based on the number of licenses and the first ciphertext. As can be seen from the above, the second ciphertext is jointly determined by the preset key and the number of licenses. Even if the preset key is leaked, the number of licenses cannot be determined from the second ciphertext if the concatenation rule of the first ciphertext and the number of licenses is unknown (i.e., the preset position is unknown). This effectively prevents the number of licenses in the second ciphertext from being tampered with, further avoiding economic losses for the software manufacturer.
[0060] like Figure 3 As shown in the embodiment of this application, a verification method is also provided, the method including steps 301-306:
[0061] Step 301: Obtain the preset key and the third ciphertext from the software information;
[0062] The default key is set in advance and can be set by the software developer; it can also be called a password. The third ciphertext is contained within the software information, which may include databases or configuration files. For example, the third ciphertext can be included in the software's database or configuration files.
[0063] Step 302: Obtain the number of software licenses based on the third ciphertext.
[0064] The number of licenses can be understood as the number of people a software vendor authorizes to use the software. This number can be determined based on the number of people logging into the software. For example, when using the software, customers need to log in first, and the number of people logged in online cannot exceed the number of licenses.
[0065] The third ciphertext may be ciphertext obtained according to the encryption method provided in the embodiments of this application. The third ciphertext includes the number of licenses, which may or may not have been tampered with and requires further verification.
[0066] Specifically, the number of licenses can be obtained from the preset location of the third ciphertext. The setting of the preset location of the third ciphertext can be found in step 104, and will not be repeated here.
[0067] Step 303: Obtain a string based on the preset key and the number of licenses.
[0068] Step 304: Encrypt the string using a linear hash algorithm to obtain the first ciphertext;
[0069] Step 305: Obtain the second ciphertext based on the number of licenses and the first ciphertext;
[0070] Steps 303-305 are the process of obtaining the second ciphertext based on the preset key and the number of licenses. This process is the same as the process of obtaining the second ciphertext in steps 102-104. For details, please refer to the description in steps 102-104. It is not limited here.
[0071] Step 306: If the third ciphertext and the second ciphertext are the same, then it is determined that the number of licenses has not been tampered with. If the third ciphertext and the second ciphertext are different, then it is determined that the number of licenses has been tampered with.
[0072] For example, when a user logs in, the server verifies the ciphertext (i.e., the third ciphertext) in the software's database or configuration file, which is obtained by the software vendor through the encryption method provided in the embodiments of this application.
[0073] The server can extract the ciphertext at a preset position specified by the software vendor, such as 1 / 2 or 1 / 4 of the ciphertext, to obtain the number of licenses. Then, according to the encryption method provided in this application embodiment, it generates a second ciphertext based on the number of licenses and a preset key. The obtained second ciphertext is compared with the ciphertext stored in the software information. If they are completely consistent, it indicates that the ciphertext in the database has not been modified, and the number of licenses is valid. Otherwise, the ciphertext stored in the software information has been tampered with, the user is prohibited from logging in, and a message is displayed indicating that the number of licenses is invalid and login is not possible.
[0074] Since the MD5 encryption key is globally unique, if the number of licenses in the stored ciphertext is modified, the ciphertext obtained by concatenating the number of licenses with the preset key and then performing MD5 encryption will be inconsistent with the ciphertext stored in the software information. That is, if "secretKey80" and "secretKey50" are encrypted with MD5 respectively, the ciphertexts obtained will be inconsistent. This can determine whether the number of licenses has been tampered with.
[0075] For example: Suppose the specified key is "secretKey" and the customer purchases 50 licenses. The number of licenses is added to the 1 / 2 position of the ciphertext obtained after MD5 encryption.
[0076] The verification process is as follows:
[0077] 1. The encrypted text was obtained from the software information. The license quantity was extracted from the 16-bit position, showing 50. Figure 2b As shown, the 16th and 17th bits are taken as the number of licenses.
[0078] 2. Encrypt the string "secretKey50" using MD5 to form a 32-bit ciphertext, such as... Figure 2a As shown.
[0079] 3. Add the license quantity 50 to the ciphertext obtained in step 2 at the 1 / 2 position, which is the 16th position, to obtain a new ciphertext, such as... Figure 2b As shown.
[0080] 4. Compare the ciphertext obtained in step 3 with the ciphertext obtained in the software information. Based on the global uniqueness and irreversibility of MD5 encryption, if they match, it means that the number of licenses is legitimate.
[0081] When a user logs in, the server (the server that provides services to the software) intercepts the number of licenses and compares it with the number of users already logged in online. If the number of online users is less than the number of licenses, the user is allowed to log in; otherwise, the user is blocked from logging in and a message is displayed indicating that the maximum number of online users has been reached. This is how the software limits the number of licenses.
[0082] The verification method in this embodiment involves obtaining a preset key and retrieving a third ciphertext from the software information; obtaining the number of software licenses based on the third ciphertext; obtaining a string based on the preset key and the number of licenses; encrypting the string using a linear hash algorithm to obtain a first ciphertext; obtaining a second ciphertext based on the number of licenses and the first ciphertext; and determining that the number of licenses has not been tampered with if the third ciphertext and the second ciphertext are the same. This method allows for verification of whether the number of licenses in the third ciphertext has been tampered with, facilitating appropriate measures in the event of tampering, such as prohibiting user login, effectively preventing economic losses for software manufacturers.
[0083] The encryption method provided in this application is secure and reliable. It can obtain the number of licenses through the ciphertext, verify the legality of the ciphertext and whether the number of online users has reached the prescribed limit, and ensure that the ciphertext is not tampered with even if the key is leaked.
[0084] Figure 4 A structural diagram of the encryption device provided in an embodiment of this application is shown. Figure 4 As shown, the encryption device 400 includes:
[0085] The first acquisition module 401 is used to acquire the preset key and the number of software licenses;
[0086] The second acquisition module 402 is used to obtain a string based on the preset key and the number of licenses;
[0087] The first encryption module 403 is used to encrypt the string using a linear hash algorithm to obtain the first ciphertext;
[0088] The second encryption module 404 is used to obtain the second ciphertext based on the number of licenses and the first ciphertext.
[0089] In one embodiment of this application, the first encryption module 403 is specifically used to encrypt the string using MD5 to obtain the first ciphertext.
[0090] In one embodiment of this application, the second encryption module 404 is specifically used to add the number of licenses at a preset position of the first ciphertext to form the second ciphertext.
[0091] In one embodiment of this application, the apparatus further includes an adding module for adding the second ciphertext to the software information of the software, the software information including a database or configuration file.
[0092] The encryption device 400 provided in this application embodiment can implement the various processes implemented in the aforementioned encryption method embodiment, and will not be described again here to avoid repetition.
[0093] Figure 5 A structural diagram of the verification device provided in an embodiment of this application is shown. Figure 5 As shown, the verification device 500 includes:
[0094] The first acquisition module 501 is used to acquire a preset key and to acquire a third ciphertext from the software information of the software.
[0095] The second acquisition module 502 is used to obtain the number of software licenses based on the third ciphertext;
[0096] The third acquisition module 503 is used to obtain a string based on the preset key and the number of licenses;
[0097] The fourth acquisition module 504 is used to encrypt the string using a linear hash algorithm to obtain the first ciphertext;
[0098] The fifth acquisition module 505 is used to obtain the second ciphertext based on the number of licenses and the first ciphertext;
[0099] The verification module 506 is used to determine that the number of licenses has not been tampered with if the third ciphertext is the same as the second ciphertext.
[0100] In one embodiment of this application, the fourth acquisition module is specifically used to encrypt the string using MD5 to obtain the first ciphertext.
[0101] In one embodiment of this application, the fifth acquisition module is specifically used to add the number of licenses at a preset position in the first ciphertext to form a second ciphertext.
[0102] The verification device 500 provided in this application embodiment can implement the various processes implemented in the aforementioned verification method embodiment. To avoid repetition, it will not be described again here.
[0103] Figure 6 A schematic diagram of the hardware structure of the encryption method or verification method provided in the embodiments of this application is shown.
[0104] An electronic device may include a processor 601 and a memory 602 storing computer program instructions.
[0105] Specifically, the processor 601 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0106] Memory 602 may include mass storage for data or instructions. For example, and not limitingly, memory 602 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 602 may include removable or non-removable (or fixed) media. Where appropriate, memory 602 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 602 is non-volatile solid-state memory.
[0107] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to the first or second aspect of this disclosure.
[0108] The processor 601 reads and executes computer program instructions stored in the memory 602 to implement any of the encryption or verification methods in the above embodiments.
[0109] In one example, the electronic device may also include a communication interface 603 and a bus 610. For example, Figure 6 As shown, the processor 601, memory 602, and communication interface 603 are connected through bus 610 and complete communication with each other.
[0110] The communication interface 603 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0111] Bus 610 includes hardware, software, or both, that couples components of an encryption method or authentication device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 610 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0112] Furthermore, in conjunction with the encryption or verification methods described in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any one of the encryption or verification methods described in the above embodiments.
[0113] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0114] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0115] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0116] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0117] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. An encryption method characterized by, The method comprises: obtaining a preset key and a license quantity of software; concatenating characters of the preset key and the license quantity according to a preset rule to obtain a string; encrypting the string by using a linear hash algorithm to obtain a first ciphertext; obtaining a second ciphertext according to the license quantity and the first ciphertext; obtaining a second ciphertext according to the license quantity and the first ciphertext, comprising: adding the license quantity at a preset position of the first ciphertext to form the second ciphertext.
2. The method of claim 1, wherein, The encryption of the string by using the linear hash algorithm to obtain the first ciphertext comprises: encrypting the string by using MD5 to obtain the first ciphertext.
3. The method of claim 1, wherein, After obtaining the second ciphertext according to the license quantity and the first ciphertext, the method further comprises: adding the second ciphertext to software information of the software, wherein the software information comprises a database or a configuration file.
4. A verification method for the encryption method according to one of claims 1 to 3, characterized in that, The method comprises: obtaining a preset key and a third ciphertext from software information of software; obtaining a license quantity of software according to the third ciphertext; obtaining a string according to the preset key and the license quantity; encrypting the string by using a linear hash algorithm to obtain a first ciphertext; obtaining a second ciphertext according to the license quantity and the first ciphertext; if the third ciphertext and the second ciphertext are the same, determining that the license quantity is not tampered with.
5. An encryption device for use in the encryption method according to one of claims 1 to 3, characterized in that The device comprises: a first obtaining module configured to obtain a preset key and a license quantity of software; a second obtaining module configured to concatenate characters of the preset key and the license quantity according to a preset rule to obtain a string; a first encryption module configured to encrypt the string by using a linear hash algorithm to obtain a first ciphertext; a second encryption module configured to obtain a second ciphertext according to the license quantity and the first ciphertext; the second encryption module is configured to add the license quantity at a preset position of the first ciphertext to form the second ciphertext.
6. A verification device for use in a verification method according to claim 4, characterized in that The device comprises: a first obtaining module configured to obtain a preset key and a third ciphertext from software information of software; a second obtaining module configured to obtain a license quantity of software according to the third ciphertext; a third obtaining module configured to obtain a string according to the preset key and the license quantity; a fourth obtaining module configured to encrypt the string by using a linear hash algorithm to obtain a first ciphertext; a fifth obtaining module configured to obtain a second ciphertext according to the license quantity and the first ciphertext; a verification module configured to determine that the license quantity is not tampered with if the third ciphertext and the second ciphertext are the same.
7. An electronic device, comprising: The device comprises a processor and a memory storing computer program instructions; the processor executes the computer program instructions to implement the method of any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the method of any one of claims 1-4.
9. A computer program product, characterised in that, The instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the method of any one of claims 1-4.
Citation Information
Patent Citations
Software use permission acquisition method and device
CN114880630A