Software authorization method and device, computer readable medium and electronic equipment
Patent Information
- Application Number
- CN202410333182.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-21
- Publication Date
- 2025-09-23
AI Technical Summary
Traditional software licensing methods are easily decompiled and cracked, leading to illegal use of software and damaging the legitimate rights and interests of software developers. In addition, virtual machine authorization in the cloud is difficult to implement.
By obtaining the hardware information of the target device, encrypting it with the public key and sending it to the license server for verification, the server uses the private key to decrypt and encrypt the core code to ensure that the software runs on a legitimate device.
It improves the security of software authorization, protects the legitimate rights and interests of software developers, and makes cloud virtual machine software authorization possible.
Smart Images

Figure CN120688038A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of software permission control, and in particular to a software authorization method, device, computer-readable medium, and electronic device. Background Art
[0002] Traditional software generally authorizes users to use the software through software licenses to ensure the legal use of the software.
[0003] However, some unscrupulous users may use software decompilation methods to crack the software. Specifically, they can restore the software code through software decompilation methods, and then modify the code to bypass the software license verification and crack the software. This will lead to the illegal use of the software and damage the legitimate rights and interests of the software developers. Summary of the Invention
[0004] The embodiments of the present application provide a software authorization method, apparatus, computer-readable medium, and electronic device, which can improve the security of software authorization, at least to a certain extent, and effectively protect the legitimate rights and interests of software developers.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.
[0006] According to one aspect of an embodiment of the present application, a software authorization method is provided, which is executed by a target device, and the method includes: after starting software according to an acquired software package, obtaining hardware information of the target device, the software package including a first public key and a second private key; encrypting the hardware information based on the first public key to obtain encrypted information; sending the encrypted information to a license server, so that the license server verifies the decrypted hardware information after decrypting the encrypted information according to a first private key corresponding to the first public key, and after the hardware information passes the verification, encrypts the core code of the software according to a second public key corresponding to the second private key, and sends the encryption result as a license to the target device; verifies the license according to the second private key; after the license passes the verification, saves the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device, so that the software can execute the core code at runtime.
[0007] According to one aspect of an embodiment of the present application, a software authorization method is provided, which is executed by a license server, and the method includes: obtaining encrypted information sent by a target device, the encrypted information being obtained by encrypting hardware information of the target device based on a first public key in the software package after the target device starts software according to an acquired software package, the software package including a first public key and a second private key; decrypting the encrypted information according to a first private key corresponding to the first public key to obtain the hardware information; verifying the hardware information, and if the hardware information passes the verification, encrypting the core code of the software according to a second public key corresponding to the second private key; returning the encryption result as a license to the target device, so that the target device verifies the license according to the second private key, and if the license passes the verification, saving the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device, so that the software can execute the core code when running on the target device.
[0008] According to one aspect of an embodiment of the present application, a software authorization device is provided, which is located in a target device and includes: an acquisition unit for acquiring hardware information of the target device after starting the software according to the acquired software package, the software package including a first public key and a second private key; an encryption unit for encrypting the hardware information based on the first public key to obtain encrypted information; a sending unit for sending the encrypted information to a license server, so that the license server verifies the decrypted hardware information after decrypting the encrypted information according to the first private key corresponding to the first public key, and encrypts the core code of the software according to the second public key corresponding to the second private key after the hardware information passes the verification, and sends the encrypted result as a license to the target device; a verification unit for verifying the license according to the second private key; and a saving unit for saving the core code obtained by decrypting the encryption result according to the second private key to the memory of the target device after the license passes the verification, so that the software executes the core code at runtime.
[0009] In some embodiments of the present application, based on the aforementioned solution, the first public key, the first private key, the second public key and the second private key are generated by the license server, and the first public key and the second private key in the software package are obtained by the generator of the software package from the license server.
[0010] In some embodiments of the present application, based on the aforementioned scheme, the license server encrypts the core code of the software according to the second public key corresponding to the second private key in the following manner: generates a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and saves at least the third private key and the fourth public key; constructs data to be encrypted according to the third public key, the fourth private key and the core code of the software, and encrypts the data to be encrypted according to the second public key corresponding to the second private key; the saving unit is configured to: save the core code obtained by decrypting the encryption result according to the second private key to the memory of the target device, replace the first public key in the software package with the third public key obtained by decrypting the encryption result according to the second private key, and replace the second private key in the software package with the fourth private key obtained by decrypting the encryption result according to the second private key.
[0011] In some embodiments of the present application, based on the aforementioned scheme, the encryption unit is configured to: generate a random number, and construct information to be encrypted based on the random number and the hardware information; encrypt the information to be encrypted based on the first public key to obtain encrypted information; constructing the data to be encrypted based on the third public key, the fourth private key and the core code of the software, including: encrypting the core code of the software according to the random number obtained by decrypting the encrypted information to obtain an encrypted code; constructing the data to be encrypted according to the third public key, the fourth private key and the encrypted code; the saving unit is configured to: decrypt the encrypted code obtained by decrypting the encryption result according to the second private key according to the random number to obtain the core code; and save the core code to the memory of the target device.
[0012] In some embodiments of the present application, based on the aforementioned scheme, the device further includes an expiration time acquisition unit, a determination unit and a closing unit; the constructing of the data to be encrypted according to the third public key, the fourth private key and the encrypted code includes: constructing the data to be encrypted according to the third public key, the fourth private key, the expiration time and the encrypted code; after the license passes the verification, the expiration time acquisition unit is used to: obtain the expiration time obtained by decrypting the encryption result according to the second private key; the determination unit is used to: compare the current time and the expiration time to determine whether the license is invalid; the closing unit is used to: close the software if the license is invalid.
[0013] In some embodiments of the present application, based on the aforementioned scheme, the hardware information includes an IP address and a MAC address, and the encrypted information is sent by the target device to the license server through a network request. The license server verifies the hardware information in the following manner: obtaining the source IP address of the network request; verifying the IP address in the hardware information based on the comparison result of the source IP address and the IP address in the hardware information; verifying the MAC address in the hardware information based on the comparison result of the pre-acquired MAC address and the MAC address in the hardware information.
[0014] According to one aspect of an embodiment of the present application, a software authorization device is provided, which is located in a license server and includes: an acquisition unit, used to acquire encrypted information sent by a target device, the encrypted information being obtained by encrypting hardware information of the target device based on a first public key in the software package after the target device starts software according to the acquired software package, the software package including a first public key and a second private key; a decryption unit, used to decrypt the encrypted information according to a first private key corresponding to the first public key to obtain the hardware information; a verification and encryption unit, used to verify the hardware information and, if the hardware information passes the verification, encrypt the core code of the software according to a second public key corresponding to the second private key; a return unit, used to return the encryption result as a license to the target device, so that the target device verifies the license according to the second private key and, if the license passes the verification, saves the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device, so that the software can execute the core code when running on the target device.
[0015] In some embodiments of the present application, based on the aforementioned scheme, the apparatus further includes a generating unit and a sending unit; before obtaining the encrypted information sent by the target device, the generating unit is used to: generate the first public key, the first private key, the second public key and the second private key, and save at least the first private key and the second public key; the sending unit is used to: send the first public key and the second private key to the generator of the software package, so that the generator of the software package generates the software package including the first public key and the second private key.
[0016] In some embodiments of the present application, based on the aforementioned scheme, the verification and encryption unit is configured to: generate a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and save at least the third private key and the fourth public key; construct the data to be encrypted according to the third public key, the fourth private key and the core code of the software, and encrypt the data to be encrypted according to the second public key corresponding to the second private key; when the license passes the verification, the steps executed by the target device also include: replacing the first public key in the software package with the third public key obtained by decrypting the encryption result according to the second private key, and replacing the second private key in the software package with the fourth private key obtained by decrypting the encryption result according to the second private key.
[0017] In some embodiments of the present application, based on the aforementioned scheme, the target device obtains the encrypted information in the following manner: generates a random number, and constructs the information to be encrypted based on the random number and the hardware information; encrypts the information to be encrypted based on the first public key to obtain encrypted information; the verification and encryption unit is configured to: encrypt the core code of the software according to the random number obtained by decrypting the encrypted information to obtain an encrypted code; construct the data to be encrypted according to the third public key, the fourth private key and the encrypted code; the target device saves the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device in the following manner: decrypts the encrypted code obtained by decrypting the encryption result according to the second private key according to the random number to obtain the core code; and saves the core code into the memory of the target device.
[0018] In some embodiments of the present application, based on the aforementioned scheme, the hardware information includes an IP address and a MAC address, and the acquisition unit is configured to: when receiving a network request from the target device, obtain the encrypted information carried in the network request; the verification and encryption unit is configured to: obtain the source IP address of the network request; verify the IP address in the hardware information based on the comparison result of the source IP address and the IP address in the hardware information; verify the MAC address in the hardware information based on the comparison result of the pre-acquired MAC address and the MAC address in the hardware information.
[0019] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the software authorization method as described in the above embodiment is implemented.
[0020] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the software authorization method as described in the above embodiment.
[0021] According to one aspect of an embodiment of the present application, a computer program product is provided, which includes computer instructions, wherein the computer instructions are stored in a computer-readable storage medium, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the software authorization method described in the above embodiment.
[0022] In the technical solutions provided in some embodiments of the present application, the target device first obtains a software package including a first public key and a second private key, and then starts the software according to the software package. After startup, the software will automatically perform the following operations: obtain the hardware information of the target device, and encrypt the hardware information based on the first public key to obtain encrypted information; send the encrypted information to the license server, and the license server can decrypt the encrypted information according to the first private key corresponding to the first public key, and verify the decrypted hardware information. After the hardware information is verified, the license server will also encrypt the core code of the software according to the second public key corresponding to the second private key, and send the encrypted result as a license to the target device; then, the target device can verify the license according to the second private key, and if the license passes the verification, the core code obtained by decrypting the encryption result according to the second private key will be saved in the memory of the target device. When the software is running on the target device, the core code can be executed, thereby achieving the functional effect that can be achieved by the core code in the software. The entire solution proposes a solution to separate the core code. Since the software package used to start the software does not contain the core code itself, but the core code is stored in the license server, even if the user cracks the software package by bypassing the license verification, since the core code is issued to the target device by the license server through the license, bypassing the license verification will cause the user to be unable to obtain the core code of the software, which makes the software still unable to run completely normally. This improves the security of software authorization and effectively protects the legitimate rights and interests of software developers.
[0023] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, explaining the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0025] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied;
[0026] Figure 2 A flowchart of a software authorization method according to an embodiment of the present application is shown;
[0027] Figure 3 A schematic diagram of the overall process of software authorization according to an embodiment of the present application is shown;
[0028] Figure 4 A schematic diagram of a process flow of a software compilation phase according to an embodiment of the present application is shown;
[0029] Figure 5 A schematic diagram of a process flow of a software startup phase according to an embodiment of the present application is shown;
[0030] Figure 6 A flowchart illustrating hardware information verification by a license server according to an embodiment of the present application is shown;
[0031] Figure 7 A schematic diagram showing a comparison between the information carried by a traditional license and the information carried by the license of the present application according to an embodiment of the present application is shown;
[0032] Figure 8 A flowchart showing the steps after a license passes verification when the license has an expiration date according to one embodiment of the present application is shown;
[0033] Figure 9 A flowchart of a software authorization method according to another embodiment of the present application is shown;
[0034] Figure 10 An embodiment according to the present application is shown Figure 9 Flowchart of steps before step 930 in the embodiment;
[0035] Figure 11 A block diagram of a software authorization device according to an embodiment of the present application is shown;
[0036] Figure 12 A block diagram of a software authorization device according to another embodiment of the present application is shown;
[0037] Figure 13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.
[0039] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps etc. can be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0040] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0041] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0042] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0043] In related technologies, traditional software generally authorizes users to use the software through a software license to ensure the legal use of the software and protect the legitimate rights and interests of the software. There are several traditional ways to generate a license file:
[0044] 1. Generate a license file based on hardware information. This can be done by obtaining the user's hardware information, including the computer's Mac address, IP address, etc., encrypting the hardware information, and generating a corresponding license file to ensure that the software can only run on specific hardware devices.
[0045] 2. Generate a license file based on a time limit. In addition to hardware information, you can also use a time limit to generate a license file. Once the software expires, it will no longer be usable.
[0046] 3. Generate a license file based on the authorization code.
[0047] However, the traditional license file generation method in the related art has the following drawbacks: due to the existence of a large number of software decompilation methods, users can restore the software code through the software decompilation method, and then bypass the software license verification by modifying the code to crack the software.
[0048] Furthermore, with the advancement of technology, cloud computing has become increasingly popular, with virtual machines replacing physical machines as the primary means of general user use. An increasing number of software vendors are deploying software on cloud virtual machines for direct execution. Currently, cloud virtual machines in the industry automatically assign virtual IP addresses and MAC addresses upon startup. This hardware information changes with each startup. Using software on cloud virtual machines differs from using offline software. Cloud virtual machines cannot be sold as bundled machines with offline software. Furthermore, in the containerized era, IP addresses and MAC addresses can be forged, making the licensing of cloud virtual machine software less feasible.
[0049] To this end, this application first provides a software authorization method. The software authorization method provided in the embodiments of this application can overcome the above-mentioned shortcomings, not only avoiding the losses caused by software cracking using decompilation methods, ensuring the legal use of software, protecting the legitimate rights and interests of software developers, but also making it possible to authorize virtual machine software on the cloud.
[0050] Figure 1 Schematic diagram showing an exemplary system architecture to which the technical solution of the embodiment of the present application can be applied. Figure 1As shown, the system architecture 100 may include a cloud 110, a license server 120, a compilation server 130 and a user terminal 140. The license server 120, the compilation server 130 and the user terminal 140 have established communication connections with the cloud 110, and a communication connection is also established between the license server 120 and the compilation server 130. A server of a software purchasing platform is deployed on the cloud 110. The cloud 110 includes multiple physical machines. One or more of these physical machines may be deployed with virtual machines, and each physical machine may be deployed with one or more virtual machines; a compilation program is deployed on the compilation server 130, and the compilation server 130 also stores software source code. A client (such as a browser) capable of accessing the software purchasing platform is installed on the user terminal 140. The target virtual machine on the target physical machine in the cloud 110 can be the executor of the embodiment of the present application. When a software authorization method provided in the embodiment of the present application is applied to Figure 1In the system architecture shown, a process may be as follows: first, the compilation server 130 generates software identification information for the software source code and generates a corresponding code identifier for each core code in the software source code. The compilation server 130 uploads the software identification information, at least one core code in the software source code, and the code identifier of each core code to the license server 120; then, the license server 120 stores the received software identification information, core code, and code identifier of each core code; then, when the user terminal 140 requests to access the software purchase platform on the cloud 110 through the client of the software purchase platform, the client of the user terminal 140 displays the software purchase interface on the software purchase platform. It displays product information corresponding to several software programs. Users can purchase a certain software by operating on the software purchase interface. When purchasing software, users need to provide the software purchase platform with the MAC address of the target physical machine they use and the core code function information they need to purchase through the software purchase interface. When the user purchases the software corresponding to the above-mentioned software source code through the software purchase interface, the software purchase platform will determine the software identification information, and determine the code identification of the core code based on the core code function information provided by the user, and will also generate a software serial number for the user that is uniquely corresponding to his account on the software purchase platform. Then, the software purchase platform will send the MAC address, software identification information, core code code identification and software serial number to the license License server 120; when the user purchases the software corresponding to the above-mentioned software source code through the software purchase interface, the compilation server 130 will also receive a notification message carrying the software serial number, and request to obtain the public and private keys from the license server 120 according to the notification message. The license server 120 will generate a first public key, a first private key corresponding to the first public key, a second public key, and a second private key corresponding to the second public key, and store these public and private keys in correspondence with the software serial number. The license server 120 will send the first public key and the second private key to the compilation server 130; then, the compilation server 130 compiles the software source code with all core codes removed, and adds the first public key and the second private key to the compilation result, thereby obtaining the user's software package. ; Then, the compilation server 130 sends the user's software package to the target virtual machine in the target physical machine specified by the user on the cloud 110. After obtaining the software package, the target virtual machine will start the software based on the software package and log in to the software using the software serial number. At this time, the software will encrypt the hardware information including the IP address and MAC address of the target physical machine based on the first public key in the software package to obtain encrypted information; then, the target physical machine sends the software serial number and encrypted information to the license server 120 via a network request. The license server 120 finds the corresponding MAC address, software identification information, core code code identification, second public key and first private key according to the software serial number, and decrypts the encrypted information using the first private key;Then, the license server 120 verifies the decrypted IP address according to the IP address of the network request, and verifies the decrypted MAC address according to the MAC address corresponding to the software serial number; after both are verified, the license server 120 generates a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and saves them; next, the license server 120 determines the core code purchased by the user according to the code identifier of the core code, and the license server 120 constructs the data to be encrypted according to the third public key, the fourth private key and the core code purchased by the user, and The second public key corresponding to the second private key encrypts the data to be encrypted. The license server 120 then returns the encrypted result as a license to the target virtual machine in the target physical machine. The software on the target virtual machine verifies the license using the second private key in the software package. Once the license passes verification, the core code obtained by decrypting the encrypted result using the second private key is saved to the memory of the target physical machine. This allows the user's software to execute the core code when it is run. The target virtual machine also saves the decrypted third and fourth public keys so that a new license can be obtained and verified using the third and fourth private keys the next time the software is started.
[0051] In some embodiments of the present application, for the generated first public key, first private key, second public key, and second private key, the license server 120 only stores the first private key and the second public key; for the generated third public key, third private key, fourth public key, and fourth private key, the license server 120 only stores the third private key and the fourth public key.
[0052] In some embodiments of the present application, the software source code includes only a core code, and the software cannot run normally without executing the core code.
[0053] In some embodiments of the present application, the software source code includes multiple core codes, and the software can still partially operate normally without executing a certain core code.
[0054] In some embodiments of the present application, the license server 120 generates a third public key, a third private key corresponding to the third public key, a fourth public key, and a fourth private key corresponding to the fourth public key upon determining that the difference between the current time and the time when the public and private keys were last generated for the software corresponding to the software serial number reaches a predetermined time length.
[0055] It should be understood that Figure 1The number of user terminals, cloud servers, license servers, and compile servers is merely illustrative. Any number of user terminals, cloud servers, license servers, and compile servers can be used as needed. In other words, there can be multiple user terminals, multiple cloud servers, and multiple compile servers, and the license server can be a server cluster consisting of multiple servers.
[0056] It should be noted that Figure 1 The embodiment shown is only one embodiment of the present application. Figure 1 In the embodiment, the user terminal is a desktop computer, and the software is run on a target physical machine in the cloud. The compilation of the software source code is performed on a server. However, in other embodiments of the present application, the software source code compilation device and the user terminal can also be various types of terminal devices such as desktop computers, laptops, tablet computers, vehicle-mounted terminals, portable wearable devices, workstations, etc. The software running device can be either an ordinary server or the various types of terminal devices mentioned above; although in Figure 1 In the embodiment, the purchase and operation of the software are both carried out through the cloud, but in other embodiments of the present application, the purchase and operation of the software can be carried out in different locations. For example, the software can be run through a physical machine in the cloud, while the purchase of the software is carried out through other servers outside the cloud; although in Figure 1 In the embodiment, the license server only stores the core code in the software source code. However, in other embodiments of the present application, the license server can also store all the software source code, as long as it can distinguish the core code in the software source code separately. Figure 1 In the embodiment, the software source code is compiled on a server outside the cloud. However, in other embodiments of the present application, the software source code can also be compiled on the cloud. The present embodiment does not impose any limitation on this, and the scope of protection of this application should not be limited by this.
[0057] It is easy to understand that the software authorization method provided in the embodiments of the present application is generally executed by a server, and accordingly, the software authorization device is generally set in the server. However, in other embodiments of the present application, the terminal device may also have similar functions as the server to implement the software authorization solution provided in the embodiments of the present application.
[0058] Therefore, the embodiments of the present application can be applied to terminals or servers. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected through wired or wireless communication, and this application does not limit this.
[0059] As previously mentioned, the solutions of the embodiments of the present application can be applied in cloud computing scenarios. Cloud computing is a computing model that distributes computing tasks across a resource pool consisting of a large number of computers, enabling various application systems to obtain computing power, storage space, and information services as needed. The network that provides resources is called a "cloud." From the user's perspective, the resources in the "cloud" are infinitely scalable and can be accessed at any time, used on demand, expanded at any time, and paid for on a per-use basis.
[0060] As a provider of cloud computing infrastructure, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) is established. Various types of virtual resources are deployed in the resource pool for external customers to choose and use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0061] Based on logical functional divisions, the PaaS (Platform as a Service) layer can be deployed on top of the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service) layer can be deployed on top of the PaaS layer. SaaS can also be deployed directly on top of IaaS. PaaS is a platform for software execution, such as databases and web containers. SaaS is a variety of business software, such as web portals and text messaging tools. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0062] The following is a detailed description of the implementation details of the technical solution of the embodiment of the present application:
[0063] Figure 2The flowchart of the software authorization method according to one embodiment of the present application is shown. The software authorization method can be executed by various devices with processing and computing functions. Specifically, it can be executed by a target device, such as a user terminal or a cloud server. The user terminal includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, smart watches, etc. Please refer to Figure 2 As shown, the software authorization method includes at least the following steps:
[0064] In step 210, after starting the software according to the acquired software package, hardware information of the target device is acquired, where the software package includes a first public key and a second private key.
[0065] A software package can be a package of various types of software, and the software can be installed and started using the software package. It is easy to understand that the start here may not be the successful start of the software, but may be the triggering of the software's start instruction.
[0066] The software package may be purchased by the user. After purchasing the software package, the user may download the software package from the terminal device of the software developer or the software package purchase platform through the target device, so that the target device acquires the software package.
[0067] The hardware information may include a plurality of information items.
[0068] Specifically, the target device's hardware information can include its IP address and MAC address. These addresses are the physical addresses of the target device. Since cloud-based virtual machines are automatically assigned virtual IP addresses and MAC addresses upon startup, and this virtual hardware information is different each time the virtual machine is started, this reduces the feasibility of cloud-based virtual machine software licensing.
[0069] In the embodiment of the present application, the target device is a physical device rather than the virtual machine where the physical machine is located. The target device can be the physical device where the virtual machine is located (such as a cloud server). Therefore, even if the software is running on a virtual machine, the solution of the embodiment of the present application also performs software authorization verification based on the hardware information of the physical device where the virtual machine is located, which makes software authorization for virtual machines on the cloud possible.
[0070] In one embodiment of the present application, the first public key, the first private key, the second public key and the second private key are generated by a license server, and the first public key and the second private key in the software package are obtained by the generator of the software package from the license server.
[0071] The generator of the software package may be a software developer. After the license server generates the first public key, the first private key, the second public key and the second private key, the license server sends the first public key and the second private key to the generator of the software package.
[0072] Figure 3 A schematic diagram of the overall process of software authorization according to an embodiment of the present application is shown; Figure 4 A schematic diagram of the process flow of the software compilation phase according to an embodiment of the present application is shown. Figure 3 and Figure 4 To further introduce the solution of the embodiment of this application.
[0073] See Figure 3 As shown, the user will start the software. Before executing this operation, you need to obtain the software package. Figure 4 As shown, in the software compilation phase, after the user purchases the software with the specified core code, the generator of the software package first requests the license server to generate public and private keys. The license server will generate public key A (first public key) in asymmetric encryption technology, private key A (first private key) corresponding to public key A, public key B (second public key) and private key B (second private key) corresponding to public key B, where public key A is used to encrypt machine hardware information and private key B is used to decrypt the core code in the license. The license server will at least save private key A and public key B and return public key A and private key B to the generator of the software package; the generator of the software will compile the software source code with the core code removed to obtain a compilation result, which is an original software package that does not contain public and private keys; then, the generator of the software will write public key A and private key B into the compilation result to obtain the final software package.
[0074] Figure 5 Schematic diagram of the process of software startup according to an embodiment of the present application. Figure 5 As shown, three objects are involved in the software startup phase, namely the user, the software, and the license server. When the user triggers the software startup instruction, the software can be started. After the software is started, it will first obtain the hardware information of the target device where the software is located. The hardware information includes the IP address and MAC address.
[0075] Please continue to see Figure 2 In step 220, the hardware information is encrypted based on the first public key to obtain encrypted information.
[0076] In one embodiment of the present application, hardware information is encrypted based on a first public key to obtain encrypted information, including: generating a random number, and constructing information to be encrypted based on the random number and the hardware information; encrypting the information to be encrypted based on the first public key to obtain encrypted information.
[0077] The random number can be a key for symmetric encryption, which can be 16 bits or 128 bits (16 bytes). The information to be encrypted constructed according to the random number and the hardware information contains both the random number and the hardware information. The information to be encrypted can be obtained by directly connecting the random number and the hardware information head to head. Specifically, the random number, IP address and MAC address are connected head to tail in sequence; the information to be encrypted can also be obtained by adding the random number and the hardware information to a pre-set data structure (such as a JSON data structure). By constructing the information to be encrypted in the form of a data structure, the license server can accurately determine what each information item in the information to be encrypted is after obtaining the information to be encrypted.
[0078] Please continue to see Figure 5 As shown, after obtaining the hardware information of the target device, the software generates a random number and uses public key A to encrypt the information to be encrypted including the random number and hardware information.
[0079] In step 230, the encrypted information is sent to the license server so that the license server decrypts the encrypted information according to the first private key corresponding to the first public key, verifies the decrypted hardware information, and after the hardware information passes the verification, encrypts the core code of the software according to the second public key corresponding to the second private key, and sends the encryption result as a license to the target device.
[0080] Please continue to see Figure 3 As shown, the software will send relevant information to the license server, and the relevant information here is encrypted information.
[0081] In one embodiment of the present application, the encrypted information is sent by the target device to the license server through a network request.
[0082] It's easy to understand that, in addition to carrying encrypted information, network requests can also carry information that helps the license server determine the identity of the software package. A license server can store more than one software package's public and private keys. Therefore, based on the software serial number, which uniquely identifies a software package, the license server can determine which private key to use to decrypt the encrypted information and which public key to use to encrypt the software's core code. Of course, this determination can also be made based on other information, such as user identification information, as long as this information can uniquely determine the identity of the software package currently undergoing authorization and authentication.
[0083] The license server decrypts the encrypted information according to the first private key corresponding to the first public key to obtain the random number and hardware information.
[0084] Figure 6FIG1 shows a flowchart of a license server verifying hardware information according to an embodiment of the present application. Figure 6 As shown, the license server verifies the hardware information, which may include the following process:
[0085] In step 610, the source IP address of the network request is obtained.
[0086] The source IP address can be directly obtained based on the received network request.
[0087] In step 620, the IP address in the hardware information is verified based on the comparison result between the source IP address and the IP address in the hardware information.
[0088] If the source IP address is consistent with the IP address in the hardware information, the IP address passes verification; if the source IP address is inconsistent with the IP address in the hardware information, the IP address fails verification.
[0089] In step 630, the MAC address in the hardware information is verified based on a comparison result between the pre-acquired MAC address and the MAC address in the hardware information.
[0090] The pre-acquired MAC address can be provided to the license server in advance by the user when purchasing the software package. It is the MAC address of the physical machine bound to the software purchased by the user. The usage environment of the software purchased by the user is limited, that is, the software purchased by the user can only run on this physical machine.
[0091] If the pre-obtained MAC address is consistent with the MAC address in the hardware information, the MAC address passes verification; if the pre-obtained MAC address is inconsistent with the MAC address in the hardware information, the MAC address fails verification.
[0092] The hardware information is verified only when both the IP address and MAC address are verified.
[0093] When the embodiment of the present application is actually applied, one of the IP address and the MAC address can be verified first, and only when the first one passes the verification can the other one be verified. The advantage of doing so is that it can reduce useless calculations and save computing resources.
[0094] Please continue to see Figure 5 As shown, the license server obtains the encrypted information from the target device and decrypts the encrypted information using the key corresponding to the public key A (private key A); then, the license server verifies the decrypted hardware information, wherein the IP address in the hardware information is verified by the source IP.
[0095] In one embodiment of the present application, the license server encrypts the core code of the software according to the second public key corresponding to the second private key in the following manner: generates a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and saves at least the third private key and the fourth public key; constructs the data to be encrypted according to the third public key, the fourth private key and the core code of the software, and encrypts the data to be encrypted according to the second public key corresponding to the second private key.
[0096] It is easy to understand that the data to be encrypted can also be constructed by adding the third public key, the fourth private key and the core code of the software into a specific data structure.
[0097] The third public key, third private key, fourth public key and fourth private key are two newly generated public-private key pairs, which correspond to the first public key, first private key, second public key and second private key respectively. When the user starts the software next time, the two newly generated public-private key pairs need to be used to execute the software authorization process.
[0098] The license server may store only the third private key and the fourth public key, or may store the third public key, the third private key, the fourth public key, and the fourth private key.
[0099] The license server generates the third public key, the third private key, the fourth public key and the fourth private key each time after starting the software on the target device and obtaining the encrypted information generated by starting the software from the target device. This ensures that the license can only be used once and then becomes invalid, thereby protecting the security of the license.
[0100] Figure 7 A schematic diagram showing a comparison between the information carried by a traditional license and the information carried by the license of this application according to an embodiment of the present application is shown. Figure 7 As shown, compared with the information included in a traditional license, the license information in the embodiment of the present application also includes the public key, private key and core code related to the next license.
[0101] Of course, the license server can also generate the third public key, third private key, fourth public key, and fourth private key under certain conditions: for example, if the software was last started more than a predetermined time (e.g., 24 hours) from the current time, then the third public key, third private key, fourth public key, and fourth private key will be generated; otherwise, the third public key, third private key, fourth public key, and fourth private key will not be generated. The advantage of this approach is that it reduces computing resource consumption while ensuring the security of the license.
[0102] The core code of the software can be uncompiled code, which, together with the code used to generate the software package, constitutes all the source code of the software. The core code of the software can be the code that the software relies on to run. If the core code of the software is not introduced during the operation of the software, then any function of the software cannot be used normally. The core code of the software can also be the code of an independent function in the software. In this case, a software can include multiple core codes, each of which can implement an independent function in the software. When the software is running, the absence of one or more core codes does not affect the implementation and use of the functions of the introduced core codes. In this case, the core code used to construct the data to be encrypted can be the code of a certain function (such as an advanced function) of the software purchased by the user.
[0103] The core code of the software may be provided to the license server in advance by the generator of the software package.
[0104] In one embodiment of the present application, the data to be encrypted is constructed according to the third public key, the fourth private key and the core code of the software, including: encrypting the core code of the software according to the random number obtained by decrypting the encrypted information to obtain the encrypted code; constructing the data to be encrypted according to the third public key, the fourth private key and the encrypted code.
[0105] When a random number is set, the security of the core code can be further improved by first encrypting the core code of the software using the random number obtained by decryption, and then constructing the data to be encrypted based on the third public key, the fourth private key and the encrypted code.
[0106] After encrypting the data to be encrypted, the license server sends the encrypted result as a license to the target device.
[0107] In one embodiment of the present application, constructing the data to be encrypted according to the third public key, the fourth private key and the encrypted code includes: constructing the data to be encrypted according to the third public key, the fourth private key, the expiration time and the encrypted code.
[0108] Please continue to see Figure 7 As shown, in the embodiment of the present application, the license information also includes an expiration time, which can be used to remind the user when the license expires.
[0109] Please continue to see Figure 3 As shown, the license server returns the license to the target device where the software is installed.
[0110] Please continue to see Figure 5As shown, when the hardware information passes the verification, the license server generates a new public key and a new secret key. Here, the new public key is public key C and public key D, and the new secret key is private key C and private key D. Then, the license server first uses a random number to encrypt the core code, and then uses the public key B to encrypt the entire encryption result of the public key C, private key D and the core code, thereby generating a license and sending the license to the target device where the software is located.
[0111] In step 240, the license is verified based on the second private key.
[0112] Verifying the license according to the second private key may be a process of decrypting the license using the second private key.
[0113] In one embodiment of the present application, verifying the license based on the second private key includes: determining whether the license can be successfully decrypted using the second private key; if the license can be successfully decrypted using the second private key, the license passes the verification; if the license cannot be successfully decrypted using the second private key, the license fails the verification.
[0114] After the license passes verification, the decryption result of the license can be obtained, which may include the third public key, the fourth private key, the expiration time and the encrypted code.
[0115] In step 250, after the license passes verification, the core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device so that the core code can be executed by the software at runtime.
[0116] In one embodiment of the present application, the core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device, including: decrypting the encrypted code obtained by decrypting the encryption result according to the second private key according to a random number to obtain the core code; and saving the core code in the memory of the target device.
[0117] Since the encrypted code is obtained by encrypting using a random number provided by the target device, it can be decrypted using the same random number.
[0118] The software dynamically executes the core code at runtime, and can realize the functional effects of the core code in the software.
[0119] In one embodiment of the present application, the core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device, including: saving the core code obtained by decrypting the encryption result according to the second private key in the memory of the target device, replacing the first public key in the software package with the third public key obtained by decrypting the encryption result according to the second private key, and replacing the second private key in the software package with the fourth private key obtained by decrypting the encryption result according to the second private key.
[0120] By replacing the first public key with the third public key and the second private key with the fourth private key, the first public key and the second private key cannot be used to start the software during the next verification. That is, the license can only be used once, thereby ensuring the security of the license.
[0121] Please continue to see Figure 3 As shown, after obtaining the license, the software feeds back the final startup result to the user based on the license, that is, whether the software is successfully started.
[0122] Please continue to see Figure 5 As shown, after the target device where the software is located receives the license, the software will verify the license, update the public key and private key, and update the core code to the memory, so that the software can be started successfully and the user can use the software normally.
[0123] Figure 8 FIG1 shows a flowchart of the steps after the license passes verification when the license has an expiration date according to an embodiment of the present application. Figure 8 As shown, in the case where the license carries an expiration date, after the license passes the verification, the method may further include the following steps:
[0124] In step 810, an expiration time is obtained by decrypting the encryption result using the second private key.
[0125] In step 820, the current time and the expiration time are compared to determine whether the license is invalid.
[0126] If the current time is greater than the expiration time, the license is invalid; otherwise, the license is not invalid.
[0127] In step 830, if the license is expired, the software is shut down.
[0128] When the license expires, the software can display a pop-up window to notify the user that the license has expired.
[0129] Regardless of whether the license has expired, the software may provide an interface for displaying the expiration time.
[0130] According to one aspect of the present application, the present application also provides another software authorization method. Figure 2 The software authorization method provided in the embodiment is corresponding and can be executed by a license server.
[0131] Figure 9 FIG1 shows a flowchart of a software authorization method according to another embodiment of the present application. Figure 9 As shown, the software authorization method may include the following steps:
[0132] In step 930, the encrypted information sent by the target device is obtained. The encrypted information is obtained by encrypting the hardware information of the target device based on the first public key in the software package after the target device starts the software according to the obtained software package. The software package includes the first public key and the second private key.
[0133] In step 940, the encrypted information is decrypted according to the first private key corresponding to the first public key to obtain the hardware information.
[0134] In step 950, the hardware information is verified, and if the hardware information passes the verification, the core code of the software is encrypted according to the second public key corresponding to the second private key.
[0135] In step 960, the encryption result is returned to the target device as a license so that the target device can verify the license based on the second private key. If the license passes the verification, the core code obtained by decrypting the encryption result based on the second private key is saved in the memory of the target device so that the core code can be executed when the software is running on the target device.
[0136] Figure 10 An embodiment according to the present application is shown Figure 9 Flowchart of steps before step 930 in the embodiment. Figure 10 As shown, before obtaining the encrypted information sent by the target device, the method may further include the following steps:
[0137] In step 910, a first public key, a first private key, a second public key, and a second private key are generated, and at least the first private key and the second public key are saved.
[0138] In step 920, the first public key and the second private key are sent to a generator of the software package, so that the generator of the software package generates a software package including the first public key and the second private key.
[0139] In one embodiment of the present application, the core code of the software is encrypted according to the second public key corresponding to the second private key, including: generating a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and saving at least the third private key and the fourth public key; constructing data to be encrypted according to the third public key, the fourth private key and the core code of the software, and encrypting the data to be encrypted according to the second public key corresponding to the second private key; when the license passes the verification, the steps executed by the target device also include: replacing the first public key in the software package with the third public key obtained by decrypting the encryption result according to the second private key, and replacing the second private key in the software package with the fourth private key obtained by decrypting the encryption result according to the second private key.
[0140] In one embodiment of the present application, the target device obtains encrypted information in the following manner: generates a random number, and constructs information to be encrypted based on the random number and hardware information; encrypts the information to be encrypted based on the first public key to obtain encrypted information; constructs data to be encrypted based on the third public key, the fourth private key and the core code of the software, including: encrypting the core code of the software based on the random number obtained by decrypting the encrypted information to obtain an encrypted code; constructs data to be encrypted based on the third public key, the fourth private key and the encrypted code; the target device saves the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device in the following manner: decrypts the encrypted code obtained by decrypting the encryption result according to the second private key according to the random number to obtain the core code; and saves the core code into the memory of the target device.
[0141] In one embodiment of the present application, the hardware information includes an IP address and a MAC address, and obtaining encrypted information sent by the target device includes: when receiving a network request from the target device, obtaining the encrypted information carried in the network request; verifying the hardware information includes: obtaining the source IP address of the network request; verifying the IP address in the hardware information based on the comparison result of the source IP address and the IP address in the hardware information; verifying the MAC address in the hardware information based on the comparison result of the pre-acquired MAC address and the MAC address in the hardware information.
[0142] For example, when a user starts and uses software protected by the solution provided in the embodiments of the present application, the user may perform the following operations:
[0143] When a user launches the software, they send their machine information to the license server. If the information is correct, the license server issues a license for the software. Once the license expires, the public and private keys used to decrypt the license change, rendering the license unusable. If a user encounters a problem and needs to restart the software, they must obtain a new license.
[0144] If the user wants to bypass the license during use, he or she may crack the software using other methods, obtain the source code, comment out the license verification code in the source code, and directly bypass the license. Then, after starting the cracked software, he or she will find that the software still cannot be used because the license contains core code. If the license is bypassed, the core code cannot be obtained, so the software still cannot run normally.
[0145] In summary, the software authorization method provided in the embodiments of the present application can achieve at least the following technical effects:
[0146] 1. Propose a solution to separate the core code. Under this solution, the core code is issued along with the license, stored in memory when the software is started, and dynamically executed at runtime to ensure the legal use of the software.
[0147] 2. A scheme for dynamically updating asymmetric keys is proposed. Under this scheme, the license can only be used once and then expires. This can effectively protect the security of the license and prevent the license from being copied and used on other machines.
[0148] In summary, the solutions of the embodiments of the present application provide multiple protections for the software, making it basically impossible for the software to be completely cracked directly by the outside world, and can well protect the intellectual property rights of the software and the legitimate rights and interests of software developers.
[0149] The following describes an embodiment of the device of the present application, which can be used to execute the software authorization method in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the software authorization method in the above embodiment of the present application.
[0150] Figure 11 FIG2 shows a block diagram of a software authorization device according to an embodiment of the present application. Figure 11As shown, a software authorization apparatus 1100 according to an embodiment of the present application is located in a target device, and includes: an acquisition unit 1110 , an encryption unit 1120 , a sending unit 1130 , a verification unit 1140 and a storage unit 1150 . Among them, the acquisition unit 1110 is used to obtain the hardware information of the target device after starting the software according to the acquired software package, and the software package includes a first public key and a second private key; the encryption unit 1120 is used to encrypt the hardware information based on the first public key to obtain encrypted information; the sending unit 1130 is used to send the encrypted information to the license server, so that the license server verifies the decrypted hardware information after decrypting the encrypted information according to the first private key corresponding to the first public key, and after the hardware information passes the verification, encrypts the core code of the software according to the second public key corresponding to the second private key, and sends the encrypted result as a license to the target device; the verification unit 1140 is used to verify the license according to the second private key; the saving unit 1150 is used to save the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device after the license passes the verification, so that the software can execute the core code at runtime.
[0151] In some embodiments of the present application, based on the aforementioned solution, the first public key, the first private key, the second public key and the second private key are generated by the license server, and the first public key and the second private key in the software package are obtained by the generator of the software package from the license server.
[0152] In some embodiments of the present application, based on the aforementioned scheme, the license server encrypts the core code of the software according to the second public key corresponding to the second private key in the following manner: generates a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and saves at least the third private key and the fourth public key; constructs data to be encrypted according to the third public key, the fourth private key and the core code of the software, and encrypts the data to be encrypted according to the second public key corresponding to the second private key; the saving unit 1150 is configured to: save the core code obtained by decrypting the encryption result according to the second private key to the memory of the target device, replace the first public key in the software package with the third public key obtained by decrypting the encryption result according to the second private key, and replace the second private key in the software package with the fourth private key obtained by decrypting the encryption result according to the second private key.
[0153] In some embodiments of the present application, based on the aforementioned scheme, the encryption unit 1120 is configured to: generate a random number, and construct information to be encrypted based on the random number and the hardware information; encrypt the information to be encrypted based on the first public key to obtain encrypted information; constructing the data to be encrypted based on the third public key, the fourth private key and the core code of the software, including: encrypting the core code of the software according to the random number obtained by decrypting the encrypted information to obtain an encrypted code; constructing the data to be encrypted according to the third public key, the fourth private key and the encrypted code; the saving unit 1150 is configured to: decrypt the encrypted code obtained by decrypting the encryption result according to the second private key according to the random number to obtain the core code; and save the core code to the memory of the target device.
[0154] In some embodiments of the present application, based on the aforementioned scheme, the device further includes an expiration time acquisition unit, a determination unit and a closing unit; the constructing of the data to be encrypted according to the third public key, the fourth private key and the encrypted code includes: constructing the data to be encrypted according to the third public key, the fourth private key, the expiration time and the encrypted code; after the license passes the verification, the expiration time acquisition unit is used to: obtain the expiration time obtained by decrypting the encryption result according to the second private key; the determination unit is used to: compare the current time and the expiration time to determine whether the license is invalid; the closing unit is used to: close the software if the license is invalid.
[0155] In some embodiments of the present application, based on the aforementioned scheme, the hardware information includes an IP address and a MAC address, and the encrypted information is sent by the target device to the license server through a network request. The license server verifies the hardware information in the following manner: obtaining the source IP address of the network request; verifying the IP address in the hardware information based on the comparison result of the source IP address and the IP address in the hardware information; verifying the MAC address in the hardware information based on the comparison result of the pre-acquired MAC address and the MAC address in the hardware information.
[0156] The embodiment of the present application also provides another software authorization device.
[0157] Figure 12 FIG2 shows a block diagram of a software authorization device according to another embodiment of the present application. Figure 12As shown, a software authorization device 1200 according to another embodiment of the present application is located in a license server. The device includes: an acquisition unit 1210 , a decryption unit 1220 , a verification and encryption unit 1230 , and a return unit 1240 . Among them, the acquisition unit 1210 is used to obtain encrypted information sent by the target device, and the encrypted information is obtained by encrypting the hardware information of the target device based on the first public key in the software package after the target device starts the software according to the acquired software package, and the software package includes a first public key and a second private key; the decryption unit 1220 is used to decrypt the encrypted information according to the first private key corresponding to the first public key to obtain the hardware information; the verification and encryption unit 1230 is used to verify the hardware information, and if the hardware information passes the verification, encrypt the core code of the software according to the second public key corresponding to the second private key; the return unit 1240 is used to return the encryption result as a license to the target device, so that the target device can verify the license according to the second private key, and if the license passes the verification, save the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device, so that the software can execute the core code when running on the target device.
[0158] In some embodiments of the present application, based on the aforementioned scheme, the apparatus further includes a generating unit and a sending unit; before obtaining the encrypted information sent by the target device, the generating unit is used to: generate the first public key, the first private key, the second public key and the second private key, and save at least the first private key and the second public key; the sending unit is used to: send the first public key and the second private key to the generator of the software package, so that the generator of the software package generates the software package including the first public key and the second private key.
[0159] In some embodiments of the present application, based on the aforementioned scheme, the verification and encryption unit 1230 is configured to: generate a third public key, a third private key corresponding to the third public key, a fourth public key and a fourth private key corresponding to the fourth public key, and save at least the third private key and the fourth public key; construct the data to be encrypted according to the third public key, the fourth private key and the core code of the software, and encrypt the data to be encrypted according to the second public key corresponding to the second private key; when the license passes the verification, the steps executed by the target device also include: replacing the first public key in the software package with the third public key obtained by decrypting the encryption result according to the second private key, and replacing the second private key in the software package with the fourth private key obtained by decrypting the encryption result according to the second private key.
[0160] In some embodiments of the present application, based on the aforementioned scheme, the target device obtains the encrypted information in the following manner: generates a random number, and constructs the information to be encrypted based on the random number and the hardware information; encrypts the information to be encrypted based on the first public key to obtain encrypted information; the verification and encryption unit 1230 is configured to: encrypt the core code of the software according to the random number obtained by decrypting the encrypted information to obtain an encrypted code; constructs the data to be encrypted according to the third public key, the fourth private key and the encrypted code; the target device saves the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device in the following manner: decrypts the encrypted code obtained by decrypting the encryption result according to the second private key according to the random number to obtain the core code; and saves the core code into the memory of the target device.
[0161] In some embodiments of the present application, based on the aforementioned scheme, the hardware information includes an IP address and a MAC address, and the acquisition unit 1210 is configured to: when a network request from the target device is received, obtain the encryption information carried in the network request; the verification and encryption unit 1230 is configured to: obtain the source IP address of the network request; verify the IP address in the hardware information based on the comparison result of the source IP address and the IP address in the hardware information; verify the MAC address in the hardware information based on the comparison result of the pre-acquired MAC address and the MAC address in the hardware information.
[0162] Figure 13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown.
[0163] It should be noted that Figure 13 The computer system 1300 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present application.
[0164] like Figure 13As shown, the computer system 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1302 or the program loaded from the storage part 1308 to the random access memory (RAM) 1303, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 1303. The CPU 1301, ROM 1302 and RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0165] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, and the like; an output section 1307 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1308 including a hard disk; and a communication section 1309 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. Removable media 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1310 as needed, so that computer programs read from the removable media can be installed in the storage section 1308 as needed.
[0166] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1309, and / or installed from a removable medium 1311. When the computer program is executed by the central processing unit (CPU) 1301, the various functions defined in the system of the present application are executed.
[0167] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0168] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0169] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0170] As one aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device implements the method described in the above embodiments.
[0171] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0172] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
[0173] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.
[0174] The data collection and processing plan in this application must be implemented in strict accordance with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject (or have a legal basis as required by the laws and regulations of relevant countries), and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0175] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A software authorization method, characterized in that: The method is executed by a target device, and includes: After launching software according to the acquired software package, obtaining hardware information of the target device, wherein the software package includes a first public key and a second private key; Encrypting the hardware information based on the first public key to obtain encrypted information; Sending the encrypted information to a license server, so that the license server decrypts the encrypted information using a first private key corresponding to the first public key, verifies the decrypted hardware information, and, after the hardware information passes the verification, encrypts the core code of the software using a second public key corresponding to the second private key, and issues the encrypted result as a license to the target device; verifying the license according to the second private key; After the license passes verification, the core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device, so that the software can execute the core code when running.
2. The software authorization method according to claim 1, characterized in that: The first public key, the first private key, the second public key, and the second private key are generated by the license server, and the first public key and the second private key in the software package are obtained from the license server by a generator of the software package.
3. The software authorization method according to claim 2, characterized in that: The license server encrypts the core code of the software according to the second public key corresponding to the second private key in the following manner: Generate a third public key, a third private key corresponding to the third public key, a fourth public key, and a fourth private key corresponding to the fourth public key, and save at least the third private key and the fourth public key; Constructing data to be encrypted according to the third public key, the fourth private key, and the core code of the software, and encrypting the data to be encrypted according to the second public key corresponding to the second private key; The step of decrypting the encryption result according to the second private key and saving the core code to the memory of the target device includes: The core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device, the first public key in the software package is replaced by the third public key obtained by decrypting the encryption result according to the second private key, and the second private key in the software package is replaced by the fourth private key obtained by decrypting the encryption result according to the second private key.
4. The software authorization method according to claim 3, characterized in that: The encrypting the hardware information based on the first public key to obtain encrypted information includes: Generate a random number, and construct information to be encrypted based on the random number and the hardware information; Encrypting the information to be encrypted based on the first public key to obtain encrypted information; The constructing the data to be encrypted according to the third public key, the fourth private key and the core code of the software includes: Encrypting the core code of the software according to the random number obtained by decrypting the encrypted information to obtain an encrypted code; Constructing data to be encrypted according to the third public key, the fourth private key and the encrypted code; The step of decrypting the encryption result according to the second private key and saving the core code to the memory of the target device includes: Decrypting the encrypted code obtained by decrypting the encryption result using the second private key according to the random number to obtain the core code; The core code is saved in the memory of the target device.
5. The software authorization method according to claim 4, characterized in that: The constructing the data to be encrypted according to the third public key, the fourth private key and the encrypted code includes: Constructing data to be encrypted according to the third public key, the fourth private key, the expiration time, and the encrypted code; After the license passes verification, the method further includes: Obtaining the expiration time obtained by decrypting the encryption result according to the second private key; Comparing the current time with the expiration time to determine whether the license is invalid; If the license expires, the software is closed.
6. The software authorization method according to claim 1, characterized in that: The hardware information includes an IP address and a MAC address. The encrypted information is sent by the target device to the license server via a network request. The license server verifies the hardware information in the following manner: Obtaining the source IP address of the network request; Verifying the IP address in the hardware information based on a comparison result between the source IP address and the IP address in the hardware information; The MAC address in the hardware information is verified based on a comparison result between the pre-acquired MAC address and the MAC address in the hardware information.
7. A software authorization method, characterized in that: The method is executed by a license server, and includes: Obtaining encrypted information sent by a target device, the encrypted information being obtained by encrypting hardware information of the target device based on a first public key in the software package after the target device starts software according to the obtained software package, the software package including the first public key and the second private key; decrypting the encrypted information according to a first private key corresponding to the first public key to obtain the hardware information; Verifying the hardware information, and if the hardware information passes the verification, encrypting the core code of the software according to the second public key corresponding to the second private key; The encryption result is returned to the target device as a license, so that the target device verifies the license according to the second private key. If the license passes the verification, the core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device, so that the core code is executed when the software is running on the target device.
8. The software authorization method according to claim 7, characterized in that: Before obtaining the encrypted information sent by the target device, the method further includes: Generate the first public key, the first private key, the second public key, and the second private key, and save at least the first private key and the second public key; The first public key and the second private key are sent to a generator of a software package, so that the generator of the software package generates the software package including the first public key and the second private key.
9. The software authorization method according to claim 8, characterized in that: The encrypting the core code of the software according to the second public key corresponding to the second private key includes: Generate a third public key, a third private key corresponding to the third public key, a fourth public key, and a fourth private key corresponding to the fourth public key, and save at least the third private key and the fourth public key; Constructing data to be encrypted according to the third public key, the fourth private key, and the core code of the software, and encrypting the data to be encrypted according to the second public key corresponding to the second private key; If the license passes the verification, the target device may further execute the following steps: The first public key in the software package is replaced by the third public key obtained by decrypting the encryption result according to the second private key, and the second private key in the software package is replaced by the fourth private key obtained by decrypting the encryption result according to the second private key.
10. The software authorization method according to claim 9, characterized in that: The target device obtains the encrypted information in the following manner: Generate a random number, and construct information to be encrypted based on the random number and the hardware information; Encrypting the information to be encrypted based on the first public key to obtain encrypted information; The constructing the data to be encrypted according to the third public key, the fourth private key and the core code of the software includes: Encrypting the core code of the software according to the random number obtained by decrypting the encrypted information to obtain an encrypted code; Constructing data to be encrypted according to the third public key, the fourth private key and the encrypted code; The target device saves the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device in the following manner: Decrypting the encrypted code obtained by decrypting the encryption result using the second private key according to the random number to obtain the core code; The core code is saved in the memory of the target device.
11. The software authorization method according to claim 7, wherein: The hardware information includes an IP address and a MAC address, and the encrypted information sent by the target device is obtained, including: When receiving a network request from the target device, obtaining the encrypted information carried in the network request; The verifying the hardware information includes: Obtaining the source IP address of the network request; Verifying the IP address in the hardware information based on a comparison result between the source IP address and the IP address in the hardware information; The MAC address in the hardware information is verified based on a comparison result between the pre-acquired MAC address and the MAC address in the hardware information.
12. A software authorization device, characterized in that: The apparatus is located in a target device, and includes: an acquiring unit, configured to acquire hardware information of the target device after starting software according to an acquired software package, wherein the software package includes a first public key and a second private key; an encryption unit, configured to encrypt the hardware information based on the first public key to obtain encrypted information; a sending unit, configured to send the encrypted information to a license server, so that the license server decrypts the encrypted information using a first private key corresponding to the first public key, verifies the decrypted hardware information, and, after the hardware information passes the verification, encrypts the core code of the software using a second public key corresponding to the second private key, and sends the encrypted result as a license to the target device; a verification unit, configured to verify the license according to the second private key; The storage unit is used to store the core code obtained by decrypting the encryption result according to the second private key into the memory of the target device after the license passes the verification, so that the software can execute the core code when running.
13. A software authorization device, characterized in that: The device is located in the license server, and the device includes: an acquiring unit, configured to acquire encrypted information sent by a target device, the encrypted information being obtained by encrypting hardware information of the target device based on a first public key in the software package after the target device starts software according to the acquired software package, the software package including the first public key and the second private key; a decryption unit, configured to decrypt the encrypted information according to a first private key corresponding to the first public key to obtain the hardware information; a verification and encryption unit, configured to verify the hardware information and, if the hardware information passes the verification, encrypt the core code of the software according to the second public key corresponding to the second private key; A return unit is used to return the encryption result as a license to the target device, so that the target device can verify the license according to the second private key, and if the license passes the verification, the core code obtained by decrypting the encryption result according to the second private key is saved in the memory of the target device, so that the software can execute the core code when running on the target device.
14. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the software authorization method according to any one of claims 1 to 6, or implements the software authorization method according to any one of claims 7 to 11.
15. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the software authorization method according to any one of claims 1 to 6, or the software authorization method according to any one of claims 7 to 11.