Blockchain data processing method, device, equipment and storage medium

By establishing the public key and key mapping relationship of the data authorization object on the blockchain, the problem that the data ownership object cannot be authorized to read encrypted data again is solved, and the flexibility and applicability of data sharing are achieved.

CN115333820BActive Publication Date: 2024-09-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210948339.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-08
Publication Date
2024-09-03
Estimated Expiration
2042-08-08

AI Technical Summary

Technical Problem

In the existing technology, the data ownership object cannot authorize other objects to read the encrypted data in the blockchain again, resulting in insufficient data sharing flexibility.

Method used

By obtaining the authorization request initiated by the data ownership object, the mapping relationship between the target data identification and the public key of the data authorization object and the key ciphertext is established, so that the data authorization object can obtain and decrypt the encrypted data on the blockchain.

Benefits of technology

It enables the data ownership object to flexibly authorize other objects to read the encrypted data in the blockchain, improving the flexibility and applicability of data sharing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115333820B
    Figure CN115333820B
Patent Text Reader

Abstract

The embodiment of the present application discloses a blockchain data processing method, device, equipment and storage medium, which can be applied to the blockchain field. The method includes: obtaining a first authorization request initiated by a data-attribution object, the first authorization request carries a target data identifier, a first public key of a data authorization object and a first key ciphertext; establishing a first mapping relationship between a target data identifier and a first public key and a first key ciphertext; obtaining a first key acquisition request initiated by a data authorization object carrying a request carrying a target data identifier and the first public key; determining and returning the first key ciphertext based on the first mapping relationship, so that the data authorization object decrypts the first key ciphertext based on the first private key to obtain the target key, and decrypts the target data ciphertext corresponding to the target data identifier based on the target key to obtain the target data. By adopting the embodiment of the present application, the data-attribution object can flexibly authorize the data authorization object to read the encrypted data in the blockchain, which has high applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain, and in particular to a blockchain data processing method, device, equipment and storage medium. Background Art

[0002] With the continuous development of computer technology, blockchain has gradually become an important way of data storage.

[0003] Normally, the data owner (i.e., the data owner) can encrypt the data to be stored and store it in the blockchain to ensure data security. At the same time, the data owner can grant the read permission of the encrypted data to some objects in advance during the storage process of the encrypted data, so that these objects can read the encrypted data from the blockchain after the data owner stores the encrypted data in the blockchain. However, in the prior art, once the data owner has stored the encrypted data, the read permission of the encrypted data can no longer be granted to other objects, making it difficult for other objects to read the encrypted data from the blockchain. Summary of the invention

[0004] The embodiments of the present application provide a blockchain data processing method, apparatus, device, and storage medium, which can enable the data owner to flexibly authorize other objects to read encrypted data in the blockchain, and have high applicability.

[0005] On the one hand, an embodiment of the present application provides a blockchain data processing method, the method comprising:

[0006] Obtaining a first authorization request initiated by the data owner, the first authorization request carrying the target data identifier of the target data, the first public key of the data authorization object, and the first key ciphertext, the first key ciphertext being obtained by the data owner encrypting the target key based on the first public key, and the target key being the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain;

[0007] The first key ciphertext is stored in the blockchain, and a first mapping relationship between the target data identifier, the first public key and the first key ciphertext is established;

[0008] Obtain a first key acquisition request initiated by the data authorization object, wherein the first key acquisition request carries the target data identifier and the first public key;

[0009] Based on the first mapping relationship, the first key ciphertext is determined from the blockchain, and the first key ciphertext is returned to the data authorization object, so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data.

[0010] On the other hand, an embodiment of the present application provides a blockchain data processing method, the method comprising:

[0011] Determine the target data identifier of the target data to be authorized;

[0012] Initiate a first authorization request, the first authorization request carries the target data identifier, the first public key of the data authorization object, and the first key ciphertext, the first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key, the target key is used to encrypt the target data to obtain the target data ciphertext, and the target data ciphertext is stored in the blockchain;

[0013] Among them, the above-mentioned first authorization request is used to enable the smart contract to store the above-mentioned first key ciphertext to the blockchain and establish a first mapping relationship between the above-mentioned target data identifier and the first public key and the above-mentioned first key ciphertext, so that when the first key acquisition request carrying the above-mentioned target data identifier and the above-mentioned first public key initiated by the above-mentioned data authorization object is obtained, the above-mentioned first key ciphertext is determined from the above-mentioned blockchain based on the above-mentioned first mapping relationship, and the above-mentioned first key ciphertext is returned to the above-mentioned data authorization object.

[0014] On the other hand, an embodiment of the present application provides a blockchain data processing method, the method comprising:

[0015] Initiate a first key acquisition request, the first key acquisition request carries the target data identifier of the target data and the first public key of the data authorization object, and the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain and return the first key ciphertext to the data authorization object based on the first mapping relationship between the target data identifier and the first public key and the first key ciphertext corresponding to the target data identifier;

[0016] The first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key. The target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain.

[0017] The first key ciphertext is obtained, and the first key ciphertext is decrypted based on the first private key of the data authorization object to obtain the target key, and the target data ciphertext obtained from the blockchain is decrypted based on the target key to obtain the target data.

[0018] On the other hand, an embodiment of the present application provides a blockchain data processing device, the device comprising:

[0019] A first transceiver module is used to obtain a first authorization request initiated by a data owner, wherein the first authorization request carries a target data identifier of the target data, a first public key of the data authorization object, and a first key ciphertext, wherein the first key ciphertext is obtained by encrypting a target key corresponding to the target data by the data owner based on the first public key, and the target key is a key used by the data owner to encrypt the target data to store the encrypted target data ciphertext in a blockchain;

[0020] A request processing module, used to store the first key ciphertext in the blockchain, and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext;

[0021] The first transceiver module is used to obtain a first key acquisition request initiated by the data authorization object, where the first key acquisition request carries the target data identifier and the first public key;

[0022] The above-mentioned first transceiver module is used to determine the above-mentioned first key ciphertext from the above-mentioned blockchain based on the above-mentioned first mapping relationship, and return the above-mentioned first key ciphertext to the above-mentioned data authorization object, so that the above-mentioned data authorization object decrypts the above-mentioned first key ciphertext based on the first private key of the above-mentioned data authorization object to obtain the above-mentioned target key, and decrypts the above-mentioned target data ciphertext obtained from the above-mentioned blockchain based on the above-mentioned target key to obtain the above-mentioned target data.

[0023] On the other hand, an embodiment of the present application provides a blockchain data processing device, the device comprising:

[0024] An information determination module, used to determine a target data identifier of target data to be authorized;

[0025] A second transceiver module is used to initiate a first authorization request, wherein the first authorization request carries the target data identifier, the first public key of the data authorization object, and the first key ciphertext, wherein the first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key, and the target key is used to encrypt the target data to obtain the target data ciphertext, and the target data ciphertext is stored in the blockchain;

[0026] Among them, the above-mentioned first authorization request is used to enable the smart contract to store the above-mentioned first key ciphertext to the blockchain and establish a first mapping relationship between the above-mentioned target data identifier and the first public key and the above-mentioned first key ciphertext, so that when the first key acquisition request carrying the above-mentioned target data identifier and the above-mentioned first public key initiated by the above-mentioned data authorization object is obtained, the above-mentioned first key ciphertext is determined from the above-mentioned blockchain based on the above-mentioned first mapping relationship, and the above-mentioned first key ciphertext is returned to the above-mentioned data authorization object.

[0027] On the other hand, an embodiment of the present application provides a blockchain data processing device, the device comprising:

[0028] A third transceiver module is used to initiate a first key acquisition request, the first key acquisition request carries a target data identifier of the target data and a first public key of the data authorization object, and the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain and return the first key ciphertext to the data authorization object based on a first mapping relationship between the target data identifier and the first public key and the first key ciphertext corresponding to the target data identifier;

[0029] The first key ciphertext is obtained by encrypting the target key corresponding to the target data by the data owner based on the first public key. The target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain.

[0030] The third transceiver module is used to obtain the first key ciphertext, decrypt the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypt the target data ciphertext obtained from the blockchain based on the target key to obtain the target data.

