A blockchain-based data security sharing method
By generating hash values through a hierarchical access tree model and hash functions, and combining this with key generation by an authoritative center, a data access and sharing model is constructed. This solves the problems of security and response speed in blockchain data sharing, and achieves efficient and secure data sharing.
Patent Information
- Application Number
- CN202510305033.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-03-14
AI Technical Summary
Existing blockchain-based data sharing methods suffer from insufficient security and slow response times, failing to effectively guarantee privacy and rapid response during the data sharing process.
A hierarchical access tree model and hash function are used to generate fixed hash values. A master key and public key are generated by an authority center. Through encryption and decryption processes, a data access sharing model is constructed, and a public contract is built in the blockchain to achieve data sharing.
It improves the security and response speed of data sharing, optimizes storage paths, reduces sharing time, and ensures the rationality and security of data access.
Smart Images

Figure CN120223283B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of blockchain and data sharing, and specifically relates to a blockchain-based method for secure data sharing. Background Technology
[0002] In the internet age, online data sharing has become a popular trend, and blockchain is a data storage solution that stores data in blocks and uses cryptographic algorithms to protect financial data security. Because blocks can be linked together, it is called a blockchain. The biggest difference between blockchain and traditional centralized storage solutions is that blockchain achieves distributed data storage, alleviating the pressure of big data storage. Furthermore, the core technologies inherent in blockchain ensure its immutability, improving data security. Blockchain includes several core technologies, such as cryptography, sharing mechanisms, access control, and smart contracts. On the hardware side, blockchain technology provides a large amount of storage space for data; however, privacy leaks often occur during data sharing, making access control and encryption of shared data a major concern.
[0003] Therefore, to reduce potential security issues during data sharing within servers, blockchain-based data sharing methods have emerged to ensure data security. The data sender encrypts the data to be shared using an encryption algorithm within the system, and then stores the encrypted data on the blockchain through the sharing system. Upon receiving a data retrieval request from the data recipient (i.e., the user), the server sends its description information and assesses the user's permissions. Based on the description information and permissions, the server determines whether the user can obtain the requested data and decrypts and sends the corresponding ciphertext accordingly. However, in this cryptographically based sharing process, single points of failure and other issues often lead to the risk of data leakage. Furthermore, existing blockchain data security sharing mechanisms have slow response times, failing to provide users with the required data results in a timely manner.
[0004] Therefore, there is an urgent need to provide a blockchain-based data security sharing method that can further improve the security of shared data and increase the data sharing rate. Summary of the Invention
[0005] The purpose of this invention is to provide a blockchain-based method for secure data sharing, in order to solve the aforementioned problems existing in the prior art.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] In a first aspect, the present invention provides a blockchain-based method for secure data sharing, comprising:
[0008] Shared data is stored in the blockchain to form a shared database. The data in the shared database is classified and processed, and a hierarchical access tree model is constructed based on the classification results. The hierarchical access tree model contains multiple levels, each level includes at least one child node, and each child node has a unique attribute position. A fixed hash value h is generated for each child node.
[0009] Data is filtered through the shared database to obtain the target dataset G, and public safety parameters H are set according to the hierarchical access tree model. par ;
[0010] Based on public safety parameter H par The master key and public key are generated through an authoritative center, and the public key security parameter h is calculated using a hash function. p ;
[0011] Based on public key and public key security parameter h p Each child node is encrypted to obtain encrypted data;
[0012] Based on the target dataset G, master key, and public key, a data access sharing model is constructed. According to this model, a user private key is generated, and a hash function is used to calculate the user's private key security parameter f. t ;
[0013] Construct public contracts within the blockchain to output encrypted data in ciphertext, based on the user's private key security parameter f. t Data decryption is achieved, and sharing is completed.
[0014] In one possible design, shared data is stored in a blockchain to form a shared database. The data in the shared database is then categorized, and a hierarchical access tree model is constructed based on the categorization results, including:
[0015] The data in the shared database is classified and processed in a keyless escrow mode to obtain the data types in the shared database;
[0016] Based on the data types in the shared database, a hierarchical access tree model is constructed using a hierarchical structure. This model includes at least four levels, each level containing at least one child node. Each child node corresponds to a type of data, identified by a node identifier R and its coordinates (x, y). mn ,y mn Each child node is uniquely identified by its attribute position, where x represents the main category of the data, y represents the subcategory of the data, m represents the horizontal hierarchy number, and n represents the vertical child node number.
[0017] Using an irreversible hash function h = Hash(x)mn ,y mn Map the coordinates of each child node to generate a fixed hash value h.
[0018] In one possible design, data is filtered through a shared database to obtain the target dataset G, and a public safety parameter H is set according to a hierarchical access tree model. par ,include:
[0019] Obtain existing keywords g in the blockchain, and perform data retrieval on the shared database based on existing keywords g to determine the target dataset G = {g|g∈θ}, where θ is used to represent the data set in the shared database;
[0020] Based on the hierarchical structure of the hierarchical access tree model, according to H par =(F1,T g ,f g ,K 1, K2,P) Initialize and set the public safety parameter H par Where F1 represents the generator of the public safety parameters, and T g f represents the order of the generator. g K represents the total number of generators, K1 and K2 represent the shared multi-components of the hash function, and P represents the number of authoritative centers.
[0021] In one possible design, the public safety parameter H is set according to the hierarchical access tree model. par After that, it also includes:
[0022] The hash value h of each child node in the hierarchical access tree model is compared with the public security parameter H. par The association is used to generate permission tags for each child node, where the hash value h of each child node corresponds to the access permissions of a type of data.
[0023] Collision resistance verification is performed on the permission labels of each child node. If the permission labels of the child nodes are the same, it is considered that there is a collision between the permission labels of the child nodes. In this case, a unique identifier is added to the child node with the collision, and the hash value h of the child node with the collision is recalculated, and the corresponding permission label is generated. The verification is performed again until there is no collision between the permission labels of the child nodes. If the permission labels of the child nodes are all different, it is considered that there is no collision between the permission labels of the child nodes. The public security parameter H is then set to... par Write it into a blockchain smart contract.
[0024] In one possible design, based on the public safety parameter H par The master key and public key are generated through an authoritative center, and the public key security parameter h is calculated using a hash function. p ,include:
[0025] Based on public safety parameter H par The master key is generated through an authoritative center;
[0026] Based on public safety parameter H par Public keys are generated through an authoritative center;
[0027] Define a cryptographic hash function H1, and use the cryptographic hash function H1 to calculate the public key security parameter h of the public key. p .
[0028] In one possible design, based on the public key and the public key security parameter h p Each child node is encrypted to obtain encrypted data, including:
[0029] Based on the attribute encryption method, generate access policies for each child node;
[0030] Based on the public key, using the public key security parameter h p As a generator, the hash value h of each child node is embedded into the ciphertext, and each child node is encrypted according to the access strategy of each child node to form pre-encrypted data.
[0031] Using public key security parameter h p Complete the security verification of the encryption process and use the verified pre-encrypted data as the encrypted data;
[0032] Encrypted data is written to the blockchain, completing the data upload process.
[0033] In one possible design, a data access sharing model is constructed based on the target dataset G, the master key, and the public key. A user private key is then generated according to this model, and a hash function is used to calculate the user's private key security parameter f. t ,include:
[0034] Based on the target dataset G, a data access sharing model is constructed using the access strategies of each child node.
[0035] Based on the data access sharing model, a pre-user private key is randomly generated based on the user ID;
[0036] Based on the master key, the legitimacy of the pre-user private key is verified, and the verified pre-user private key is distributed according to the user ID;
[0037] Use blockchain smart contracts to record the key distribution process to prevent key leakage;
[0038] Define a decryption hash function H2, and use the decryption hash function H2 to calculate the user's private key security parameter f.t .
[0039] In one possible design, a public contract is built in the blockchain to output encrypted data in ciphertext, based on the user's private key security parameter f. t To achieve data decryption and complete sharing, the following steps are included:
[0040] Based on the public key security parameter h p and user private key security parameter f t To build public contracts in the blockchain;
[0041] A public contract is built on the blockchain to submit encrypted data corresponding to the description information sent by the user to the endorsing node when the description information sent by the user is received.
[0042] In the endorsement node, the encrypted data corresponding to the description information sent by the user is improved to form the returned encrypted data, and the returned encrypted data is processed on the blockchain.
[0043] Based on user private key security parameter f t The data access sharing model decrypts the encrypted data returned after being uploaded to the blockchain to form a shared result.
[0044] By using blockchain smart contracts, the sharing results are returned to the user, thus completing the sharing process.
[0045] In a second aspect, the present invention provides an electronic device comprising a memory, a processor, and a transceiver connected in sequence and communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the blockchain-based data security sharing method as described in the first aspect or any possible design of the first aspect.
[0046] Thirdly, the present invention provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the blockchain-based secure data sharing method as described in the first aspect or any possible design of the first aspect.
[0047] Beneficial Effects: This invention provides a blockchain-based method for secure data sharing. Specifically, firstly, shared data is stored in the blockchain to form a shared database. The data in the shared database is then classified, and a hierarchical access tree model is constructed based on the classification results. Secondly, the shared database is filtered to obtain the target dataset G, and a public security parameter H is set according to the hierarchical access tree model. par Then, based on the public safety parameter H par The master key and public key are generated through an authoritative center, and the public key security parameter h is calculated using a hash function. pThen, based on the public key and the public key security parameter h p Each child node is encrypted to obtain encrypted data. Then, based on the target dataset G, the master key, and the public key, a data access sharing model is constructed. According to the data access sharing model, a user private key is generated, and the user private key security parameter f is calculated using a hash function. t Finally, a public contract is constructed in the blockchain to output encrypted data in ciphertext, based on the user's private key security parameter f. t This method enables data decryption and sharing. It categorizes data using attribute encryption and then encrypts it according to data type, further enhancing the security of shared data. Furthermore, it establishes a hierarchical access tree model based on data type, optimizing storage paths and creating access levels corresponding to access permissions. This makes data retrieval more efficient for users, significantly reducing sharing time and increasing the data sharing rate. Attached Figure Description
[0048] Figure 1 This is a flowchart of a blockchain-based data security sharing method in an embodiment of the present invention. Detailed Implementation
[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.
[0050] It should be understood that although the terms first, second, etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit, without departing from the scope of the exemplary embodiments of the invention.
[0051] It should be understood that the term "and / or" that may appear in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" that may appear in this document describes another relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this document generally indicates that the related objects before and after it are in an "or" relationship.
[0052] Example:
[0053] like Figure 1 As shown, this embodiment provides a blockchain-based data security sharing method, including:
[0054] S100. Store shared data in the blockchain to form a shared database, classify the data in the shared database, and construct a hierarchical access tree model based on the classification results. The hierarchical access tree model contains multiple levels, each level includes at least one child node, and each child node has a unique attribute position. A fixed hash value h is generated for each child node.
[0055] In one possible implementation, step S100 involves storing shared data into a blockchain to form a shared database, classifying the data in the shared database, and constructing a hierarchical access tree model based on the classification results, including:
[0056] S1001. Classify the data in the shared database in a keyless escrow mode to obtain the data types in the shared database;
[0057] S1002. Based on the data types in the shared database, a hierarchical access tree model is constructed using a hierarchical structure. This hierarchical access tree model includes at least four levels, each level including at least one child node. Each child node corresponds to a type of data, identified by a node identifier R and its coordinates (x, y). mn ,y mn Each child node is uniquely identified by its attribute position, where x represents the main category of the data, y represents the subcategory of the data, m represents the horizontal hierarchy number, and n represents the vertical child node number.
[0058] S1003. Use an irreversible hash function h = Hash(x) mn ,y mn Map the coordinates of each child node to generate a fixed hash value h.
[0059] The initial hierarchical access tree model consists of at least four levels. Each level uniquely identifies the attribute location of its child nodes through a node identifier R and coordinates (x, y). For example, the first level is the root node, the second level is the first-level child node, and so on. The coordinates (x, y) of each child node... mn ,y mn In this context, m represents the horizontal hierarchy number, and n represents the vertical child node number. For example, (x 12 ,y 12 The first node represents the second child node of the first level. Furthermore, in actual data storage, the initial hierarchical access tree model can be dynamically updated based on the addition and expansion of new data. Newly added data types can be dynamically expanded by adjusting coordinates, without requiring a complete restructuring of the overall structure, thus ensuring the flexibility of the entire hierarchical access tree model. This is achieved through the hash function h = Hash(x...). mn ,y mn By irreversibly mapping the coordinates of each child node to generate a fixed-length hash value h, the fixed hash value h can be used as the basis for access permission verification in the data sharing process. Furthermore, for the hierarchical access tree model, hierarchical file reading technology can optimize storage space utilization. In the data sharing process, the hierarchical access tree model enables the pre-allocation of node data transmission paths, reducing data sharing latency and sharing time.
[0060] It should be noted that using an irreversible hash function to map the coordinates of each child node and generate a fixed-length hash value largely ensures the uniqueness and collision resistance of the hash value.
[0061] S200. Filter the shared database to obtain the target dataset G, and set the public security parameter H according to the hierarchical access tree model. par ;
[0062] In one possible implementation, in step S200, data is filtered in the shared database to obtain the target dataset G, and public security parameters H are set according to the hierarchical access tree model. par ,include:
[0063] S2001. Obtain the existing keyword g in the blockchain, and perform data retrieval on the shared database based on the existing keyword g to determine the target dataset G = {g|g∈θ}, where θ is used to represent the data set in the shared database;
[0064] S2002. Based on the hierarchical structure of the hierarchical access tree model, according to H par =(F1,T g ,f g ,K 1,K2,P) Initialize and set the public safety parameter H par Where F1 represents the generator of the public safety parameters; T g f represents the order of the generator. g K represents the total number of generators, K1 and K2 represent the shared multi-components of the hash function, and P represents the number of authoritative centers.
[0065] Among them, F1, as the generator of public security parameters, is actually the generator of the bilinear mapping hash function. Its corresponding bilinear mapping vector interval can be defined as a multi-dimensional vector based on the number of levels in the hierarchical access tree model (e.g., four levels correspond to a four-dimensional vector), used for weight allocation of permission tags; while T... g Then, it represents the order of the generator, which can be set to a large prime number (256 bits) to ensure the encryption algorithm's resistance to quantum attacks; K1 and K2 can be generated by expanding the hash value h of the child nodes in the hierarchical access tree model; P represents the number of authoritative centers, and multiple authoritative centers forming a consortium blockchain can ensure that there will be no leakage due to a single point of failure.
[0066] Furthermore, in step S200, the public security parameter H is set according to the hierarchical access tree model. par After that, it also includes:
[0067] The hash value h of each child node in the hierarchical access tree model is compared with the public security parameter H. par The association is used to generate permission tags for each child node, where the hash value h of each child node corresponds to the access permissions of a type of data.
[0068] Collision resistance verification is performed on the permission labels of each child node. If the permission labels of the child nodes are the same, it is considered that there is a collision between the permission labels of the child nodes. In this case, a unique identifier is added to the child node with the collision, and the hash value h of the child node with the collision is recalculated, and the corresponding permission label is generated. The verification is performed again until there is no collision between the permission labels of the child nodes. If the permission labels of the child nodes are all different, it is considered that there is no collision between the permission labels of the child nodes. The public security parameter H is then set to... par Write it into a blockchain smart contract.
[0069] Specifically, the hash value h of each child node in the hierarchical access tree model is compared with the public security parameter H. par Association is used to generate permission tags for each child node, and the public security parameter H is associated with it. par Write it into a blockchain smart contract, and in the subsequent sharing process, the blockchain smart contract uses H par Parse the access policy and verify whether the user's permissions meet the conditions for obtaining the corresponding shared data.
[0070] It should be noted that if the permission tags (hash values h) generated by the hash function collide, that is, different node coordinates generate the same hash value, it may lead to permission verification errors or data leakage. In fact, although hash functions are highly resistant to collision (the probability of collision is extremely low), there is still a certain risk in practical applications, especially in large-scale data sharing systems. Therefore, it is necessary to perform anti-collision verification on the permission tags of each child node to ensure sharing security and data integrity.
[0071] S300. Based on public safety parameter H par The master key and public key are generated through an authoritative center, and the public key security parameter h is calculated using a hash function. p ;
[0072] In one possible implementation, in step S300, based on the public safety parameter H... par The master key and public key are generated through an authoritative center, and the public key security parameter h is calculated using a hash function. p ,include:
[0073] S3001. Based on public safety parameter H par The master key is generated through an authoritative center;
[0074] S3002. Based on public safety parameter H par Public keys are generated through an authoritative center;
[0075] S3003. Define an encrypted hash function H1, and use the encrypted hash function H1 to calculate the public key security parameter h of the public key. p .
[0076] S400. Based on public key and public key security parameter h p Each child node is encrypted to obtain encrypted data;
[0077] In one possible implementation, in step S400, based on the public key and the public key security parameter h... p Each child node is encrypted to obtain encrypted data, including:
[0078] S4001. Generate access policies for each child node according to the attribute encryption method;
[0079] S4002. Based on the public key, using the public key security parameter h p As a generator, the hash value h of each child node is embedded into the ciphertext, and each child node is encrypted according to the access strategy of each child node to form pre-encrypted data.
[0080] S4003. Using the public key security parameter hp Complete the security verification of the encryption process and use the verified pre-encrypted data as the encrypted data;
[0081] S4004. Write the encrypted data into the blockchain to complete the data upload process.
[0082] S500. Based on the target dataset G, master key, and public key, a data access sharing model is constructed. According to the data access sharing model, a user private key is generated, and the user private key security parameter f is calculated using a hash function. t ;
[0083] In one possible implementation, in step S500, a data access sharing model is constructed based on the target dataset G, the master key, and the public key. A user private key is then generated according to the data access sharing model, and a user private key security parameter f is calculated using a hash function. t ,include:
[0084] S5001. Based on the target dataset G, a data access sharing model is constructed using the access strategies of each child node;
[0085] S5002. Based on the data access sharing model, randomly generate a pre-user private key based on the user ID;
[0086] S5003. Based on the master key, verify the legitimacy of the pre-user private key, and distribute the verified pre-user private key according to the user ID;
[0087] S5004. Use blockchain smart contracts to record the key distribution process to prevent key leakage;
[0088] S5005. Define a decryption hash function H2, and use the decryption hash function H2 to calculate the user's private key security parameter f. t .
[0089] The data access sharing model is actually used to retrieve and decrypt encrypted data according to the access policy. By combining it with the attribute encryption algorithm and using the hierarchical access tree model, the data access sharing model can achieve: dynamic allocation of permissions based on user ID, attributes, etc., to improve the security of sharing. Furthermore, through attribute encryption and blockchain smart contracts, new data is dynamically updated to optimize performance and achieve sharing of larger-scale data.
[0090] S600. Construct public contracts in the blockchain to output encrypted data in ciphertext, based on the user's private key security parameter f. t Data decryption is achieved, and sharing is completed.
[0091] In one possible implementation, in step S600, a public contract is constructed in the blockchain to output encrypted data in ciphertext, based on the user's private key security parameter f. t To achieve data decryption and complete sharing, the following steps are included:
[0092] S6001. Based on the public key security parameter h p and user private key security parameter f t To build public contracts in the blockchain;
[0093] S6002. Construct a public contract based on the blockchain to submit encrypted data corresponding to the description information sent by the user to the endorsing node when the description information sent by the user is received;
[0094] S6003. In the endorsement node, the encrypted data corresponding to the description information sent by the user is improved to form the returned encrypted data, and the returned encrypted data is processed on the blockchain.
[0095] S6004. Based on user private key security parameter f t The data access sharing model decrypts the encrypted data returned after being uploaded to the blockchain to form a shared result.
[0096] S6005. Utilize blockchain smart contracts to return the sharing results to the user, thus completing the sharing process.
[0097] It should be noted that the integrity of the shared data is verified by the endorsing node, and the result is returned to the client; the client can also listen to the blockchain network, and after confirming that the data has been successfully uploaded to the chain, the smart contract will be triggered to return the sharing result to the user; a sorting node is introduced into the process to perform global sorting of transactions to ensure the temporal consistency of data sharing.
[0098] This embodiment also provides an electronic device, including a memory, a processor, and a transceiver that are sequentially and communicatively connected. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the blockchain-based secure data sharing method in any of the above embodiments.
[0099] This embodiment also provides a computer program product containing instructions that, when executed on a computer, implement the blockchain-based secure data sharing method in any of the above embodiments.
[0100] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A data security sharing method based on blockchain, characterized in that, include: Shared data is stored in the blockchain to form a shared database. The data in the shared database is classified and processed, and a hierarchical access tree model is constructed based on the classification results. The hierarchical access tree model contains multiple levels, each level includes at least one child node, and each child node has a unique attribute position. A fixed hash value h is generated for each child node. Data is filtered through the shared database to obtain the target dataset G, and public security parameters are set according to the hierarchical access tree model. ; Based on public safety parameters The master key and public key are generated through an authoritative center, and the public key security parameters are calculated using a hash function. ; Based on public key and public key security parameters Each child node is encrypted to obtain encrypted data; Based on the target dataset G, master key, and public key, a data access sharing model is constructed. According to this model, user private keys are generated, and user private key security parameters are calculated using a hash function. ; Build public contracts in the blockchain to output encrypted data in ciphertext, based on user private key security parameters. Data decryption and sharing are accomplished; This involves storing shared data in a blockchain to form a shared database, classifying the data in the shared database, and constructing a hierarchical access tree model based on the classification results, including: The data in the shared database is classified and processed in a keyless escrow mode to obtain the data types in the shared database; Based on the data types in the shared database, a hierarchical access tree model is constructed using a hierarchical structure. This model includes at least four levels, each level containing at least one child node. Each child node corresponds to a type of data, identified by a node identifier R and its coordinates. The attribute position of each child node is uniquely identified, where x represents the main category of the data, y represents the subcategory of the data, m represents the horizontal hierarchy number, and n represents the vertical child node number. Using an irreversible hash function Map the coordinates of each child node to generate a fixed hash value h.
2. The data security sharing method based on blockchain according to claim 1, characterized in that, Data is filtered through the shared database to obtain the target dataset G, and public security parameters are set according to the hierarchical access tree model. ,include: Obtain existing keywords g from the blockchain, and perform data retrieval from the shared database based on existing keywords g to determine the target dataset. ,in, Used to represent a collection of data in a shared database; Based on the hierarchical structure of the hierarchical access tree model, according to Initialize and set public safety parameters ,in, Represents the generator of public safety parameters; Indicates the order of the generator. Indicates the total number of generators. and These represent the shared multiple components of the hash function, and P represents the number of authoritative centers.
3. The data security sharing method based on blockchain according to claim 1, characterized in that, Setting public safety parameters based on the hierarchical access tree model After that, it also includes: The hash value h of each child node in the hierarchical access tree model is compared with the public security parameter. The association is used to generate permission tags for each child node, where the hash value h of each child node corresponds to the access permissions of a type of data. Collision resistance verification is performed on the permission tags of each child node. If the permission tags of various child nodes are the same, it is considered that there is a collision between the permission tags of various child nodes. In this case, a unique identifier is added to the child node with the collision, and the hash value h of the child node with the collision is recalculated, and the corresponding permission tag is generated. The verification is performed again until there is no collision between the permission tags of various child nodes. If the permission tags of various child nodes are all different, it is considered that there is no collision between the permission tags of various child nodes. The public security parameter is then... Write it into a blockchain smart contract.
4. The data security sharing method based on blockchain according to claim 1, characterized in that, Based on public safety parameters The master key and public key are generated through an authoritative center, and the public key security parameters are calculated using a hash function. ,include: Based on public safety parameters The master key is generated through an authoritative center; Based on public safety parameters Public keys are generated through an authoritative center; Define a cryptographic hash function Using cryptographic hash functions Calculate the public key security parameters of the public key. .
5. The data security sharing method based on blockchain according to claim 1, characterized in that, Based on public key and public key security parameters Each child node is encrypted to obtain encrypted data, including: Based on the attribute encryption method, generate access policies for each child node; Based on the public key, using public key security parameters As a generator, the hash value h of each child node is embedded into the ciphertext, and each child node is encrypted according to the access strategy of each child node to form pre-encrypted data. Using public key security parameters Complete the security verification of the encryption process and use the verified pre-encrypted data as the encrypted data; Encrypted data is written to the blockchain, completing the data upload process.
6. The data security sharing method based on blockchain according to claim 5, characterized in that, Based on the target dataset G, master key, and public key, a data access sharing model is constructed. According to this model, user private keys are generated, and user private key security parameters are calculated using a hash function. ,include: Based on the target dataset G, a data access sharing model is constructed using the access strategies of each child node. Based on the data access sharing model, a pre-user private key is randomly generated based on the user ID; Based on the master key, the legitimacy of the pre-user private key is verified, and the verified pre-user private key is distributed according to the user ID; Use blockchain smart contracts to record the key distribution process to prevent key leakage; Define the decryption hash function Using the decryption hash function Calculate the user's private key security parameters .
7. The data security sharing method based on blockchain according to claim 1, characterized in that, Build public contracts in the blockchain to output encrypted data in ciphertext, based on user private key security parameters. To achieve data decryption and complete sharing, the following steps are included: Based on public key security parameters and user private key security parameters To build public contracts in the blockchain; A public contract is built on the blockchain to submit encrypted data corresponding to the description information sent by the user to the endorsing node when the description information sent by the user is received. In the endorsement node, the encrypted data corresponding to the description information sent by the user is improved to form the returned encrypted data, and the returned encrypted data is processed on the blockchain. Based on user private key security parameters The data access sharing model decrypts the encrypted data returned after being uploaded to the blockchain to form a shared result. By using blockchain smart contracts, the sharing results are returned to the user, thus completing the sharing process.
8. An electronic device, characterized in that, The device includes a memory, a processor, and a transceiver that are sequentially and communicatively connected. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the blockchain-based data security sharing method as described in any one of claims 1 to 7.
9. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or the instructions are executed by the computer, they implement the blockchain-based data security sharing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Role-based complete access control method under intelligent contract
CN112543105A
Private data sharing and retrieval method, system and equipment based on block chain
CN116663046A