A method, device, medium and equipment for protecting copyright based on blockchain
By using blockchain technology in software to store and compare public key information and key information, the problem of software copyright protection is solved, effective tracing and punishment of illegal sharing is achieved, and the copyright security of software developers is ensured.
Patent Information
- Application Number
- CN202110001340.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-04
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-01-04
AI Technical Summary
In the existing technology, software developers can easily share the software with other people after users purchase it, making it difficult to implement copyright protection and making it impossible to trace and leak users.
Adopt a blockchain-based copyright protection method by storing public key information and key information in the application, and compare them at startup. If they are inconsistent, they will be sent to the alliance chain for penalty operations to ensure that only legitimate users use them and trace them back. Leak copyright.
It effectively protects the copyright of software developers, prevents illegal sharing and use, and improves the accuracy of copyright traceability and punishment.
Smart Images

Figure CN114722356B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of software development technology, and in particular, relates to a method, device, medium and computer equipment for protecting copyright based on blockchain. Background Art
[0002] With the development of the Internet, more and more software developers are developing various tool software and application software (collectively referred to as applications). Software development is a huge process that consumes a lot of time, effort and requires extremely high costs.
[0003] However, in the prior art, a user often buys the copyright and then shares the software with other users for free, so that other users can also use the genuine software, but it is impossible to find out which user leaked the serial number and registration code, resulting in the software developer's copyright not being protected. Summary of the invention
[0004] In view of the problems existing in the prior art, the embodiments of the present invention provide a method, apparatus, medium and computer equipment for protecting copyright based on blockchain, which are used to solve the technical problem in the prior art that when a user purchases software, he will distribute it to other people for use, resulting in the software developer's copyright not being protected.
[0005] The present invention provides a method for protecting copyright based on blockchain, the method comprising:
[0006] When the application is started using the first blockchain client, the public key information pre-stored in the application initialization file is obtained through a preset interface; the first application includes: a first application file and a second application file; the first application file includes: a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and the public key information; the public key information is generated based on the user's registration information;
[0007] Acquire key information stored in the application code, wherein the key information is data generated by encrypting the public key information;
[0008] Determine whether the public key information and the secret key information are consistent. If they are inconsistent, send the secret key information to the alliance chain so that the alliance chain performs a penalty operation on the user based on the secret key information.
[0009] Optionally, the method further includes:
[0010] When the application is started using the first blockchain client, the second application file is reported to the blockchain network; so that the second blockchain client calculates the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file; the first hash value is compared with the second hash value recorded in the blockchain network, and if it is determined that the first hash value and the second hash value are inconsistent, the second application file is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information in the second application file; wherein,
[0011] The second blockchain client is any client in the blockchain network except the first blockchain client.
[0012] Optionally, the method further includes:
[0013] When the application is running, based on a preset detection period, calculating a first hash value corresponding to the second main program file and a first hash value corresponding to the second module file in the second application;
[0014] Obtaining a second hash value corresponding to the second main program file and a second hash value corresponding to the second module file from the blockchain network;
[0015] The first hash value is compared with the second hash value. If it is determined that the first hash value and the second hash value are inconsistent, the key information is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information.
[0016] Optionally, the method further includes:
[0017] When the application is running, based on a preset detection period, using the first blockchain client to calculate a first hash value of the second main program file in the second application and a first hash value corresponding to the second module file;
[0018] The first hash value of the second main program file and the first hash value corresponding to the second module file are reported to the alliance chain, so that the alliance chain determines whether the first hash value and the second hash value exist. If it is determined that the first hash value and / or the second hash value do not exist, the user is directly prohibited from logging in.
[0019] Optionally, obtaining the public key information pre-stored in the application initialization file includes:
[0020] When the application is the first main program file and the second main program file, extracting the public key information from the execution files in the first main program file and the second main program file by using the preset interface;
[0021] When the application program is the first module file and the second module file, the public key information is extracted from the codes in the first module file and the second module file using the preset interface.
[0022] Optionally, the obtaining key information stored in the application code includes:
[0023] Determining a storage address of the key information based on a memory allocation address in the application;
[0024] Based on the storage address, extract the key information using a key acquisition function Char key[]={'x1','x2','x3','x4','x5','x6','x7','x8','x9'};
[0025] The key information is decrypted to obtain the decrypted key information; x1, x2, x3, x4, x5, x6, x7, x8 and x9 are characters of the key information.
[0026] The present invention also provides a device for protecting copyright based on blockchain, the device comprising:
[0027] A first acquisition unit is used to acquire public key information pre-stored in an application initialization file through a preset interface when starting an application using a first blockchain client; the application includes: a first application file and a second application file; the first application file includes: a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and the public key information; the public key information is generated based on the user's registration information;
[0028] A second acquisition unit is used to acquire key information stored in the application code, where the key information is data generated by encrypting the public key information;
[0029] A judging unit is used to judge whether the public key information and the secret key information are consistent. If they are inconsistent, the secret key information is sent to the alliance chain so that the alliance chain performs a penalty operation on the user based on the secret key information.
[0030] Optionally, the device further comprises:
[0031] A reporting unit is used to report the second application file to the blockchain network when the application is started by using the first blockchain client; so that the second blockchain client calculates the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file; compares the first hash value with the second hash value recorded in the blockchain network, and if it is determined that the first hash value and the second hash value are inconsistent, sends the second application file to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information in the second application file; wherein,
[0032] The second blockchain client is any client in the blockchain network except the first blockchain client.
[0033] The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned methods is implemented.
[0034] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described methods when executing the program.
[0035] The present invention provides a method, device, medium and computer equipment for protecting copyright based on blockchain, the method comprising: when using a first blockchain client to start an application, obtaining public key information pre-stored in an application initialization file; the application comprises: a first application file and a second application file; the first application file comprises a first main program file and a first module file, and the second application file comprises: a second main program file, a second module file and the public key information; obtaining key information stored in the application code, the key information being data generated after encrypting the public key information; judging whether the public key information and the key information are consistent, and if they are inconsistent, sending the key information to an alliance chain, so that the alliance chain is based on the key information Punishment is performed on the user; in this way, even if the purchasing user modifies the public key information, and then sends the public key information and the corresponding file of the application to another user, to ensure that both himself and the other user can use it normally; however, because the key information hidden in the program code in this application is highly concealed, it is difficult to be cracked by the purchasing user and another user (the purchasing user's shared user); in this way, when the other user uses it, it will cause inconsistencies between the public key information and the key information, and then it can be determined that the other user is an abnormal user; in addition, because the public key information and the key information are generated based on the registration information of the purchasing user, the registration information of the purchasing user can be determined based on the key information, and the purchasing user who leaked the copyright can be traced back to the purchasing user, and then the purchasing user and the other user can be punished to protect the copyright of the software developer. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0037] Figure 1 A flowchart of a method for protecting copyright based on blockchain provided by an embodiment of the present invention;
[0038] Figure 2 A schematic diagram of the structure of a device for protecting copyright based on blockchain provided in an embodiment of the present invention;
[0039] Figure 3 A schematic diagram of the structure of a computer device for protecting copyright based on blockchain provided by an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of the computer storage medium structure for protecting copyright based on blockchain provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to solve the technical problem in the prior art that when a user purchases software, he will distribute it to other people for use, resulting in the software developer's copyright not being protected. The present invention provides a method, device, medium and computer equipment for protecting copyright based on blockchain.
[0042] In order to better understand the above technical scheme, the technical scheme of the embodiments of this specification is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of this specification and the specific features in the embodiments are detailed descriptions of the technical scheme of the embodiments of this specification, rather than limitations on the technical scheme of this specification. In the absence of conflict, the embodiments of this specification and the technical features in the embodiments can be combined with each other.
[0043] Embodiment 1
[0044] This embodiment provides a method for protecting copyright based on blockchain, such as Figure 1 Said method comprises the following steps:
[0045] S110, when starting the application using the first blockchain client, obtaining public key information pre-stored in the application initialization file;
[0046] Here, in order to use the application to trace the user's identity information, before using the first blockchain client to start the application, when the user purchases the application, he needs to first download the blockchain client and purchase the application from the blockchain client. Each user corresponds to a blockchain client, thereby forming a blockchain network; the blockchain network contains multiple blockchain clients.
[0047] When a user purchases an application, a transaction message will be generated. The blockchain client corresponding to the user will broadcast the transaction message to the blockchain network, and other clients in the blockchain network can also obtain the transaction message.
[0048] When the transaction information is generated, the blockchain client will send the transaction information to the alliance chain, and the alliance chain will send payment information based on the transaction information to obtain the user's payment fee. Among them, the alliance chain can be understood as a server with a very high degree of trust, such as an intranet server.
[0049] Here, in order to ensure that only the purchasing user can use the application normally, in order to be able to trace the purchasing user information that leaks the copyright, and in order to improve the efficiency of different purchasing users obtaining the application, the application is divided into two parts in this embodiment, that is, the application includes: a first application file and a second application file; the first application file includes a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and public key information. Among them, the public key information is generated based on the user's registration information, and the user's registration information may include but is not limited to: user name (company name or personal name), account number, login password, identity (such as personal ID number or company organization code), etc.
[0050] Because each application includes a main program and multiple module files, for example, the main program is A, and the module files include B and C; then the main program can be split into A1 and A2, module file B can be split into B1 and B2, and module files can be split into C1 and C2; then the first application file includes A1, B1 and C1; the second application file includes A2, B3, C2 and public key information. Because the public key information is generated based on the user registration information; therefore, for all users, the first application file is universal, and the second application is different for each user.
[0051] In this way, since the first application file is universal, the purchasing user can download the first application file from any client in the blockchain network, thereby avoiding the need for all purchasing users to download it from the server, resulting in excessive processing burden on the server and uncertainty in download speed.
[0052] When the first application file is downloaded, a transaction message will be generated. The blockchain client will send the transaction message to the alliance chain, and the alliance chain will send payment information based on the transaction message to obtain the user's payment fee.
[0053] When the purchaser successfully pays, the consortium chain will send the second application file to the purchaser's blockchain client, and the blockchain client will get a complete application data package, and then can use the application normally. In addition, because the second application file carries the user's registration information, once the purchaser leaks the application to a non-purchaser, the registration information can be traced back to the leaking user.
[0054] Furthermore, after the alliance chain sends the second application file to the purchasing user, it will calculate the corresponding hash values for the second main program file and the second module file in the second application file, and publish each HASH value together with the user's public key information in the blockchain network, so that the blockchain network records the hash value of the second main program file in the second application file and the hash value of each second module file.
[0055] It should be noted that the public key information is stored in the second main program in the second application file and in the initialization file in each second module file to ensure that the application can quickly obtain the public key information when it is started. Since the main program and the module file are essentially different, the storage location of the public key information is also different. For the main program, the public key information can be stored in the executable file EXE of the main program; for the module file, the public key information can be stored in the initialization code file of the module file. After storing the public key information, it is also necessary to add the corresponding external interface in the executable file of the main program and the initialization code file of the module file.
[0056] Furthermore, in order to verify whether the user of the application is legitimate, this embodiment also needs to store key information in the second application file of the application. The key information is data generated by encrypting the public key information, so the key information should be consistent with the public key information.
[0057] Here, in order to increase the difficulty of cracking the key information, the key information is stored in the code of the second application file and the code of the second module file respectively; compared with directly storing the key information in the data segment, the concealment of the key information can be improved. Among them, the addition of the external interface and the storage of the key information are implemented as follows:
[0058]
[0059] It can be seen that when storing key information, a new memory needs to be allocated in the code of the second application file and the code of the second module file respectively, and the string of the key information is copied to the memory. After returning to the memory, the key information is stored in the memory; x1, x2, x3, x4, x5, x6, x7, x8 and x9 are the characters of the key information.
[0060] In this way, the second application file and the second module file in the second application include both the public key information and the secret key information.
[0061] Then, when the first blockchain client is used to start the application, the public key information pre-stored in the application initialization file can be obtained through the preset interface.
[0062] As an optional embodiment, obtaining the public key information pre-stored in the application initialization file through a preset interface includes:
[0063] When the application program is the first main program file and the second main program file, extracting the public key information from the execution files in the first main program file and the second main program file using a preset interface;
[0064] When the application is a first module file and a second module file, the public key information is extracted from the code in the first module file and the second module file using the preset interface. The code is implemented as follows:
[0065] Char* data = getKey();
[0066] data is the obtained public key information.
[0067] In this step, public key information is generated based on user registration information, and the public key information is encrypted to generate key information. By adding the public key and key information to the second application, the public key information and key information can be used to detect whether the user of the application is legal, and trace back to the purchasing user information that leaked the copyright. In addition, storing the public key information and key information in the code segment also facilitates subsequent code integrity verification. If the public key information and key information are stored in the data segment, it will be difficult to verify the code integrity because the data in the data segment will change.
[0068] S111, obtaining key information stored in the application code, wherein the key information is data generated by encrypting the public key information;
[0069] After obtaining the public key information, the key information stored in the application code can be obtained. The key information is data generated after encrypting the public key information. The public key information is generated according to the user's registration information.
[0070] As an optional embodiment, obtaining key information stored in the application code includes:
[0071] Determine a storage address of the key information based on a memory allocation address in the application;
[0072] Based on the storage address, the key information is extracted using the key acquisition function Char key[]={'x1','x2','x3','x4','x5','x6','x7','x8','x9'};
[0073] Decrypt the key information to obtain the decrypted key information; x1, x2, x3, x4, x5, x6, x7, x8 and x9 are characters of the key information.
[0074] In this step, the key information is obtained from the code segment through the key acquisition function, which can ensure the security of the key information and increase the difficulty for illegal users to obtain it.
[0075] S112, determining whether the public key information and the secret key information are consistent; if they are inconsistent, sending the secret key information to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the secret key information.
[0076] After obtaining the key information, the judgment function If (data! = key) is used to determine whether the public key information and the key information are consistent. If they are inconsistent, the user registration information is sent to the alliance chain, and the alliance chain performs a penalty operation on the user based on the user registration information. Key is the key information, and data is the public key information.
[0077] Specifically, if it is determined that the public key information and the secret key information are inconsistent, it means that the public key information has been modified, which further indicates that the user who is using the application is an abnormal user (has not purchased the application). At this time, the secret key information can be sent to the alliance chain. The alliance chain determines the user's registration information based on the secret key information, and then determines the user's account, identity, account and login password, and then performs punishment operations on the user based on the registration information, such as banning the account.
[0078] Furthermore, this embodiment uses key information to perform penalty operations on users, which can improve the accuracy of identification and avoid erroneous penalty on other users.
[0079] For example, if user D purchased an application and leaked it to E, and user E knew where the public key information was stored in the application, he would modify the public key information to the public key of user F; if the user was directly triggered based on the public key information, the alliance chain would directly ban user F. Therefore, this embodiment traces the user who leaked the copyright based on the key information. User E only changed the public key information that is easy to modify, and he did not know the hidden key information, so he did not modify the key information of user D. When the alliance chain can verify based on the key information, it can be determined that it is user D who actually leaked the copyright.
[0080] Furthermore, since the blockchain network records the hash value of the second main program file in the second application file and the hash value of each second module file, the blockchain network has a consensus mechanism, so the method also includes:
[0081] When the application is started using the first blockchain client, the second application file is reported to the blockchain network; so that the second blockchain client calculates the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file; the first hash value is compared with the second hash value recorded in the blockchain network (the second hash value of the second main program file and the second hash value corresponding to the second module file), and if it is determined that the first hash value and the second hash value are inconsistent, the second application file is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information in the second application file; wherein the second blockchain client is any client in the blockchain network except the first blockchain client.
[0082] Similarly, even if the alliance link receives the public key information sent by the second blockchain client, in order to ensure the accuracy of the punishment, when verifying the user who leaked the copyright, it is actually necessary to obtain the user registration information based on the key information hidden in the code segment, and then identify the user who leaked the copyright.
[0083] Furthermore, an abnormal user may modify the public key information during the running of the application. As an optional embodiment, the integrity of the code may also be verified, including:
[0084] When the application is running, based on a preset detection period, the first hash value corresponding to the second main program file in the second application and the first hash value corresponding to the second module file are calculated; wherein the detection period can be, for example, 1 hour, which is not limited here.
[0085] Obtaining a second hash value corresponding to the second main program file and a second hash value corresponding to the second module file from the blockchain network;
[0086] The first hash value is compared with the second hash value. If it is determined that the first hash value and the second hash value are inconsistent, the key information is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information.
[0087] If it is determined that the first hash value and the second hash value are consistent, determine whether there is a hash value that is the same as the second hash value. If so, it indicates that there is a copyright leak. At this time, the user who leaked the copyright can be traced back through the key information and punished.
[0088] Alternatively, as an optional embodiment, the method further includes:
[0089] When the application is running, based on a preset detection period, the first blockchain client is used to calculate the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file;
[0090] The first hash value of the second main program file and the first hash value corresponding to the second module file are reported to the alliance chain, so that the alliance chain determines whether the first hash value and the second hash value exist. If it is determined that the first hash value and / or the second hash value do not exist, it means that the application has been modified by the user, and the user is directly punished (such as being prohibited from logging in).
[0091] In summary, the consortium chain can impose penalties on users in two situations:
[0092] The first type: If the first hash value and the second hash value are inconsistent, it means that the application has been modified. In this case, the abnormal user can be traced back through the user registration information, and the user can be denied access to the application's functions. The user who leaked the copyright and the user who shared the purchased user can also be banned.
[0093] The second method is to determine whether there is a hash value that is the same as the second hash value if it is determined that the first hash value is consistent with the second hash value. If so, it indicates that there is a copyright leakage. At this time, the user who leaked the copyright can be traced through the key information, and the user who leaked the copyright and the sharing user of the purchasing user can be banned.
[0094] The third type is that if it is determined that the first hash value and / or the second hash value does not exist, it means that the corresponding blockchain client has been modified, and the user is prohibited from logging in through the client.
[0095] In this step, the leak is determined by judging whether the public key information is consistent with the key information, and the leak is determined by verifying the integrity of the code. Then, the user who leaked the copyright is tracked through the public key information and the key information, and then the user and the shared user are punished. Because the application corresponding to each user in this implementation is essentially different, the hash value of each user is also unique. Therefore, using the hash value to determine whether the application is leaked can ensure the accuracy of the inspection, and then ensure the accuracy of the punishment, and effectively protect the copyright.
[0096] Based on the same inventive concept, the present invention also provides a device for protecting copyright based on blockchain, see Example 2 for details.
[0097] Embodiment 2
[0098] This embodiment provides a device for protecting copyright based on blockchain, such as Figure 2 As shown, the device includes: a first acquisition unit 21, a second acquisition unit 22 and a judgment unit 23; wherein,
[0099] The first acquisition unit 21 is used to acquire the public key information pre-stored in the application initialization file through a preset interface when the application is started by using the first blockchain client; the application includes: a first application file and a second application file; the first application file includes a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and user registration information;
[0100] The second acquisition unit 22 is used to acquire key information stored in the application code by using a preset key acquisition function, where the key information is data generated by encrypting the public key information;
[0101] The judgment unit 23 is used to judge whether the public key information and the key information are consistent. If they are inconsistent, the user registration information is sent to the alliance chain so that the alliance chain performs a penalty operation on the user based on the user registration information.
[0102] Here, in order to use the application to trace the user's identity information, before using the first blockchain client to start the application, when the user purchases the application, he needs to first download the blockchain client and purchase the application from the blockchain client. Each user corresponds to a blockchain client, thereby forming a blockchain network; the blockchain network contains multiple blockchain clients.
[0103] When a user purchases an application, a transaction message will be generated. The blockchain client corresponding to the user will broadcast the transaction message to the blockchain network, and other clients in the blockchain network can also obtain the transaction message.
[0104] When the transaction information is generated, the blockchain client will send the transaction information to the alliance chain, and the alliance chain will send payment information based on the transaction information to obtain the user's payment fee. Among them, the alliance chain can be understood as a server with a very high degree of trust, such as an intranet server.
[0105] Here, in order to ensure that only the purchasing user can use the application normally, in order to be able to trace the purchasing user information that leaks the copyright, and in order to improve the efficiency of different purchasing users obtaining the application, the application is divided into two parts in this embodiment, that is, the application includes: a first application file and a second application file; the first application file includes a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and public key information. Among them, the public key information is generated based on the user's registration information, and the user's registration information may include but is not limited to: user name (company name or personal name), account number, login password, identity (such as personal ID number or company organization code), etc.
[0106] Because each application includes a main program and multiple module files, for example, the main program is A, and the module files include B and C; then the main program can be split into A1 and A2, module file B can be split into B1 and B2, and module files can be split into C1 and C2; then the first application file includes A1, B1 and C1; the second application file includes A2, B3, C2 and public key information. Because the public key information is generated based on the user registration information; therefore, for all users, the first application file is universal, and the second application is different for each user.
[0107] In this way, since the first application file is universal, the purchasing user can download the first application file from any client in the blockchain network, thereby avoiding the need for all purchasing users to download it from the server, resulting in excessive processing burden on the server and uncertainty in download speed.
[0108] When the first application file is downloaded, a transaction message will be generated. The blockchain client will send the transaction message to the alliance chain, and the alliance chain will send payment information based on the transaction message to obtain the user's payment fee.
[0109] When the purchaser successfully pays, the consortium chain will send the second application file to the purchaser's blockchain client, and the blockchain client will get a complete application data package, and then can use the application normally. In addition, because the second application file carries the user's registration information, once the purchaser leaks the application to a non-purchaser, the registration information can be traced back to the leaking user.
[0110] Furthermore, after the alliance chain sends the second application file to the purchasing user, it will calculate the corresponding hash values for the second main program file and the second module file in the second application file, and publish each HASH value together with the user's public key information in the blockchain network, so that the blockchain network records the hash value of the second main program file in the second application file and the hash value of each second module file.
[0111] It should be noted that the public key information is stored in the second main program in the second application file and in the initialization file in each second module file to ensure that the application can quickly obtain the public key information when it is started. Since the main program and the module file are essentially different, the storage location of the public key information is also different. For the main program, the public key information can be stored in the executable file EXE of the main program; for the module file, the public key information can be stored in the initialization code file of the module file. After storing the public key information, it is also necessary to add the corresponding external interface in the executable file of the main program and the initialization code file of the module file.
[0112] Furthermore, in order to verify whether the user of the application is legitimate, this embodiment also needs to store key information in the second application file of the application. The key information is data generated by encrypting the public key information, so the key information should be consistent with the public key information.
[0113] Here, in order to increase the difficulty of cracking the key information, the key information is stored in the code of the second application file and the code of the second module file respectively; compared with directly storing the key information in the data segment, the concealment of the key information can be improved. Among them, the addition of the external interface and the storage of the key information are implemented as follows:
[0114]
[0115] It can be seen that when storing key information, a new memory needs to be allocated in the code of the second application file and the code of the second module file respectively, and the string of the key information is copied to the memory. After returning to the memory, the key information is stored in the memory; x1, x2, x3, x4, x5, x6, x7, x8 and x9 are the characters of the key information.
[0116] In this way, the second application file and the second module file in the second application include both the public key information and the secret key information.
[0117] Then, when the first blockchain client is used to start the application, the public key information pre-stored in the application initialization file can be obtained through the preset interface.
[0118] As an optional embodiment, the first acquisition unit 21 acquires the public key information pre-stored in the application initialization file through a preset interface, including:
[0119] When the application program is the first main program file and the second main program file, extracting the public key information from the execution files in the first main program file and the second main program file using a preset interface;
[0120] When the application is a first module file and a second module file, the public key information is extracted from the code in the first module file and the second module file using the preset interface. The code is implemented as follows:
[0121] Char* data = getKey();
[0122] data is the obtained public key information.
[0123] In this step, public key information is generated based on user registration information, and the public key information is encrypted to generate key information. By adding the public key and key information to the second application, the public key information and key information can be used to detect whether the user of the application is legal, and trace back to the purchasing user information that leaked the copyright. In addition, storing the public key information and key information in the code segment also facilitates subsequent code integrity verification. If the public key information and key information are stored in the data segment, it will be difficult to verify the code integrity because the data in the data segment will change.
[0124] After obtaining the public key information, the preset key acquisition function can be used to obtain the key information stored in the application code. The key information is data generated after encrypting the public key information.
[0125] As an optional embodiment, the second acquisition unit 22 uses a preset key acquisition function to acquire the key information stored in the application code, including:
[0126] Determine a storage address of the key information based on a memory allocation address in the application;
[0127] Based on the storage address, the key information is extracted using the key acquisition function Char key[]={'x1','x2','x3','x4','x5','x6','x7','x8','x9'};
[0128] Decrypt the key information to obtain the decrypted key information; x1, x2, x3, x4, x5, x6, x7, x8 and x9 are characters of the key information.
[0129] In this step, the key information is obtained from the code segment through the key acquisition function, which can ensure the security of the key information and increase the difficulty for illegal users to obtain it.
[0130] After obtaining the key information, the judgment unit 23 is used to use the judgment function If (data! = key) to determine whether the public key information and the key information are consistent. If they are inconsistent, the user registration information is sent to the alliance chain, and the alliance chain performs a penalty operation on the user based on the user registration information. Key is the key information, and data is the public key information.
[0131] Specifically, if it is determined that the public key information and the secret key information are inconsistent, it means that the public key information has been modified, which further indicates that the user who is using the application is an abnormal user (has not purchased the application). At this time, the secret key information can be sent to the alliance chain. The alliance chain determines the user's registration information based on the secret key information, and then determines the user's account, identity, account and login password, and then performs punishment operations on the user based on the registration information, such as banning the account.
[0132] Furthermore, this embodiment uses key information to perform penalty operations on users, which can improve the accuracy of identification and avoid erroneous penalty on other users.
[0133] For example, if user D purchased an application and leaked it to E, and user E knew where the public key information was stored in the application, he would modify the public key information to the public key of user F; if the user was directly triggered based on the public key information, the alliance chain would directly ban user F. Therefore, this embodiment traces the user who leaked the copyright based on the key information. User E only changed the public key information that is easy to modify, and he did not know the hidden key information, so he did not modify the key information of user D. When the alliance chain can verify based on the key information, it can be determined that it is user D who actually leaked the copyright.
[0134] Furthermore, since the blockchain network records the hash value of the second main program file in the second application file and the hash value of each second module file, the blockchain network has a consensus mechanism, so the device further includes a broadcast unit 24;
[0135] When the application is started using the first blockchain client, the broadcast unit 24 reports the second application file to the blockchain network; so that the second blockchain client calculates the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file; the first hash value is compared with the second hash value recorded in the blockchain network (the second hash value of the second main program file and the second hash value corresponding to the second module file), and if it is determined that the first hash value and the second hash value are inconsistent, the second application file is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information in the second application file; wherein the second blockchain client is any client in the blockchain network except the first blockchain client.
[0136] Similarly, even if the alliance link receives the public key information sent by the second blockchain client, in order to ensure the accuracy of the punishment, when verifying the user who leaked the copyright, it is actually necessary to obtain the user registration information based on the key information hidden in the code segment, and then identify the user who leaked the copyright.
[0137] Furthermore, an abnormal user may modify the public key information during the running of the application. As an optional embodiment, the integrity of the code may also be verified. Specifically, the judgment unit 23 is further used to:
[0138] When the application is running, based on a preset detection period, the first hash value corresponding to the second main program file in the second application and the first hash value corresponding to the second module file are calculated; wherein the detection period can be, for example, 1 hour, which is not limited here.
[0139] Obtaining a second hash value corresponding to the second main program file and a second hash value corresponding to the second module file from the blockchain network;
[0140] The first hash value is compared with the second hash value. If it is determined that the first hash value and the second hash value are inconsistent, the key information is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information.
[0141] If it is determined that the first hash value and the second hash value are consistent, determine whether there is a hash value that is the same as the second hash value. If so, it indicates that there is a copyright leak. At this time, the user who leaked the copyright can be traced back through the key information and punished.
[0142] Alternatively, as an optional embodiment, the judging unit 23 is further configured to:
[0143] When the application is running, based on a preset detection period, the first blockchain client is used to calculate the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file;
[0144] The first hash value of the second main program file and the first hash value corresponding to the second module file are reported to the alliance chain, so that the alliance chain determines whether the first hash value and the second hash value exist. If it is determined that the first hash value and / or the second hash value do not exist, it means that the application has been modified by the user, and then the user is punished based on the user registration information (such as prohibiting their login).
[0145] In summary, the consortium chain can impose penalties on users in two situations:
[0146] The first type: If the first hash value and the second hash value are inconsistent, it means that the application has been modified. In this case, the abnormal user can be traced back through the user registration information, and the user can be denied access to the application's functions. The user who leaked the copyright and the user who shared the purchased user can also be banned.
[0147] The second method is to determine whether there is a hash value that is the same as the second hash value if it is determined that the first hash value is consistent with the second hash value. If so, it indicates that there is a copyright leakage. At this time, the user who leaked the copyright can be traced through the key information, and the user who leaked the copyright and the sharing user of the purchasing user can be banned.
[0148] The third type is that if it is determined that the first hash value and / or the second hash value does not exist, it means that the corresponding blockchain client has been modified, and the user is prohibited from logging in through the client.
[0149] In this step, the leak is determined by judging whether the public key information is consistent with the key information, and the leak is determined by verifying the integrity of the code. Then, the user who leaked the copyright is tracked through the public key information and the key information, and then the user and the shared user are punished. Because the application corresponding to each user in this implementation is essentially different, the hash value of each user is also unique. Therefore, using the hash value to determine whether the application is leaked can ensure the accuracy of the inspection, and then ensure the accuracy of the punishment, and effectively protect the copyright.
[0150] The method, device, medium and computer equipment for protecting copyright based on blockchain provided by the present invention can bring at least the following beneficial effects:
[0151] The present invention provides a method, device, medium and computer equipment for protecting copyright based on blockchain, the method comprising: when using a first blockchain client to start an application, obtaining public key information pre-stored in an application initialization file; the application comprises: a first application file and a second application file; the first application file comprises a first main program file and a first module file, the second application file comprises: a second main program file, a second module file and public key information; the public key information is generated based on the user's registration information; obtaining key information stored in the application code, the key information is data generated after encrypting the public key information; judging whether the public key information and the key information are consistent, if not consistent, sending the key information to the alliance chain, so that The alliance chain performs punishment operations on users based on the key information; in this way, even if the purchasing user modifies the public key information, and then sends the public key information and the file corresponding to the application to another user, it ensures that both the purchasing user and the other user can use it normally; however, because the key information hidden in the program code in this application is highly concealed, it is difficult to be cracked by the purchasing user and the other user; in this way, when the other user uses it, it will cause inconsistencies between the public key information and the key information, and then it can be determined that the other user is an abnormal user; in addition, because the public key information and the key information are generated based on the registration information of the purchasing user, the registration information of the purchasing user can be determined based on the key information, and the purchasing user who leaked the copyright can be traced back, and then the purchasing user and the other user can be punished to protect the copyright of the software developer.
[0152] Embodiment 3
[0153] This embodiment provides a computer device, such as Figure 3 As shown, it includes a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0154] When the application is started using the first blockchain client, the public key information pre-stored in the application initialization file is obtained; the first application includes: a first application file and a second application file; the first application file includes a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and the public key information; the public key information is generated based on the user's registration information;
[0155] Acquire key information stored in the application code, where the key information is data generated by encrypting the public key information;
[0156] Determine whether the public key information and the secret key information are consistent. If they are inconsistent, send the secret key information to the alliance chain so that the alliance chain performs a penalty operation on the user based on the secret key information.
[0157] In the specific implementation process, when the processor 320 executes the computer program 311, any implementation method in the first embodiment can be implemented.
[0158] Since the computer device introduced in this embodiment is a device used to implement a method for protecting copyright based on blockchain in the first embodiment of this application, based on the method introduced in the first embodiment of this application, the technical personnel in this field can understand the specific implementation of the computer device in this embodiment and its various variations, so how the server implements the method in the embodiment of this application is not described in detail here. As long as the technical personnel in this field implement the device used in the method in the embodiment of this application, it belongs to the scope of protection of this application.
[0159] Based on the same inventive concept, the present application provides a storage medium corresponding to the first embodiment, see the fourth embodiment for details.
[0160] Embodiment 4
[0161] This embodiment provides a computer-readable storage medium 400, such as Figure 4 As shown, a computer program 411 is stored thereon, and when the computer program 411 is executed by a processor, the following steps are implemented:
[0162] When the application is started using the first blockchain client, the public key information pre-stored in the application initialization file is obtained; the first application includes: a first application file and a second application file; the first application file includes a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and the public key information; the public key information is generated based on the user's registration information;
[0163] Acquire key information stored in the application code, where the key information is data generated by encrypting the public key information;
[0164] Determine whether the public key information and the secret key information are consistent. If they are inconsistent, send the secret key information to the alliance chain so that the alliance chain performs a penalty operation on the user based on the secret key information.
[0165] In the specific implementation process, when the computer program 411 is executed by the processor, any implementation method in Example 1 can be implemented.
[0166] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0167] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0168] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0170] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0171] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for protecting copyright based on blockchain, characterized in that: The method comprises: When the application is started using the first blockchain client, the public key information pre-stored in the application initialization file is obtained; the application includes: a first application file and a second application file; the first application file includes a first main program file and a first module file, and the second application file includes: a second main program file, a second module file and the public key information; the public key information is generated based on the user's registration information; Acquire key information stored in the application code, wherein the key information is data generated by encrypting the public key information; the key information is respectively stored in the code of the second application file and the code of the second module file, and the key information is used to verify whether the user of the application is legitimate; Determine whether the public key information and the secret key information are consistent. If they are inconsistent, send the secret key information to the alliance chain so that the alliance chain performs a penalty operation on the user based on the secret key information. When the first application file is downloaded and paid successfully, the alliance chain sends the second application file to the first blockchain client, and the first blockchain client obtains a complete application data packet.
2. The method according to claim 1, characterized in that The method also includes: When the application is started using the first blockchain client, the second application file is reported to the blockchain network; so that the second blockchain client calculates the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file; the first hash value is compared with the second hash value recorded in the blockchain network, and if it is determined that the first hash value and the second hash value are inconsistent, the second application file is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information in the second application file; wherein, The second blockchain client is any client in the blockchain network except the first blockchain client.
3. The method according to claim 1, characterized in that The method further comprises: When the application is running, based on a preset detection period, calculating a first hash value corresponding to the second main program file and a first hash value corresponding to the second module file in the second application; Obtaining a second hash value corresponding to the second main program file and a second hash value corresponding to the second module file from the blockchain network; The first hash value is compared with the second hash value. If it is determined that the first hash value and the second hash value are inconsistent, the key information is sent to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information.
4. The method according to claim 1, characterized in that The method further comprises: When the application is running, based on a preset detection period, using the first blockchain client to calculate a first hash value of the second main program file in the second application and a first hash value corresponding to the second module file; The first hash value of the second main program file and the first hash value corresponding to the second module file are reported to the alliance chain, so that the alliance chain determines whether the first hash value and the second hash value exist. If it is determined that the first hash value and / or the second hash value do not exist, the user is directly prohibited from logging in.
5. The method according to claim 1, characterized in that Get the public key information pre-stored in the application initialization file, including: When the application is the first main program file and the second main program file, extracting the public key information from the execution files in the first main program file and the second main program file using a preset interface; When the application program is the first module file and the second module file, the public key information is extracted from the codes in the first module file and the second module file using the preset interface.
6. The method according to claim 1, characterized in that The obtaining of key information stored in the application code includes: Determining a storage address of the key information based on a memory allocation address in the application; Based on the storage address, extract the key information using a key acquisition function Char key[]={'x1','x2','x3','x4','x5','x6','x7','x8','x9'}; The key information is decrypted to obtain the decrypted key information; x1, x2, x3, x4, x5, x6, x7, x8 and x9 are characters of the key information.
7. A device for protecting copyright based on blockchain, characterized in that: The device includes: A first acquisition unit is used to acquire public key information pre-stored in an application initialization file through a preset interface when starting an application using a first blockchain client; The application comprises: a first application file and a second application file; the first application file comprises a first main program file and a first module file, the second application file comprises: a second main program file, a second module file and the public key information; the public key information is generated based on the user's registration information; A second acquisition unit is used to acquire key information stored in the application code, wherein the key information is data generated by encrypting the public key information; the key information is respectively stored in the code of the second application file and the code of the second module file, and the key information is used to verify whether the user of the application is legitimate; A judging unit, configured to judge whether the public key information and the key information are consistent, and if they are inconsistent, send the key information to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information; Among them, when the first application file is downloaded and paid successfully, the alliance chain sends the second application file to the first blockchain client, and the first blockchain client obtains a complete application data packet.
8. The device according to claim 7, characterized in that The device also includes: A reporting unit is used to report the second application file to the blockchain network when the application is started by using the first blockchain client; so that the second blockchain client calculates the first hash value of the second main program file in the second application and the first hash value corresponding to the second module file; compares the first hash value with the second hash value recorded in the blockchain network, and if it is determined that the first hash value and the second hash value are inconsistent, sends the second application file to the alliance chain, so that the alliance chain performs a penalty operation on the user based on the key information in the second application file; wherein, The second blockchain client is any client in the blockchain network except the first blockchain client.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