[0031] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the processor and the memory are connected to each other;

[0032] The memory is used to store computer programs;

[0033] The above-mentioned processor is configured to execute the blockchain data processing method provided in any aspect of the embodiments of the present application when calling the above-mentioned computer program.

[0034] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the blockchain data processing method provided by any aspect of the embodiment of the present application.

[0035] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program. When the above computer program is executed by a processor, it implements the blockchain data processing method provided by any example of the implementation of this application.

[0036] In an embodiment of the present application, the data owner can initiate a first authorization request to enable the smart contract to establish a first mapping relationship between the target data identifier and the first public key of the data authorization object to the first key ciphertext, and after establishing the first mapping relationship, the data authorization object can obtain the target data ciphertext and the first key ciphertext of the target data from the blockchain, decrypt the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypt the target data ciphertext based on the target key to obtain the target data, thereby completing the reading of the target data. Based on this method, the data owner can flexibly grant any object the authority to read encrypted data from the blockchain, which is more flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1a It is a schematic diagram of the network architecture provided by the embodiment of the present application;

[0039] Figure 1b It is a structural diagram of a data sharing system provided in an embodiment of the present application;

[0040] Figure 2 This is a flowchart of a blockchain data processing method provided by an embodiment of the present application;

[0041] Figure 3 This is another flowchart of the blockchain data processing method provided by an embodiment of the present application;

[0042] Figure 4 This is another flowchart of the blockchain data processing method provided in the embodiment of the present application;

[0043] Figure 5 It is a timing diagram of a method for accessing target data ciphertext provided by an embodiment of the present application;

[0044] Figure 6 It is a timing diagram of the target key processing method provided in an embodiment of the present application;

[0045] Figure 7 It is a schematic diagram of the structure of the blockchain provided in the embodiment of the present application;

[0046] Figure 8a It is a structural schematic diagram of a blockchain data processing device provided in an embodiment of the present application;

[0047] Figure 8b It is another structural schematic diagram of the blockchain data processing device provided in an embodiment of the present application;

[0048] Figure 8c It is another structural schematic diagram of the blockchain data processing device provided in an embodiment of the present application;

[0049] Fig. 9 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] See also Figure 1a , Figure 1a Schematic diagram of the network architecture provided by the embodiment of the present application. Figure 1a As shown, the data ownership object 11 and the data authorization object 12 can interact with the smart contract 13 in the blockchain, and the data ownership object 11 and the data authorization object can also interact with each other.

[0052] For the smart contract 13, the smart contract 13 can obtain the first authorization request initiated by the data owner 11, and the first authorization request carries the first key ciphertext, the target data identifier of the target data, and the first public key of the data authorization object 12. Among them, the first key ciphertext is obtained by encrypting the target key by the data owner 11 based on the first public key, and the target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain.

[0053] Furthermore, the smart contract 13 may store the first key ciphertext in the blockchain, and establish a first mapping relationship between the target data identifier, the first public key, and the first key ciphertext, so that the data authorization object 12 has the authority to read the target data from the blockchain. In this case, after receiving the first key acquisition request initiated by the data authorization object 12 and carrying the target data identifier and the first public key, the smart contract 13 may determine the previously stored first key ciphertext from the blockchain based on the previously established first mapping relationship, so as to return the first key ciphertext to the data authorization object 12.

[0054] For the data authorization object 12, it can decrypt the first key ciphertext returned by the smart contract 13 based on its own first private key to obtain the target key, and then decrypt the target data ciphertext corresponding to the target data obtained from the blockchain based on the target key to obtain the target data, thereby completing the reading of the target data.

[0055] The data ownership object 11 and the data authorization object 12 can be any node in the blockchain, and the data ownership object 11 and the data authorization object 12 can be independent physical servers or terminal devices, or server clusters or distributed systems composed of multiple physical servers, or cloud servers or server clusters that provide 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 device can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this.

[0056] The blockchain data processing method provided in the embodiment of the present application can be applied to any data processing scenario based on blockchain to realize data sharing, storage and management. Based on the method provided in the embodiment of the present application, the data ownership object can flexibly enable the data authorization object to read the data encrypted and stored in the blockchain by the data ownership object, thereby realizing flexible sharing of encrypted data in the blockchain, which has high applicability.

[0057] For example, the data ownership object and data authorization object in the embodiment of the present application can be any node in the blockchain, and the blockchain where the data ownership object and data authorization object are located can be regarded as a data sharing system. Figure 1b The data sharing system 100 shown may include multiple nodes 101, and data can be shared between the multiple nodes 101. Figure 1a The data ownership object 11 and the data authorization object 12 in the data sharing system 100 can be different nodes 101 in the data sharing system 100. Each node 101 in the data sharing system 100 can maintain the data in the blockchain corresponding to the data sharing system, and in order to ensure data intercommunication between the nodes 101 in the data sharing system 100, there can be a communication connection between each node 101 in the data sharing system 100, and the nodes 101 can transmit data through the above communication connection, and each node 101 can also interact with the smart contract to realize the blockchain data processing method provided in the embodiment of the present application.

[0058] See also Figure 2 , Figure 2It is a flowchart of the blockchain data processing method provided in an embodiment of the present application. Figure 2 The blockchain data processing method shown is executed by a smart contract and may include the following steps:

[0059] Step S21: Obtain a first authorization request, where the first authorization request carries a target data identifier of the target data, a first public key of a data authorization object, and a first key ciphertext.

[0060] Among them, the target data is the data that is pre-stored in the blockchain by the data owner, and it is also the data that needs to be authorized to the data authorization object so that the data authorization object can read it from the blockchain.

[0061] The first key ciphertext is obtained by encrypting the target key by the data belonging object based on the first public key of the data authorization object.

[0062] The target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain. The data owner is the owner of the target data, who can encrypt the target data with the target key in advance to obtain the target data ciphertext, and store the target data ciphertext in the blockchain through the smart contract to complete the data storage.

[0063] Among them, the target data identifier of the target data is the relevant information generated after the smart contract stores the target data in the blockchain and returned to the data owner, which is used to uniquely identify the target data.

[0064] Among them, the first authorization request obtained by the smart contract can be initiated directly by the data owner to the smart contract, or the data authorization object can obtain the first authorization request initiated by the data owner and then forward the first authorization request to the smart contract. The specific details can be determined based on the actual application scenario requirements and are not limited here.

[0065] Among them, the first authorization request is used to enable the smart contract to complete the authorization of the data authorization object to read the target data from the blockchain.

[0066] Step S22: store the first key ciphertext in the blockchain, and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext.

[0067] In some feasible implementations, after receiving the first authorization request carrying the target data identifier, the first public key of the data authorization object and the first key ciphertext, the smart contract can store the first key ciphertext to the blockchain and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext (that is, the mapping of the target data identifier, the first public key to the first key ciphertext), so that the data authorization object has the authority to read the target data from the blockchain.

[0068] For a smart contract, after obtaining the first public key and the target data identifier, the smart contract can determine the corresponding first key ciphertext through the above first mapping relationship. Similarly, after obtaining the first key ciphertext, the smart contract can determine the corresponding target data identifier and the first public key through the above first mapping relationship.

[0069] Step S23: obtain a first key acquisition request, the first key acquisition request carries a target data identifier and a first public key, determines a first key ciphertext from the blockchain based on the first mapping relationship, and returns the first key ciphertext to the data authorization object.

[0070] In some feasible implementations, the first key request is a first key acquisition request carrying a target data identifier and a first public key initiated after the data authorization object determines that it has the authority to read the target data from the blockchain.

[0071] Among them, the first key acquisition request received by the smart contract can be initiated directly by the data authorization object to the smart contract, or the data ownership object can obtain the first key acquisition request initiated by the data authorization object and then forward the first key acquisition request to the smart contract. The specific requirements can be determined based on the actual application scenario and are not limited here.

[0072] Among them, the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain and return the first key ciphertext based on the target data identifier and the first mapping relationship between the first public key and the first key ciphertext.

[0073] The first key ciphertext is obtained by encrypting the target key corresponding to the target data by the data belonging object based on the first public key, and the target key is the key used by the data belonging object to encrypt the target data.

[0074] Step S24: determine the first key ciphertext from the blockchain based on the first mapping relationship, and return the first key ciphertext to the data authorization object.

[0075] For a smart contract, after receiving a first key acquisition request carrying a target data identifier and a first public key, the smart contract can determine the first key ciphertext corresponding to the target data identifier and the first public key from the blockchain through a first mapping relationship, and return the determined first key ciphertext to the data authorization object.

[0076] Among them, the smart contract can send the first key ciphertext to the data owner, and the data owner will forward the first key ciphertext to the data authorization object, or the first key ciphertext can be directly sent to the data authorization object. The specific details can be determined based on the actual application scenario requirements and are not limited here.

[0077] See also Figure 3 , Figure 3 This is another flowchart of the blockchain data processing method provided in an embodiment of the present application. Figure 3 The blockchain data processing method shown can be executed by the data owner, and may specifically include the following steps:

[0078] Step S31: Determine the target data identifier of the target data to be authorized.

[0079] Among them, the target data is the data that the data owner has stored in the blockchain through a smart contract, and it is also the data that needs to be authorized to the data authorization object so that the data authorization object can read it from the blockchain.

[0080] Among them, the target data identifier of the target data is the relevant information generated after the smart contract stores the target data in the blockchain and returned to the data owner, which is used to uniquely identify the target data.

[0081] Among them, the target data identifier of the target data can be obtained from the smart contract after the target data ciphertext of the target data.

[0082] Step S32: Initiate a first authorization request, where the first authorization request carries a target data identifier, a first public key of a data authorization object, and a first ciphertext.

[0083] For the data owner, if it needs to allow the data authorization object to have the authority to read the target data from the blockchain, the target key (the key used to encrypt the target data when storing the target data) can be encrypted based on the first public key of the data authorization object to obtain the first key ciphertext, and then a first authorization request carrying the target data identifier, the first public key and the first key ciphertext is initiated to grant the data authorization object the authority to read the target data from the blockchain through a smart contract.

[0084] The data owner can receive the permission acquisition request sent by the data authorization object, and the permission acquisition request carries the target data identifier of the target data. After allowing the data authorization object to read the target data from the blockchain, the data owner can initiate a first authorization request carrying the target data identifier, the first public key of the data authorization object, and the first key ciphertext to complete the authorization through the smart contract.

[0085] The first public key of the data authorization object may be obtained when the data owner receives the permission acquisition request sent by the data authorization object.

[0086] Among them, the first authorization request initiated by the data owner can be a related request triggered after the data owner calls the "data authorization" method of the smart contract. The target data identifier, the first public key of the data authorization object and the first key ciphertext are the related parameters input by the data owner when calling the method.

[0087] The first key ciphertext is obtained after the data owner encrypts the target data based on the first public key of the data authorization object.

[0088] The target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain. The data owner is the owner of the target data, who can encrypt the target data with the target key in advance to obtain the target data ciphertext, and store the target data ciphertext in the blockchain to complete data storage.

[0089] Among them, the first authorization request is used to enable the smart contract to store the first key ciphertext to the blockchain after receiving the first authorization request carrying the target data identifier, the first public key of the data authorization object and the first key ciphertext, and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext (that is, the mapping of the target data identifier, the first public key to the first key ciphertext), so that the data authorization object has the authority to read the target data from the blockchain.

[0090] See also Figure 4 , Figure 4 This is another flowchart of the blockchain data processing method provided in the embodiment of the present application. Figure 4 The blockchain data processing method shown can be executed by a data authorization object, and may specifically include the following steps:

[0091] Step S41: Initiate a first key acquisition request, where the first key acquisition request carries a target data identifier and a first public key of a data authorization object.

[0092] In some feasible implementations, after the data owner has the authority to read the target data from the blockchain, a first key acquisition request carrying the target data identifier and the first public key is initiated.

[0093] The first key acquisition request initiated by the data authorization object may be a related request triggered after the data authorization object calls the "read key ciphertext" method of the smart contract, and the target data identifier and the first public key are the related parameters input when calling the method. Alternatively, the data authorization object may initiate the first key acquisition request after obtaining the relevant information sent by the data authorization object indicating that the data authorization object has the authority to read the target data.

[0094] Among them, the target data identifier can be obtained by the data ownership object from the smart contract and then sent to the data authorization object, and there is no restriction here.

[0095] Among them, the data authorization object can directly initiate a first key acquisition request to the smart contract, or initiate a first key acquisition request to the data ownership object, and the data ownership object forwards the first key acquisition request to the smart contract. The specific requirements can be determined based on the actual application scenario and are not limited here.

[0096] Step S42: Obtain the first key ciphertext, decrypt the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypt the obtained target data ciphertext based on the target key to obtain the target data.

[0097] In some feasible implementations, since the first key ciphertext is obtained by encrypting the data owner based on the first public key of the data authorization object, after the data authorization object obtains the first key ciphertext returned by the smart contract, the data authorization object can decrypt the first key ciphertext based on its own (the data authorization object) first private key to obtain the target key, that is, obtain the key used by the data owner to encrypt the target data.

[0098] Furthermore, the data authorization object can obtain the target data ciphertext corresponding to the target data from the blockchain, and then decrypt the target data ciphertext based on the determined target key to obtain the final target data, thereby completing the reading of the target data.

[0099] Combine the following Figure 5 The storage and acquisition process of the target data ciphertext is further explained. Figure 5 : is a timing diagram of a method for accessing target data ciphertext provided by an embodiment of the present application, and the method may specifically include the following steps:

[0100] Step S51: Initiate a data storage request, where the data storage request carries the target data ciphertext.

[0101] For the data owner, after determining the target data to be stored, the data owner can randomly generate a target key and encrypt the target data based on the target key to obtain the target data ciphertext. The data owner can then initiate a data storage request carrying the target data ciphertext to request the smart contract to store the data ciphertext in the blockchain.

[0102] It should be noted that the data logarithm object can directly initiate a data storage request to the smart contract, or it can initiate a data storage request to the data authorization object, and the data authorization object will forward the data storage request to the smart contract. The specific details can be determined based on the actual application scenario requirements and are not restricted here.

[0103] Among them, the data storage request initiated by the data owner can be a related request triggered after the data owner calls the "save data" method of the smart contract, and the target data ciphertext is the related parameters input when calling the method.

[0104] Step S52: Generate and return a target data identifier.

[0105] For smart contracts, after receiving a data storage request carrying the target data ciphertext initiated by the data owner, the smart contract generates a target data identifier for the target data ciphertext that can uniquely identify the target data (that is, the target data ciphertext), and returns the target data identifier to the data owner, so that the data owner can query the target data ciphertext corresponding to the target data from the blockchain based on the target data identifier, or complete the authorization operation on the data authorization object based on the target data identifier.

[0106] Step S53: Store the target data ciphertext in the blockchain, and establish a second mapping relationship between the target data identifier and the target data ciphertext.

[0107] For smart contracts, after receiving a data storage request carrying the target data ciphertext, the smart contract can store the target data ciphertext in the blockchain to complete the storage of the target data.

[0108] At the same time, the smart contract can establish a second mapping relationship between the target data identifier and the target data ciphertext (that is, the mapping of the target data identifier to the target data ciphertext). After obtaining the target data identifier, the smart contract can determine the corresponding target data ciphertext through the second mapping relationship. Similarly, after obtaining the target data ciphertext, the smart contract can determine the corresponding target data identifier through the second mapping relationship.

[0109] It should be noted that the order of the process of the smart contract generating and returning the target data identifier and the process of storing the target data ciphertext in the blockchain is not restricted here, and the two can also be carried out simultaneously. The specific order can be determined based on the actual application scenario requirements and is not restricted here.

[0110] Step S54: Initiate a ciphertext acquisition request, where the ciphertext acquisition request carries a target data identifier.

[0111] For the data authorization object, when the data authorization object needs to obtain the target data ciphertext from the blockchain, it can initiate a ciphertext acquisition request carrying the target data identifier to the smart contract, which is used to request the smart contract to determine and return the target data ciphertext from the blockchain to the authorization object based on the second mapping relationship between the target data identifier and the target data ciphertext.

[0112] It should be noted that the data authorization object can directly initiate a ciphertext acquisition request to the smart contract, or initiate a ciphertext acquisition request to the data ownership object, and the data ownership object will forward the ciphertext acquisition request to the smart contract. The specific method can be determined based on the actual application scenario requirements and is not restricted here.

[0113] Among them, the ciphertext acquisition request initiated by the data authorization object can be a related request triggered after the data authorization object calls the "read data ciphertext" method of the smart contract, and the target data identifier is the related parameter input when calling the method.

[0114] Step S55: Determine and return the target data ciphertext from the blockchain based on the second mapping relationship.

[0115] Among them, the smart contract can directly return the target data ciphertext to the data authorization object, or return the target data ciphertext to the data ownership object, and the data ownership object will forward the target data ciphertext to the data authorization object. The specific details can be determined based on the actual application scenario requirements and are not restricted here.

[0116] Based on the above steps S51-S55, the data ownership object can store the target data ciphertext and the data authorization object can obtain the target data ciphertext.

[0117] In some feasible implementations, for the data owner, when the data owner encrypts the target data based on the target key to store the encrypted target data ciphertext in the blockchain, the data owner can also store the target key in the local storage space.

[0118] Then, when the data authorization object requests permission to read the target data from the blockchain, the first public key of the data authorization object is obtained and the target key is encrypted based on the first public key to obtain the first key ciphertext. Thus, a first authorization request carrying the target data identifier, the first public key and the first key ciphertext is initiated, so that the smart contract establishes a first mapping relationship between the target data identifier and the first public key and the first key ciphertext, and upon receiving the first ciphertext acquisition request carrying the target data identifier and the first public key sent by the data authorization object, the first ciphertext key is determined according to the first mapping relationship and returned to the data authorization object.

[0119] Alternatively, the data ownership object can send the first key ciphertext directly to the data authorization object, so that the data authorization object can decrypt the first key ciphertext based on its own first private key to obtain the target key, and then decrypt the acquired target data ciphertext based on the target key to obtain the target data, so as to complete the data reading.

[0120] In some feasible implementations, for the data belonging object, when the data belonging object encrypts the target data based on the target key to store the encrypted target data ciphertext in the blockchain, the data belonging object can also pre-acquire the first public key of each object, and encrypt the target key based on the first public key of each object to obtain the key ciphertext corresponding to each object.

[0121] Based on this, when any object requests permission to read target data from the blockchain, the data-owning object can initiate an authorization request carrying the first public key of the object, the target data identifier, and the key ciphertext corresponding to the object so that the object has permission to read the target data from the blockchain. Alternatively, the data-owning object can directly send the key ciphertext corresponding to the object to the object, so that the object can decrypt the key ciphertext based on its own private key to obtain the target key, and then decrypt the obtained target data ciphertext based on the target key to obtain the target data, so as to complete the data reading.

[0122] In some feasible implementations, for the data owner, the data owner may encrypt the target key used to encrypt the target data to obtain a second key ciphertext, and store the second key ciphertext in the blockchain, thereby eliminating the need to store the target key locally.

[0123] When the data authorization object needs to obtain the permission to read the target data from the blockchain, the data owner can obtain the second key ciphertext from the blockchain and decrypt the second key ciphertext to obtain the target key, and further encrypt the obtained target key based on the first public key of the data authorization object to obtain the above-mentioned first key ciphertext, thereby initiating a first authorization request carrying the first public key of the data authorization object, the target data identifier and the first key ciphertext to enable the data authorization object to have the permission to read the target data from the blockchain.

[0124] The above implementation method can be specifically referred to in Figure 6 . Figure 6 Schematic diagram of the timing of the target key processing method provided by the embodiment of the present application. Figure 6 As shown, the target key processing method provided in the embodiment of the present application may specifically include the following steps:

[0125] Step S61: Obtain a second authorization request, where the second authorization request carries a target data identifier, a second public key of the data owner, and a second key ciphertext.

[0126] For the data owner, after determining the target key for encrypting the target data, the data owner can encrypt the target key based on the second public key corresponding to the data ownership to obtain the second key ciphertext, and then initiate a second authorization request carrying the target data identifier, the second public key and the second key ciphertext.

[0127] It should be noted that the data owner can directly initiate a second authorization request to the smart contract, or initiate a second authorization request to the data authorization object, and the data authorization object will forward the second authorization request to the smart contract. The specific method can be determined based on the actual application scenario requirements and is not restricted here.

[0128] For a smart contract, the smart contract can receive a second authorization request initiated by the data owner, carrying the target data identifier, the second public key and the second key ciphertext.

[0129] Step S62: Store the second key ciphertext in the blockchain, and establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext.

[0130] For a smart contract, after receiving the second authorization request initiated by the data owner, the smart contract can store the second key ciphertext carried in the second authorization request in the blockchain.

[0131] At the same time, the smart contract can establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext (that is, the mapping of the target data identifier, the second public key to the second key ciphertext), so that after obtaining the second public key and the target data identifier, the corresponding second key ciphertext can be determined through the third mapping relationship. Similarly, after obtaining the second key ciphertext, the smart contract can determine the corresponding target data identifier and the second public key through the third mapping relationship.

[0132] In some feasible implementations, after receiving the second authorization request initiated by the data owner, the smart contract can determine the object information of the data owner and verify the authority of the data owner based on the object information.

[0133] The permission verification is used to verify whether the data owner has the permission to grant the data authorization object to read the target data, that is, to determine that the second authorization request is not sent by other objects.

[0134] Specifically, the object information may be an object address. That is, after obtaining the second authorization request, the second public key of the data belonging object of the target data corresponding to the target data identifier may be determined based on the target data identifier carried in the second authorization request and the fourth mapping relationship.

[0135] Among them, the fourth mapping relationship is the mapping from the target data identifier to the second public key established after the smart contract stores the target data ciphertext submitted by the data owner in the blockchain.

[0136] Furthermore, after the smart contract determines the second public key of the target object, it can determine the object information (such as address information, etc.) of the target object based on the second public key, and match the object information (such as address information, etc.) of the initiating object of the second authorization request with the object information of the target object.

[0137] If the two are consistent, it is determined that the initiator of the second authorization request is the data owner, that is, it is determined that the data owner has the authority to grant the data authorization object to read the target data, so as to execute the process of storing the second key ciphertext in the blockchain and establishing the third mapping relationship between the target data identifier and the second public key and the second key ciphertext. If the two are inconsistent, no response is made to the received second authorization request.

[0138] Step S63: Obtain a second key acquisition request, where the second key acquisition request carries a target data identifier and a second public key.

[0139] For a smart contract, the smart contract can obtain a second key acquisition request initiated by the data owner, and the second key acquisition request carries the target data identifier and the second public key.

[0140] Among them, the data ownership object can initiate a second key acquisition request carrying the target data identifier and the second public key when determining to grant the data authorization object the authority to read the target data from the blockchain, so as to request the smart contract to determine the second key ciphertext previously stored in the blockchain based on the third mapping relationship, the target data identifier and the second public key.

[0141] It should be noted that the data owner can directly initiate a second key acquisition request to the smart contract, or initiate a second key acquisition request to the data authorization object, and the data authorization object will forward the second key acquisition request to the smart contract. The specific method can be determined based on the actual application scenario requirements and is not limited here.

[0142] Step S64: determine the second key ciphertext from the blockchain based on the third mapping relationship, and return the second key ciphertext.

[0143] For smart contracts, after receiving the second key acquisition request, the smart contract can determine the second key ciphertext previously submitted by the data owner from the blockchain based on the target data identifier, the second public key and the third mapping relationship carried in the second key acquisition request.

[0144] After determining the second key ciphertext, the smart contract can return the second key ciphertext to the data owner.

[0145] Step S65: decrypt the second key ciphertext based on the second private key of the data owner to obtain the target key.

[0146] For the data owner, since the second key ciphertext is obtained by encrypting the data owner based on the second public key of the data party, after the data owner obtains the second key ciphertext returned by the smart contract, the data owner can decrypt the second key ciphertext based on the second private key of the data owner to obtain the target key used to encrypt the target data.

[0147] In some feasible implementations, the data owner may predetermine the preset objects that have the authority to read the target data from the blockchain, and encrypt the target key based on the public key of each preset object to obtain the key ciphertext corresponding to each preset object. Therefore, in the process of submitting the target data ciphertext to the smart contract, the public key and key ciphertext corresponding to each preset object are submitted to the smart contract, so that the smart contract generates the target data identifier of the target data, and then establishes the mapping relationship between the public key and key ciphertext of each preset object and the target data identifier, and saves each preset object in the authorization list, thereby reducing the number of calls to the smart contract by the data owner.

[0148] On this basis, the data owner can encrypt the target key based on the first public key of the data authorization object to obtain the first key ciphertext, and then initiate a first authorization request carrying the first key ciphertext, the target data identifier and the first public key, so that the data authorization object obtains the permission to read the target data from the blockchain.

[0149] In the embodiment of the present application, each node in the blockchain network where the data owner and the data authorization object are located stores the same blockchain, so that after the data owner stores the target data ciphertext in the blockchain, the data authorization object can obtain the target data ciphertext from the blockchain. Figure 7 , Figure 7 This is a schematic diagram of the structure of the blockchain provided in the embodiment of this application. Figure 7 As shown, the blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the target data ciphertext feature value, version number, timestamp and difficulty value, and the block body stores the target data ciphertext; the next block of the genesis block takes the genesis block as the parent block, and the next block also includes a block header and a block body. The block header stores the target data ciphertext feature value of the current block, the block header feature value, version number, timestamp and difficulty value of the parent block, and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, thereby ensuring the security of the target data ciphertext in the block.

[0150] When generating each block in the blockchain, the data owner can verify the target data ciphertext. After the verification is completed, the target data ciphertext is stored in the memory pool, and the hash tree used to record the target data ciphertext is updated; then, the timestamp is updated to the time when the target data ciphertext is stored, and different random numbers are tried, and the eigenvalue calculation is performed multiple times, so that the calculated eigenvalue can satisfy the following formula:

[0151] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the target data ciphertext; ntime is the update time of the timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.

[0152] In this way, when the random number that satisfies the above formula is calculated, the data owner can store the target data ciphertext accordingly, generate the block header and block body, and obtain the current block. Each node in the blockchain where the data owner and the data authorization object are located has a corresponding node identifier, and can store the node identifiers of other nodes, so that the generated blocks can be broadcast to other nodes in the data sharing system according to the node identifiers of other nodes. Each node can maintain a node identifier list as shown in the following table, and store the node name and node identifier in the node identifier list accordingly. Among them, the node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address and any other information that can be used to identify the node. Table 1 only uses the IP address as an example for illustration.

[0153]

[0154] Based on this, the data owner can send the newly generated blocks to other nodes according to the node identifiers of other nodes. Other nodes will verify the newly generated blocks and add them to the blockchain they store after the verification, thereby storing the target data ciphertext in the blockchain.

[0155] It should be noted that the various mapping relationships, key ciphertexts, and public and private keys involved in the embodiments of the present application can be stored in the blockchain. The specific storage method is similar to the above process and will not be repeated here.

[0156] It should be noted that in the embodiments of the present application, when any party in the smart contract, data ownership object and data authorization object obtains data sent by any other party (such as key ciphertext, public and private keys, data identifier, data ciphertext, etc.), it is necessary to obtain the other party's permission or consent, and when processing the obtained data, it is also necessary to obtain the other party's authorization, and the acquisition and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0157] In an embodiment of the present application, the first public key and the first private key of the data authorization object are a public-private key pair generated based on an asymmetric encryption algorithm, and the second public key and the second private key of the data ownership object are a public-private key pair generated based on an asymmetric encryption algorithm.

[0158] Among them, asymmetric encryption algorithms include but are not limited to Ed25519 encryption algorithm, RSA encryption algorithm, ellipse curve encryption (ECC) algorithm, SM2 encryption algorithm (asymmetric encryption algorithm defined by national encryption standards), etc. The specific encryption algorithms can be determined based on the actual application scenario requirements and are not limited here.

[0159] In an embodiment of the present application, the target key is the key used by the data-tolerance object to encrypt the target data using a symmetric encryption algorithm. The symmetric encryption algorithm includes but is not limited to the Data Encryption Standard (DES) algorithm, the Advanced Encryption Standard (AES) algorithm, the SM4 encryption algorithm (a symmetric encryption algorithm defined by the national encryption standard), etc. The specific algorithm can be determined based on the actual application scenario requirements and is not limited here.

[0160] Symmetric encryption algorithms include two modes: block encryption and stream encryption. Block encryption is further divided into modes such as Electronic Code Book (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), and Output Feedback (OFB).

[0161] In the embodiment of the present application, the data authorization object has the authority to read the target data from the blockchain, which can be understood as the data authorization object having the authority to obtain the target data ciphertext of the target data from the blockchain and decrypt the target data ciphertext based on the target key.

[0162] In an embodiment of the present application, the data owner can initiate a first authorization request to the smart contract so that the smart contract establishes a first mapping relationship between the target data identifier and the first public key of the data authorization object to the first key ciphertext, and after establishing the first mapping relationship, the data authorization object can obtain the target data ciphertext and the first key ciphertext of the target data from the blockchain, decrypt the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypt the target data ciphertext based on the target key to obtain the target data, thereby completing the reading of the target data. Based on this method, the data owner can grant any object the authority to read encrypted data from the blockchain at any time, which is more flexible.

[0163] See also Figure 8a , Figure 8a : is a schematic diagram of a block chain data processing device provided in an embodiment of the present application. The block chain data processing device provided in an embodiment of the present application includes:

[0164] The first transceiver module 81 is used to obtain a first authorization request initiated by the data owner, the first authorization request carries the target data identifier of the target data, the first public key of the data authorization object, and the first key ciphertext, the first key ciphertext is obtained by the data owner encrypting the target key based on the first public key, and the target key is the key used by the data owner to encrypt the target data to store the encrypted target data ciphertext in the blockchain;

[0165] A request processing module 82 is used to store the first key ciphertext in the blockchain and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext;

[0166] The first transceiver module 81 is used to obtain a first key acquisition request initiated by the data authorization object, where the first key acquisition request carries the target data identifier and the first public key;

[0167] The first transceiver module 81 is used to determine the first key ciphertext from the blockchain based on the first mapping relationship, and return the first key ciphertext to the data authorization object, so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data.

[0168] In some feasible implementation manners, the first transceiver module 81 is further used for:

[0169] Obtaining a data storage request carrying the ciphertext of the target data initiated by the data owner, generating the target data identifier and returning the target data identifier to the data owner;

[0170] The request processing module 82 is also used for:

[0171] The target data ciphertext is stored in the blockchain, and a second mapping relationship between the target data identifier and the target data ciphertext is established;

[0172] The first transceiver module 81 is further used for:

[0173] Obtain a data acquisition request carrying the target data identifier initiated by the data authorization object, determine the target data ciphertext from the blockchain based on the second mapping relationship, and return the target data ciphertext to the data authorization object.

[0174] In some feasible implementation manners, the first transceiver module 81 is further used for:

[0175] Obtaining a second authorization request initiated by the data owner, the second authorization request carrying the target data identifier, the second public key of the data owner, and the second key ciphertext, the second key ciphertext being obtained by the data owner encrypting the target key based on the second public key;

[0176] The request processing module 82 is further used for:

[0177] The second key ciphertext is stored in the blockchain, and a third mapping relationship between the target data identifier, the second public key and the second key ciphertext is established;

[0178] The first transceiver module 81 is further used for:

[0179] Obtain a second key acquisition request initiated by the data to which the data belongs, wherein the second key acquisition request carries the target data identifier and the second public key;

[0180] Based on the third mapping relationship, the second key ciphertext is determined from the blockchain, and the second key ciphertext is returned to the data owner so that the data owner can decrypt the second key ciphertext based on the second private key of the data owner to obtain the target key.

[0181] In some feasible implementations, the request processing module 82 is further used to:

[0182] Determine the object information of the data owner, and verify the authority of the data owner based on the object information;

[0183] In response to the data belonging object passing the authority verification, the step of storing the second key ciphertext in the blockchain and establishing a third mapping relationship between the target data identifier and the second public key and the second key ciphertext is executed.

[0184] See also Figure 8b , Figure 8b : is another structural diagram of the blockchain data processing device provided in the embodiment of the present application. The blockchain data processing device provided in the embodiment of the present application includes:

[0185] An information determination module 83, used to determine the target data identifier of the target data to be authorized;

[0186] The second transceiver module 84 is used to initiate a first authorization request, the first authorization request carries the target data identifier, the first public key of the data authorization object and the first key ciphertext, the first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key, the target key is used to encrypt the target data to obtain the target data ciphertext, and the target data ciphertext is stored in the blockchain;

[0187] Among them, the above-mentioned first authorization request is used to enable the smart contract to store the above-mentioned first key ciphertext to the blockchain and establish a first mapping relationship between the above-mentioned target data identifier and the first public key and the above-mentioned first key ciphertext, so that when the first key acquisition request carrying the above-mentioned target data identifier and the above-mentioned first public key initiated by the above-mentioned data authorization object is obtained, the above-mentioned first key ciphertext is determined from the above-mentioned blockchain based on the above-mentioned first mapping relationship, and the above-mentioned first key ciphertext is returned to the above-mentioned data authorization object.

[0188] In some feasible implementation manners, the second transceiver module 84 is further used for:

[0189] Initiate a data storage request, the data storage request carries the target data ciphertext, the data storage request is used to enable the smart contract to generate and return the target data identifier, store the data ciphertext to the blockchain and establish a second mapping relationship between the target data identifier and the target data ciphertext, so that when a data acquisition request carrying the target data identifier initiated by the data authorization object is obtained, the target data ciphertext is determined from the blockchain based on the second mapping relationship and returned to the data authorization object.

[0190] In some feasible implementation manners, the second transceiver module 84 is further used for:

[0191] Initiate a second authorization request, the second authorization request carries the target data identifier, the second public key of the data to which the data belongs, and the second key ciphertext, the second key ciphertext being obtained by encrypting the target key based on the second public key;

[0192] The second authorization request is used to enable the smart contract to store the second key ciphertext in the blockchain, and to establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext.

[0193] In some feasible implementation manners, the second transceiver module 84 is further used for:

[0194] Initiate a second key acquisition request, the second key acquisition request carries the target data identifier and the second public key, the second key acquisition request is used to enable the smart contract to determine the second key ciphertext from the blockchain based on the third mapping relationship, and return the second key ciphertext to the data owner;

[0195] The second key ciphertext is obtained, and the second key ciphertext is decrypted based on the second private key of the object to which the data belongs to obtain the target key.

[0196] See also Figure 8c , Figure 8c It is another structural diagram of the blockchain data processing device provided in the embodiment of the present application. The blockchain data processing device provided in the embodiment of the present application includes:

[0197] The third transceiver module 85 is used to initiate a first key acquisition request, the first key acquisition request carries the target data identifier of the target data and the first public key of the data authorization object, and the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain and return the first key ciphertext to the data authorization object based on the first mapping relationship between the target data identifier and the first public key and the first key ciphertext corresponding to the target data identifier;

[0198] The first key ciphertext is obtained by encrypting the target key corresponding to the target data by the data owner based on the first public key. The target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain.

[0199] The third transceiver module 85 is used to obtain the first key ciphertext, decrypt the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypt the target data ciphertext obtained from the blockchain based on the target key to obtain the target data.

[0200] In some feasible implementation manners, the third transceiver module 62 is further used for:

[0201] Initiate a ciphertext acquisition request, the ciphertext acquisition request carries the target data identifier, and the ciphertext acquisition request is used to enable the smart contract to determine the target data ciphertext from the blockchain based on the second mapping relationship between the target data identifier and the target data ciphertext, and return the target data ciphertext to the data authorization object;

[0202] Get the ciphertext of the above target data.

[0203] See also Fig. 9 , Fig. 9 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Fig. 9 As shown, the electronic device 900 in this embodiment may include: a processor 901, a network interface 904 and a memory 905. In addition, the above-mentioned electronic device 900 may also include: an object interface 903, and at least one communication bus 902. Among them, the communication bus 902 is used to realize the connection and communication between these components. Among them, the object interface 903 may include a display screen (Display), a keyboard (Keyboard), and the object interface 903 may optionally include a standard wired interface and a wireless interface. The network interface 904 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 905 may be a high-speed RAM memory, or it may be a non-volatile memory (NVM), such as at least one disk storage. The memory 905 may optionally also be at least one storage device located away from the aforementioned processor 901. As Fig. 9 As shown, the memory 905 as a computer-readable storage medium may include an operating system, a network communication module, an object interface module, and a device control application program.

[0204] exist Fig. 9 In the electronic device 900 shown, the network interface 904 can provide a network communication function; and the object interface 903 is mainly used to provide an input interface for the object; when the electronic device 900 is used as a device corresponding to a smart contract, the processor 901 can be used to call the device control application stored in the memory 905 to implement:

[0205] Obtaining a first authorization request initiated by the data owner, the first authorization request carries a target data identifier of the target data, a first public key of the data authorization object, and a first key ciphertext, the first key ciphertext being obtained by the data owner encrypting the target key based on the first public key, and the target key being a key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain;

[0206] The first key ciphertext is stored in the blockchain, and a first mapping relationship between the target data identifier, the first public key and the first key ciphertext is established;

[0207] Obtain a first key acquisition request initiated by the data authorization object, wherein the first key acquisition request carries the target data identifier and the first public key;

[0208] Based on the first mapping relationship, the first key ciphertext is determined from the blockchain, and the first key ciphertext is returned to the data authorization object, so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data.

[0209] In some feasible implementations, the processor 901 is further configured to:

[0210] Obtaining a data storage request carrying the ciphertext of the target data initiated by the data owner, generating the target data identifier and returning the target data identifier to the data owner;

[0211] The target data ciphertext is stored in the blockchain, and a second mapping relationship between the target data identifier and the target data ciphertext is established;

[0212] Obtain a data acquisition request carrying the target data identifier initiated by the data authorization object, determine the target data ciphertext from the blockchain based on the second mapping relationship, and return the target data ciphertext to the data authorization object.

[0213] In some feasible implementations, the processor 901 is further configured to:

[0214] Obtaining a second authorization request initiated by the data owner, the second authorization request carrying the target data identifier, the second public key of the data owner, and the second key ciphertext, the second key ciphertext being obtained by the data owner encrypting the target key based on the second public key;

[0215] The second key ciphertext is stored in the blockchain, and a third mapping relationship between the target data identifier, the second public key and the second key ciphertext is established;

[0216] Obtain a second key acquisition request initiated by the data to which the data belongs, wherein the second key acquisition request carries the target data identifier and the second public key;

[0217] Based on the third mapping relationship, the second key ciphertext is determined from the blockchain, and the second key ciphertext is returned to the data owner so that the data owner can decrypt the second key ciphertext based on the second private key of the data owner to obtain the target key.

[0218] In some feasible implementations, the processor 901 is further configured to:

[0219] Determine the object information of the data owner, and verify the authority of the data owner based on the object information;

[0220] In response to the data belonging object passing the authority verification, the step of storing the second key ciphertext in the blockchain and establishing a third mapping relationship between the target data identifier and the second public key and the second key ciphertext is executed.

[0221] When the electronic device 900 is used as the device corresponding to the data belonging object, the processor 901 can be used to call the device control application stored in the memory 905 to implement:

[0222] Determine the target data identifier of the target data to be authorized;

[0223] Initiate a first authorization request, the first authorization request carries the target data identifier, the first public key of the data authorization object, and the first key ciphertext, the first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key, the target key is used to encrypt the target data to obtain the target data ciphertext, and the target data ciphertext is stored in the blockchain;

[0224] Among them, the above-mentioned first authorization request is used to enable the smart contract to store the above-mentioned first key ciphertext to the blockchain and establish a first mapping relationship between the above-mentioned target data identifier and the first public key and the above-mentioned first key ciphertext, so that when the first key acquisition request carrying the above-mentioned target data identifier and the above-mentioned first public key initiated by the above-mentioned data authorization object is obtained, the above-mentioned first key ciphertext is determined from the above-mentioned blockchain based on the above-mentioned first mapping relationship, and the above-mentioned first key ciphertext is returned to the above-mentioned data authorization object.

[0225] In some feasible implementations, the processor 901 is further configured to:

[0226] Initiate a data storage request, the data storage request carries the target data ciphertext, the data storage request is used to enable the smart contract to generate and return the target data identifier, store the data ciphertext to the blockchain and establish a second mapping relationship between the target data identifier and the target data ciphertext, so that when a data acquisition request carrying the target data identifier initiated by the data authorization object is obtained, the target data ciphertext is determined from the blockchain based on the second mapping relationship and returned to the data authorization object.

[0227] In some feasible implementations, the processor 901 is further configured to:

[0228] Initiate a second authorization request, the second authorization request carries the target data identifier, the second public key of the data to which the data belongs, and the second key ciphertext, the second key ciphertext being obtained by encrypting the target key based on the second public key;

[0229] The second authorization request is used to enable the smart contract to store the second key ciphertext in the blockchain, and to establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext.

[0230] In some feasible implementations, the processor 901 is further configured to:

[0231] Initiate a second key acquisition request, the second key acquisition request carries the target data identifier and the second public key, the second key acquisition request is used to enable the smart contract to determine the second key ciphertext from the blockchain based on the third mapping relationship, and return the second key ciphertext to the data owner;

[0232] The second key ciphertext is obtained, and the second key ciphertext is decrypted based on the second private key of the object to which the data belongs to obtain the target key.

[0233] When the electronic device 900 is used as a device corresponding to the data authorization object, the processor 901 can be used to call the device control application stored in the memory 905 to implement:

[0234] Initiate a first key acquisition request, the first key acquisition request carries the target data identifier of the target data and the first public key of the data authorization object, and the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain and return the first key ciphertext to the data authorization object based on the first mapping relationship between the target data identifier and the first public key and the first key ciphertext corresponding to the target data identifier;

[0235] The first key ciphertext is obtained by encrypting the target key corresponding to the target data by the data owner based on the first public key. The target key is the key used by the data owner to encrypt the target data and store the encrypted target data ciphertext in the blockchain.

[0236] The first key ciphertext is obtained, and the first key ciphertext is decrypted based on the first private key of the data authorization object to obtain the target key, and the target data ciphertext obtained from the blockchain is decrypted based on the target key to obtain the target data.

[0237] In some feasible implementations, the processor 901 is further configured to:

[0238] Initiate a ciphertext acquisition request, the ciphertext acquisition request carries the target data identifier, and the ciphertext acquisition request is used to enable the smart contract to determine the target data ciphertext from the blockchain based on the second mapping relationship between the target data identifier and the target data ciphertext, and return the target data ciphertext to the data authorization object;

[0239] Get the ciphertext of the above target data.

[0240] It should be understood that in some feasible implementations, the processor 901 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0241] In a specific implementation, the electronic device 900 can execute the above-mentioned functions through its built-in functional modules. Figure 2-6 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0242] The present application also provides a computer-readable storage medium, which stores a computer program and is executed by a processor to implement Figure 2-6 For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0243] The computer-readable storage medium may be an internal storage unit of the blockchain data processing device or electronic device provided in any of the aforementioned embodiments, such as a hard disk or memory of an electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device. The computer-readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0244] The present invention provides a computer program product, which includes a computer program. The computer program is executed by a processor. Figure 2-6 The methods provided in each step.

[0245] The terms "first", "second", etc. in the claims, specification and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or electronic device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or electronic devices. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments. The term "and / or" used in the present application specification and the attached claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0246] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0247] The above disclosure is only the preferred embodiment of the present application, which cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A blockchain data processing method, characterized in that: The method comprises: Obtain a data storage request carrying a target data ciphertext initiated by a data belonging object, generate a target data identifier and return the target data identifier to the data belonging object, wherein the target data ciphertext is obtained by encrypting the target data using a target key, and the target key is randomly generated; The target data ciphertext is stored in the blockchain, and a second mapping relationship between the target data identifier and the target data ciphertext is established; a data acquisition request carrying the target data identifier initiated by a data authorization object is obtained, and the target data ciphertext is determined from the blockchain based on the second mapping relationship and returned to the data authorization object; Obtaining a first authorization request initiated by a data owner, the first authorization request carrying a target data identifier of the target data, a first public key of the data authorization owner, and a first key ciphertext, the first key ciphertext being obtained by the data owner encrypting the target key based on the first public key; The first key ciphertext is stored in the blockchain, and a first mapping relationship between the target data identifier, the first public key and the first key ciphertext is established; Obtain a first key acquisition request initiated by the data authorization object, where the first key acquisition request carries the target data identifier and the first public key; Determine the first key ciphertext from the blockchain based on the first mapping relationship, and return the first key ciphertext to the data authorization object, so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data; The target key used to obtain the first key ciphertext is obtained by the data owner in the following manner: Obtaining a second authorization request initiated by the data owner, the second authorization request carrying the target data identifier, the second public key of the data owner, and the second key ciphertext, where the second key ciphertext is obtained by the data owner encrypting the target key based on the second public key; storing the second key ciphertext in the blockchain, and establishing a third mapping relationship between the target data identifier and the second public key and the second key ciphertext; Obtain a second key acquisition request initiated by the data owner, where the second key acquisition request carries the target data identifier and the second public key; Based on the third mapping relationship, the second key ciphertext is determined from the blockchain, and the second key ciphertext is returned to the data belonging object so that the data belonging object decrypts the second key ciphertext based on the second private key of the data belonging object to obtain the target key.

2. The method according to claim 1, characterized in that The method further comprises: Determine object information of the data owner, and perform authority verification on the data owner based on the object information; In response to the data belonging object passing the authority verification, the step of storing the second key ciphertext in the blockchain and establishing a third mapping relationship between the target data identifier and the second public key and the second key ciphertext is executed.

3. A blockchain data processing method, characterized in that: The method comprises: Initiate a data storage request, the data storage request carries a target data ciphertext, the target data ciphertext is obtained by encrypting the target data with a target key, the target key is randomly generated, the data storage request is used to enable the smart contract to generate and return a target data identifier of the target data, and store the target data ciphertext in the blockchain and establish a second mapping relationship between the target data identifier and the target data ciphertext, so that when a data acquisition request carrying the target data identifier initiated by a data authorization object is obtained, the target data ciphertext is determined from the blockchain based on the second mapping relationship and returned to the data authorization object; Determine the target data identifier of the target data to be authorized; Initiate a first authorization request, where the first authorization request carries the target data identifier, the first public key of the data authorization object, and a first key ciphertext, where the first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key; The first authorization request is used to enable the smart contract to store the first key ciphertext in the blockchain and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext, so that when the first key acquisition request carrying the target data identifier and the first public key initiated by the data authorization object is obtained, the first key ciphertext is determined from the blockchain based on the first mapping relationship, and the first key ciphertext is returned to the data authorization object, so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data; The target key used to obtain the first key ciphertext is obtained by the data owner in the following manner: Initiate a second authorization request, where the second authorization request carries the target data identifier, the second public key of the data owner, and the second key ciphertext, where the second key ciphertext is obtained by encrypting the target key based on the second public key; The second authorization request is used to enable the smart contract to store the second key ciphertext in the blockchain, and establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext; Initiate a second key acquisition request, where the second key acquisition request carries the target data identifier and the second public key, and the second key acquisition request is used to enable the smart contract to determine the second key ciphertext from the blockchain based on the third mapping relationship, and return the second key ciphertext to the data owner; The second key ciphertext is obtained, and the second key ciphertext is decrypted based on the second private key of the data owner to obtain the target key.

4. A blockchain data processing method, characterized in that: The method comprises: Initiate a ciphertext acquisition request to obtain the target data ciphertext, wherein the ciphertext acquisition request carries the target data identifier, and the ciphertext acquisition request is used to enable the smart contract to determine the target data ciphertext from the blockchain based on the second mapping relationship between the target data identifier and the target data ciphertext and return the target data ciphertext to the data authorization object; wherein the second mapping relationship is established by the smart contract in the following manner: Obtaining a data storage request initiated by a data belonging object and carrying the target data ciphertext, generating the target data identifier and returning the target data identifier to the data belonging object, wherein the target data ciphertext is obtained by encrypting the target data using a target key, and the target key is randomly generated; The target data ciphertext is stored in the blockchain, and a second mapping relationship between the target data identifier and the target data ciphertext is established; Initiate a first key acquisition request, the first key acquisition request carries a target data identifier of the target data and a first public key of a data authorization object, the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain based on a first mapping relationship between the target data identifier and the first public key and the first key ciphertext corresponding to the target data identifier, and return the first key ciphertext to the data authorization object; The first key ciphertext is obtained after the data owner encrypts the target key corresponding to the target data based on the first public key; Obtaining the first key ciphertext, decrypting the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypting the target data ciphertext obtained from the blockchain based on the target key to obtain the target data; The target key used to obtain the first key ciphertext is obtained by the data owner in the following manner: Obtaining a second authorization request initiated by the data owner, the second authorization request carrying the target data identifier, the second public key of the data owner, and the second key ciphertext, where the second key ciphertext is obtained by the data owner encrypting the target key based on the second public key; storing the second key ciphertext in the blockchain, and establishing a third mapping relationship between the target data identifier and the second public key and the second key ciphertext; Obtain a second key acquisition request initiated by the data owner, where the second key acquisition request carries the target data identifier and the second public key; Based on the third mapping relationship, the second key ciphertext is determined from the blockchain, and the second key ciphertext is returned to the data belonging object so that the data belonging object decrypts the second key ciphertext based on the second private key of the data belonging object to obtain the target key.

5. A blockchain data processing device, characterized in that: The device comprises: A first transceiver module is used to obtain a data storage request carrying a target data ciphertext initiated by a data belonging object, generate a target data identifier and return the target data identifier to the data belonging object, wherein the target data ciphertext is obtained by encrypting the target data using a target key, and the target key is randomly generated; A request processing module, used to store the target data ciphertext in the blockchain and establish a second mapping relationship between the target data identifier and the target data ciphertext; The first transceiver module is used to obtain a data acquisition request carrying the target data identifier initiated by the data authorization object, determine the target data ciphertext from the blockchain based on the second mapping relationship, and return the target data ciphertext to the data authorization object; The first transceiver module is used to obtain a first authorization request initiated by the data owner, the first authorization request carries a target data identifier of the target data, a first public key of the data authorization object, and a first key ciphertext, the first key ciphertext is obtained by the data owner encrypting the target key corresponding to the target data based on the first public key; The request processing module is used to store the first key ciphertext in the blockchain and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext; The first transceiver module is used to obtain a first key acquisition request initiated by the data authorization object, where the first key acquisition request carries the target data identifier and the first public key; The first transceiver module is used to determine the first key ciphertext from the blockchain based on the first mapping relationship, and return the first key ciphertext to the data authorization object, so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data; The target key used to obtain the first key ciphertext is obtained by the data owner in the following manner: Obtaining a second authorization request initiated by the data owner, the second authorization request carrying the target data identifier, the second public key of the data owner, and the second key ciphertext, where the second key ciphertext is obtained by the data owner encrypting the target key based on the second public key; The request processing module is used to store the second key ciphertext in the blockchain, and establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext; The first transceiver module is used to obtain a second key acquisition request initiated by the data owner, where the second key acquisition request carries the target data identifier and the second public key; The first transceiver module is used to determine the second key ciphertext from the blockchain based on the third mapping relationship, and return the second key ciphertext to the data belonging object so that the data belonging object decrypts the second key ciphertext based on the second private key of the data belonging object to obtain the target key.

6. A blockchain data processing device, characterized in that: The device comprises: A second transceiver module is used to initiate a data storage request, the data storage request carries a target data ciphertext, the target data ciphertext is obtained by encrypting the target data with a target key, the target key is randomly generated, the data storage request is used to enable the smart contract to generate and return a target data identifier of the target data, and to store the target data ciphertext in a blockchain and establish a second mapping relationship between the target data identifier and the target data ciphertext, so that when a data acquisition request carrying the target data identifier initiated by a data authorization object is obtained, the target data ciphertext is determined from the blockchain based on the second mapping relationship and returned to the data authorization object; An information determination module, used to determine the target data identifier of the target data to be authorized; The second transceiver module is used to initiate a first authorization request, where the first authorization request carries the target data identifier, the first public key of the data authorization object, and a first key ciphertext, where the first key ciphertext is obtained by encrypting the target key corresponding to the target data based on the first public key; The first authorization request is used to enable the smart contract to store the first key ciphertext to the blockchain and establish a first mapping relationship between the target data identifier and the first public key and the first key ciphertext, so that when the first key acquisition request initiated by the data authorization object carrying the target data identifier and the first public key is obtained, the first key ciphertext is determined from the blockchain based on the first mapping relationship, and the first key ciphertext is returned to the data authorization object; so that the data authorization object decrypts the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypts the target data ciphertext obtained from the blockchain based on the target key to obtain the target data; The target key used to obtain the first key ciphertext is obtained by the data owner in the following manner: Initiate a second authorization request, where the second authorization request carries the target data identifier, the second public key of the data owner, and the second key ciphertext, where the second key ciphertext is obtained by encrypting the target key based on the second public key; The second authorization request is used to enable the smart contract to store the second key ciphertext in the blockchain, and establish a third mapping relationship between the target data identifier and the second public key and the second key ciphertext; Initiate a second key acquisition request, where the second key acquisition request carries the target data identifier and the second public key, and the second key acquisition request is used to enable the smart contract to determine the second key ciphertext from the blockchain based on the third mapping relationship, and return the second key ciphertext to the data owner; The second key ciphertext is obtained, and the second key ciphertext is decrypted based on the second private key of the data owner to obtain the target key.

7. A blockchain data processing device, characterized in that: The device comprises: The third transceiver module is used to initiate a ciphertext acquisition request to obtain the target data ciphertext, wherein the ciphertext acquisition request carries the target data identifier, and the ciphertext acquisition request is used to enable the smart contract to determine the target data ciphertext from the blockchain based on the second mapping relationship between the target data identifier and the target data ciphertext, and return the target data ciphertext to the data authorization object; wherein the second mapping relationship is established by the smart contract in the following manner: Obtaining a data storage request initiated by a data belonging object and carrying the target data ciphertext, generating the target data identifier and returning the target data identifier to the data belonging object, wherein the target data ciphertext is obtained by encrypting the target data using a target key, and the target key is randomly generated; The target data ciphertext is stored in the blockchain, and a second mapping relationship between the target data identifier and the target data ciphertext is established; A third transceiver module is used to initiate a first key acquisition request, the first key acquisition request carries a target data identifier of the target data and a first public key of the data authorization object, and the first key acquisition request is used to enable the smart contract to determine the first key ciphertext from the blockchain based on a first mapping relationship between the target data identifier and the first public key and the first key ciphertext corresponding to the target data identifier, and return the first key ciphertext to the data authorization object; The first key ciphertext is obtained after the data owner encrypts the target key corresponding to the target data based on the first public key; The third transceiver module is used to obtain the first key ciphertext, decrypt the first key ciphertext based on the first private key of the data authorization object to obtain the target key, and decrypt the target data ciphertext obtained from the blockchain based on the target key to obtain the target data; The target key used to obtain the first key ciphertext is obtained by the data owner in the following manner: Obtaining a second authorization request initiated by the data owner, the second authorization request carrying the target data identifier, the second public key of the data owner, and the second key ciphertext, where the second key ciphertext is obtained by the data owner encrypting the target key based on the second public key; storing the second key ciphertext in the blockchain, and establishing a third mapping relationship between the target data identifier and the second public key and the second key ciphertext; Obtain a second key acquisition request initiated by the data owner, where the second key acquisition request carries the target data identifier and the second public key; Based on the third mapping relationship, the second key ciphertext is determined from the blockchain, and the second key ciphertext is returned to the data belonging object so that the data belonging object decrypts the second key ciphertext based on the second private key of the data belonging object to obtain the target key.

8. An electronic device, characterized in that: comprising a processor and a memory, wherein the processor and the memory are connected to each other; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 4 when calling the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 4.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.