A blockchain-based attribute-based searchable encrypted data sharing method
By employing a blockchain-based attribute-based searchable encryption method, the problems of high private key management burden and communication costs in cloud computing environments are solved. This enables secure data sharing and fine-grained access control, reduces communication and search overhead, and ensures the integrity and security of results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING UNIV OF POSTS & TELECOMM
- Filing Date
- 2022-11-23
- Publication Date
- 2026-05-05
AI Technical Summary
In a cloud computing environment, existing attribute-based searchable encryption schemes result in heavy private key management burdens, high communication and search costs, and the untrustworthiness of cloud servers leads to frequent instances of unfair service.
A blockchain-based attribute-based searchable encryption method is adopted. Public parameters and aggregated private keys are generated through system initialization to build a secure searchable index. Search smart contracts and verification smart contracts are used to realize the storage and retrieval of encrypted keyword indexes, reducing private key management and communication overhead.
It achieves data tamper-proofing and result integrity verification, reduces the burden of private key management for data users, lowers communication and search overhead, and ensures fine-grained access control and high computational efficiency.
Smart Images

Figure CN115834200B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of blockchain privacy protection and secure sharing of encrypted data, and more specifically, relates to a blockchain-based attribute-based searchable encrypted data sharing method. Background Technology
[0002] With the explosive growth of data and the development of cloud computing, more and more organizations are outsourcing their data and services to the cloud to reduce local computing and storage overhead. Considering the untrustworthiness of cloud servers and the need for user data privacy and security, data needs to be encrypted before being uploaded. In this environment, users will encounter the problem of not being able to search for keywords in massive amounts of data, which to some extent limits the flexibility of file sharing in the cloud environment.
[0003] The introduction of searchable encryption technology enables users to search encrypted data by keywords without compromising user data privacy, saving them significant network and computing costs. However, while users can obtain encrypted data with any keywords of interest from the server, data owners cannot achieve fine-grained access to the data. Combining searchable encryption technology with attribute-based encryption technology can achieve effective encrypted keyword search and fine-grained access control.
[0004] In a multi-owner environment, for existing attribute-based searchable encryption schemes, data owners are unwilling to share their master keys, which are essential for maintaining their privacy and data security, with others. As a result, data users must maintain multiple private keys from different data owners, creating a heavy burden of private key management. Furthermore, data users need to submit multiple trapdoors using different private keys to retrieve data, which leads to high communication and search costs.
[0005] Cloud servers are semi-honest and curious entities. They may return partial or incorrect search results in order to save on computing power or to fraudulently obtain service fees. At the same time, users may claim that the correct results are incorrect and refuse to pay service fees after receiving the correct results, resulting in an unfair service-payment situation. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of the prior art by proposing a blockchain-based attribute-based searchable encrypted data sharing method to reduce system communication and search overhead and achieve secure sharing of private data.
[0007] To address at least one of the aforementioned technical problems, according to one aspect of the present invention, a blockchain-based attribute-based searchable encrypted data sharing method is provided, comprising the following steps:
[0008] S10, System initialization, each data owner D iCalculate its own public parameters and master key, and aggregate its own public parameters to generate system public parameters;
[0009] S20. Generate an aggregated private key based on the attribute set of data user DU;
[0010] S30, encrypted data files and keyword index;
[0011] S40. Construct a secure and searchable index; A secure and searchable index is achieved by using an inverted index structure. The inverted index consists of two parts: a dictionary and an inverted list, and includes several data structures such as lookup tables, search arrays, and linked lists.
[0012] S50. Generate a search trapdoor; Data user DU encrypts the keyword q of interest based on the received aggregated private key, generates a search trapdoor, and uploads it to the blockchain;
[0013] S60, Search; Data user DU submits a query trap, the search smart contract will use it to perform a linear search on the secure searchable index, verify whether the access control policy of the search trap matches the ciphertext keyword index, and send all the successfully matched results to the verification smart contract.
[0014] S70. Verification: Verify whether the keywords in the encrypted keyword index are the same as the query keywords in the trapdoor. If the match is successful, send the identifier of the corresponding file to the cloud server and verify the integrity of the results returned by the cloud server.
[0015] S80, Decryption;
[0016] Data user DU uses a symmetric key for decryption.
[0017] Furthermore, step S10 is detailed as follows:
[0018] S11. Define a bilinear mapping e: G1 × G1 → G2, and choose a symmetric cryptographic algorithm SE = (SE.Enc, SE.Dec) and two hash functions H1: {0, 1} * →G1, H2: {0, 1} * →Z p * Where e is a bilinear mapping, G1 and G2 are two multiplicative cyclic groups, SE.Enc is a symmetric encryption algorithm, SE.Dec is a symmetric decryption algorithm, and Z... p * Let p be the group of integers modulo p;
[0019] S12, Each data owner D i Select two random numbers α i and a i ,calculate and And send it to other data owners, when each data owner D i Received all E j and A j , j∈{1,...,n}\{i},D i calculate Where α i a i Belongs to the integer group Z p * g is a generator of G1, and p is the order of the multiplicative groups G1 and G2.
[0020] S13, Each data owner D i Let i ∈ {2, ..., n-1}, and choose a random number λ. i ,calculate Send to D respectively i-1 and D i+1 Generate its own master key For data owner D1, then Send to D n and D2, while D n Will Send to D n-1 and D1, and Where λ i Belongs to the integer group Z p * ;
[0021] S14. Public system public parameter PK = {E, A}, and data owner D... i Keep your own master key MK confidential i =(α i ,β i ).
[0022] Furthermore, step S20 is detailed as follows:
[0023] S21, Each data owner D i Use its own master key α i β i Calculate β i ·(1+α i *p), and sends it to a specific data owner, who calculates the intermediate parameters A, A′, and A″ using the following formula:
[0024]
[0025]
[0026]
[0027] S22. Generate the first key parameter for the data user with attribute set U based on the intermediate parameter A″.
[0028] S23, Each data owner D i Choose a random number t i Calculate a i t i and β i ·(1+t i *p) is sent to a specific data owner, who calculates intermediate parameters. and Where t i Belongs to the integer group Z p * ;
[0029] S24. Calculate the second key parameter for the data user using intermediate parameters C and D. The third key parameter and the fourth key parameter Where x belongs to the attribute set U, and H1 is the hash function;
[0030] S25. The data owner generates an aggregated private key {K1, K2, K3, {K...} based on the above four key parameters. x}}, and then return it to the data user DU through a secure channel.
[0031] Furthermore, the specific steps of step S30 are as follows:
[0032] S31, Data Owner D i Choosing k as the symmetric key, we encrypt the data file F using k, obtaining the encrypted data file C. k =SE.Enc(F), where SE.Enc is a symmetric encryption algorithm;
[0033] S32. The data owner uploads the encrypted data file to the cloud server, uploads the ciphertext hash to the blockchain, and the cloud server returns the storage address to the data owner.
[0034] S33. The data owner extracts the index key w from the data file F and defines an access strategy (M, ρ) to encrypt the key w, where M is a matrix with l rows and n columns, and ρ is the inner mapping function, which is the value of each row M of matrix M. o The mapping to attribute ρ(x) is such that each attribute has a unique row in matrix M corresponding to it;
[0035] S34. The data owner selects a random number s and n-1 random values y2, ..., y3.n , forming a random vector For each row M of matrix M θ θ∈[1,...,l], calculate Where s is the secret value to be shared, belonging to the integer group Z. p * M θ Let θ be the row vector of matrix M;
[0036] S35. The data owner uses the PK encryption key w to calculate the first key index parameter. The second keyword index parameter τ2 = g s and the third keyword index parameter Where e is a bilinear mapping, g is a generator of G1, and α i Belongs to the integer group Z p * H2 is the hash function, s is the secret value, θ belongs to [1, ..., l], and ρ is the inner mapping function;
[0037] S36. The data owner generates the encrypted keyword index ind using the above keyword index parameters. w =(τ1, τ2, τ) θ Uploaded to the blockchain.
[0038] Furthermore, step S40 specifically includes:
[0039] S41. Initialization: Scan the data file and construct a dictionary Δ. For each key w∈Δ, construct D. w Where Δ is the set of all keywords in the scanned data file, and D w This is the set of all data file identifiers mapped to the keyword w;
[0040] S42. Construct a lookup table that allows searching each linked list L i The first element is located and decrypted. Each entry in the lookup table corresponds to a key w∈Δ, and this entry is determined by...<value,address> The value field is composed of the index key ind. w and L i The decryption key for the first element, address represents L i The storage address of the first element, where Δ is the set of all keywords in the scanned data file, and the linked list L. i Stored in an array In the middle, there is a set of nodes;
[0041] S43. Create a search array For each key w∈Δ, the linked list node structure is defined as follows: 1≤j≤|D w |, due to L i Each element contains information about L i The information of the next element is obtained by decryption, which yields the corresponding file identifier stored in the node and the decryption key and location of the next node, until the node is empty. Here, "||" is the string concatenation operator, and id(D w.j ) represents the j-th data file D corresponding to the keyword w. w,j File identifier, k w,j+1 addr is the decryption key for the (j+1)th key node. w,j+1 For the address information of the (j+1)th key node in the table, |D w | indicates the total number of data file identifiers mapped by the keyword w.
[0042] Furthermore, step S50 specifically includes:
[0043] S51, the data user, based on the received aggregated private key {K1, K2, K3, {K... x Choose a random number δ and calculate the intermediate parameter A = K1(K2). δ B = (K3) δ C x ={(K x ) δ} x∈U , where δ belongs to the integer group Z p * U represents the attribute set of the data user;
[0044] S52. The data user calculates H2(q) and encrypts its hash value as the first search trapdoor parameter. Second search trapdoor parameter and the third search trapdoor parameter Where q is the keyword that the data user wants to query, α i a i t i δ is the integer group Z p * A random number on / , g is a generator of the multiplicative cyclic group G1, and any x belongs to the attribute set U;
[0045] S53. The data user calculates the search trapdoor T based on the above search trapdoor parameters. q =(T1, T2, {T x} x∈U And send it to the blockchain.
[0046] Furthermore, step S60 specifically includes:
[0047] S61. A data user submits a query trapdoor. The search smart contract in the blockchain will use the query trapdoor to perform a linear search on the secure searchable index. If T... q The attribute set U in the middle does not satisfy the condition of ind. w The associated (M, ρ) is then matched with the next keyword index ciphertext;
[0048] S62, if T q The attribute set in the ind satisfies the condition of ind w For the associated (M, ρ), all successfully matched results will be sent to the verification smart contract.
[0049] Furthermore, step S70 specifically includes:
[0050] S71. Define a subset {1, 2, ..., l} as Θ = {θ: ρ(θ) ∈ U}. Based on Θ and M, a search algorithm calculates a set of constants {χ... i} i∈Θ , such that ∑ i∈Θ χ i M i = (1, 0, ..., 0), where M i If U is the i-th row of the LSSS matrix, and U satisfies the condition ind w For the associated (M, ρ), the matching rules are used to check whether the keywords q and w match. The matching rules are as follows:
[0051] S72. If a match is successful, generate the decryption key for the first node in the linked list corresponding to the keyword queried in the decryption lookup table. Since L... i Each element contains information about L i The information of the next element is obtained by decryption, which can obtain the corresponding file identifier stored in the node, the decryption key of the next node, and the location, until the node is empty. The corresponding set of found file identifiers is then sent to the cloud server.
[0052] S73: The cloud server sends the encrypted file set to the blockchain, verifies the integrity of the data through a smart contract, and then sends the encrypted data to the user.
[0053] According to another aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the blockchain-based attribute-based searchable encrypted data sharing method of the present invention.
[0054] According to another aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the blockchain-based attribute-based searchable encrypted data sharing method of the present invention.
[0055] Compared with the prior art, the present invention has at least the following beneficial effects:
[0056] 1. Based on blockchain, by introducing search smart contracts and verification smart contracts, the encrypted keyword index is stored in the blockchain to prevent data tampering, while also verifying the integrity of the results returned by the cloud server.
[0057] 2. Data users only need to maintain one private key, instead of holding multiple private keys from different data owners.
[0058] 3. Data users only need to use a single trapdoor for each search, which can greatly reduce communication and search overhead.
[0059] 4. The combination of attribute-based encryption and searchable encryption ensures that the blockchain can only return search results when the data user's attribute set meets the access policy in the ciphertext and the keywords match. This not only enables fine-grained access control but also has high computational efficiency. Attached Figure Description
[0060] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments will be briefly described below. Obviously, the drawings described below only relate to some embodiments of the present invention and are not intended to limit the present invention.
[0061] Figure 1 This is a system model diagram of the method of the present invention;
[0062] Figure 2 This is a flowchart illustrating the generation of ciphertext and index in the method of the present invention. Detailed Implementation
[0063] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention.
[0064] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0065] Example 1:
[0066] like Figures 1-2As shown, a blockchain-based attribute-based searchable encrypted data sharing method includes the following steps:
[0067] Step 1: System initialization, each data owner D i Calculate its own public parameters and master key MK i At the same time, their respective common parameters are aggregated to generate system common parameters PK;
[0068] Step 1.1: Define a bilinear mapping e: G1×G1→G2, and choose an AES symmetric cryptographic algorithm SE=(SE.Enc,SE.Dec) and two hash functions H1: {0,1} * →G1, H2: {0, 1} * →Z p * Where e is a bilinear mapping, G1 and G2 are two multiplicative cyclic groups, SE.Enc is a symmetric encryption algorithm, SE.Dec is a symmetric decryption algorithm, and Z... p * Let p be the group of integers modulo p;
[0069] Step 1.2: Each data owner D i Select two random numbers α i and a i ,calculate and And send it to other data owners, when each data owner D i Received all E j and A j , j∈{1,...,n}\{i},D i calculate Where α i a i Belongs to the integer group Z p * g is a generator of G1, and p is the order of the multiplicative groups G1 and G2.
[0070] Step 1.3: Each data owner D i Let i ∈ {2, ..., n-1}, and choose a random number λ. i ,calculate Send to D respectively i-1 and D i+1 Generate its own master key For data owner D1, then Send to D n and D2, while D n Will Send to D n-1 and D1, and Where λ iBelongs to the integer group Z p * ;
[0071] Step 1.4: Publicly disclose the system's public parameters PK = {E, A}, while simultaneously keeping the data owner D confidential. i Its own master key MK i =(α i ,β i ).
[0072] Step 2: Generate an aggregated private key {K1, K2, K3, {K} based on the attribute set U of data user DU. x}};
[0073] Step 2.1: Each data owner D i Use its own master key α i β i Calculate β i ·(1+α i *p), and send it to a specific data owner, β i Used to guarantee α i To maintain confidentiality, the owner of this specific data calculates the intermediate parameters A, A′, and A″ using the following formula:
[0074]
[0075]
[0076]
[0077] Step 2.2: Generate the first key parameter for the data user with attribute set U based on the intermediate parameter A″.
[0078] Step 2.3: Each data owner D i Choose a random number t i Calculate a i t i and β i ·(1+t i *p) is sent to a specific data owner, who calculates intermediate parameters. and Where t i Belongs to the integer group Z p * ;
[0079] Step 2.4: Calculate the second key parameter for the data user using intermediate parameters C and D. The third key parameter and the fourth key parameter Where x belongs to the attribute set U, and H1 is the hash function;
[0080] Step 2.5: The data owner generates an aggregated private key {K1, K2, K3, {K...} based on the four key parameters mentioned above. x}}, and then return it to the data user DU through a secure channel.
[0081] like Figure 2 As shown, step 3: Encrypt the data file and keyword index;
[0082] The data owner encrypts the data file using the AES symmetric encryption algorithm, uploads the generated ciphertext data to the cloud server, then selects an appropriate LSSS access strategy to encrypt the index key w, and finally transmits the generated ciphertext index key ind. w Uploaded to the blockchain;
[0083] Step 3.1: Data owner D i Choosing k as the symmetric key, we encrypt the data file F using k, obtaining the encrypted data file C. k =SE.Enc(F), where SE.Enc is a symmetric encryption algorithm;
[0084] Step 3.2: Data Owner D i The encrypted data file is uploaded to the cloud server, the ciphertext hash is uploaded to the blockchain, and the cloud server returns the storage address to the data owner.
[0085] Step 3.3: The data owner extracts the index key w from the data file F and defines an access strategy (M, ρ) to encrypt the key w, where M is a matrix with l rows and n columns, and ρ is the inner mapping function, which is the value of each row M of matrix M. θ The mapping to attribute ρ(x) is such that each attribute has a unique row in matrix M corresponding to it;
[0086] Step 3.4: The data owner selects a random number s and n-1 random values y2, ..., y3. n , forming a random vector For each row M of matrix M θ θ∈[1,...,l], calculate Where s is the secret value to be shared, belonging to the integer group Z. p * M θ Let θ be the row vector of matrix M;
[0087] Step 3.5: The data owner uses the PK to encrypt the key w and calculates the first key index parameter. The second keyword index parameter τ2 = g s and the third keyword index parameter Where e is a bilinear mapping, g is a generator of G1, and α i Belongs to the integer group Z p * H2 is the hash function, s is the secret value, θ belongs to [1, ..., l], and ρ is the inner mapping function;
[0088] Step 3.6: The data owner generates the encrypted keyword index ind using the keyword index parameters mentioned above. w =(τ1, τ2, τ) θ Uploaded to the blockchain.
[0089] Step 4: Build a secure and searchable index;
[0090] A searchable and secure index is achieved by using an inverted index structure. The inverted index consists of two parts: a dictionary and an inverted list. It includes several data structures such as lookup tables, search arrays, and linked lists. The dictionary is a collection of all keywords in the data file, while the inverted list consists of the identification information of all documents containing the keywords. It also includes pointers to the corresponding inverted lists and other information as needed.
[0091] Step 4.1: Initialization, scan the data file and construct a dictionary Δ. For each key w∈Δ, construct D. w Where Δ is the set of all keywords in the scanned data file, and D w This is the set of all data file identifiers mapped to the keyword w;
[0092] Step 4.2: Construct a lookup table that allows lookups on each linked list L. i The first element is located and decrypted. Each entry in the lookup table corresponds to a key w∈Δ, and this entry is determined by...<value,address> The value field is composed of the index key ind. w and L i The decryption key for the first element, address represents L i The storage address of the first element, where Δ is the set of all keywords in the scanned data file, and the linked list L. i Stored in an array In the middle, there is a set of nodes;
[0093] Step 4.3: Create the search array For each key w∈Δ, the linked list node structure is defined as follows: 1≤j≤|D w|, due to L i Each element contains information about L i The information of the next element is obtained by decryption, which yields the corresponding file identifier stored in the node and the decryption key and location of the next node, until the node is empty. Here, "||" is the string concatenation operator, and id(D w,j ) represents the j-th data file D corresponding to the keyword w. w,j File identifier, k w,j+1 addr is the decryption key for the (j+1)th key node. w,j+1 For the address information of the (j+1)th key node in the table, |D w | indicates the total number of data file identifiers mapped by the keyword w.
[0094] Step 5: Generate the search trapdoor T q ;
[0095] Data user DU encrypts the keyword q of interest based on the received aggregated private key and generates a search trapdoor T. q Uploaded to the blockchain;
[0096] Step 5.1: The data user uses the received aggregated private key {K1, K2, K3, {K} x Choose a random number 6, and calculate the intermediate parameter A = K1(K2). δ B = (K3) δ C x ={(K x ) δ} x∈U , where δ belongs to the integer group Z p * U represents the attribute set of the data user;
[0097] Step 5.2: The data user calculates H2(q) and encrypts its hash value into the first search trapdoor parameter. Second search trapdoor parameter and the third search trapdoor parameter Where q is the keyword that the data user wants to query, α i a i t i δ is the integer group Z p * The random number on the property set U, g is the generator of the multiplicative cyclic group G1, and any x belongs to the property set U.
[0098] Step 5.3: The data user calculates the search trapdoor T based on the search trapdoor parameters mentioned above. q =(T1, T2, {T x} x∈UAnd send it to the blockchain.
[0099] Step 6: Search;
[0100] Step 6.1: The data user submits a query trapdoor. The search smart contract in the blockchain will use the query trapdoor to perform a linear search on the safe searchable index. If T q The attribute set U in the middle does not satisfy the condition of ind. w The associated (M, ρ) is then matched with the next keyword index ciphertext;
[0101] Step 6.2: If T q The attribute set in the ind satisfies the condition of ind w For the associated (M, ρ), all successfully matched results will be sent to the verification smart contract.
[0102] Step 7: Verification;
[0103] The smart contract is verified to check whether the keywords in the encrypted keyword index are the same as the query keywords in the trapdoor. If the match is successful, the identifier of the corresponding file is sent to the cloud server, and the integrity of the cloud return results is verified at the same time.
[0104] Step 7.1: Define a subset {1, 2, ..., 1} as Θ = {θ: ρ(θ) ∈ U}. Based on Θ and M, the search algorithm calculates a set of constants {χ i} i∈Θ , such that ∑ i∈Θ χ i M i = (1, 0, ..., 0), where M i If U is the i-th row of the LSSS matrix, and U satisfies the condition ind w For the associated (M, ρ), the matching rules are used to check whether the keywords q and w match. The matching rules are as follows:
[0105] Step 7.2: If a match is successful, generate the decryption key for the first node in the linked list corresponding to the keyword queried in the decryption lookup table. Since L... i Each element contains information about L i The information of the next element is obtained by decryption, which can obtain the corresponding file identifier stored in the node, the decryption key of the next node, and the location, until the node is empty. The corresponding set of found file identifiers is then sent to the cloud server.
[0106] Step 7.3: The cloud server sends the set of encrypted files to the blockchain, verifies the integrity of the data through a smart contract, and then sends the encrypted data to the user.
[0107] Step 8: Decrypt;
[0108] Step 8.1: The data user obtains the symmetric key through a secure channel and performs the decryption operation.
[0109] Example 2:
[0110] The computer-readable storage medium of this embodiment stores a computer program that, when executed by a processor, implements the steps of the blockchain-based attribute-based searchable encrypted data sharing method of Embodiment 1.
[0111] The computer-readable storage medium in this embodiment can be an internal storage unit of the terminal, such as the terminal's hard disk or memory; the computer-readable storage medium in this embodiment can also be an external storage device of the terminal, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc. equipped on the terminal; furthermore, the computer-readable storage medium can include both the terminal's internal storage unit and external storage devices.
[0112] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0113] Example 3:
[0114] The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the blockchain-based attribute-based searchable encrypted data sharing method of Embodiment 1.
[0115] In this embodiment, the processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. The memory can include read-only memory and random access memory, and provides instructions and data to the processor. A portion of the memory can also include non-volatile random access memory. For example, the memory can also store device type information.
[0116] Those skilled in the art will understand that the content disclosed in the embodiments can be provided as a method, system, or computer program product. Therefore, this solution can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this solution can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage) containing computer-usable program code.
[0117] This solution is described with reference to flowchart illustrations and / or block diagrams of methods and computer program products according to embodiments of this solution. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0120] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0121] The examples described herein are merely preferred embodiments of the invention and are not intended to limit the concept and scope of the invention. Any modifications and improvements made by those skilled in the art to the technical solutions of the invention without departing from the design concept of the invention should fall within the protection scope of the invention.
Claims
1. A blockchain-based attribute-based searchable encrypted data sharing method, characterized in that, Includes the following steps: S10, System initialization, each data owner Calculate its own public parameters and master key, and aggregate its own public parameters to generate system public parameters; S20. Generate an aggregated private key based on the attribute set of data user DU; step S20 is as follows: S21, Each data owner Use its own master key , calculate It is then sent to a specific data owner, who calculates intermediate parameters. , and The specific calculation formula is as follows: ; ; (1); S22, Based on intermediate parameters Generate the first key parameter for the data user with attribute set U. ; S23, Each data owner Choose a random number ,calculate and Send to a specific data owner, who then calculates intermediate parameters. and ,in Belongs to the integer group ; Let p be the group of integers modulo p; S24. Utilizing intermediate parameters , Calculate the user's second key parameter The third key parameter and the fourth key parameter ,in Belongs to attribute set U, It is a hash function; S25. The data owner generates an aggregated private key based on the above four key parameters. And return it to the data user DU through a secure channel; S30, encrypted data files and keyword index; S40. Construct a secure and searchable index; A secure and searchable index is achieved by using an inverted index structure. The inverted index consists of two parts: a dictionary and an inverted list, and includes several data structures such as lookup tables, search arrays, and linked lists. S50, Generate a search trapdoor; Data user DU encrypts the keyword q of interest based on the received aggregated private key, generates a search trapdoor, and uploads it to the blockchain; S60, Search; Data user DU submits a query trap, the search smart contract will use it to perform a linear search on the secure searchable index, verify whether the access control policy of the search trap matches the ciphertext keyword index, and send all the successfully matched results to the verification smart contract. S70, Verification; The smart contract is verified to check whether the keywords in the encrypted keyword index are the same as the query keywords in the trapdoor. If the match is successful, the identifier of the corresponding file is sent to the cloud server, and the integrity of the cloud return results is verified at the same time. S80, Decryption; Data user DU uses a symmetric key for decryption.
2. The method according to claim 1, characterized in that, Step S10 is as follows: S11. Define a bilinear mapping. And select a symmetric cryptography algorithm Two hash functions , ,in, It is a bilinear mapping. and They are two multiplicative cyclic groups. It is a symmetric encryption algorithm. It is a symmetric decryption algorithm. Let p be the group of integers modulo p; S12, Each data owner Select two random numbers and ,calculate and And send it to other data owners, when each data owner Received all and , , calculate , ,in , Belongs to the integer group , yes generator, prime number It is a multiplication group and The order of; S13, Each data owner , Choose a random number ,calculate Send to each and Generate its own master key For data owners Then Send to and ,and Will Send to and ,and , ,in Belongs to the integer group ; S14. Public System Parameters Meanwhile, the data owner Keep your own master key secret .
3. The method according to claim 2, characterized in that, The specific steps of step S30 are as follows: S31, Data Owner choose As a symmetric key, using For data files Encryption is performed to obtain the encrypted data file. ,in It is a symmetric encryption algorithm; S32. The data owner uploads the encrypted data file to the cloud server, uploads the ciphertext hash to the blockchain, and the cloud server returns the storage address to the data owner. S33. The data owner extracts the index key w from the data file F and defines an access policy. Encrypt the keyword w, where It is a matrix with l rows and n columns. The inner mapping function is a matrix. each line To attribute The mapping, each attribute in the matrix Each row in the array corresponds to a unique row. S34. The data owner selects a random number. and n-1 random values , forming a random vector For matrix each line , ,calculate ,in The secret value to be shared belongs to the integer group. , For matrix The ; S35, Data Owner Use Encrypt the key w, and calculate the first key index parameter. The second keyword index parameter and the third keyword index parameter ,in It is a bilinear mapping. yes generator, Belongs to the integer group , For hash functions, For secret value, belong , It is an inner mapping function; S36. The data owner generates a ciphertext keyword index using the aforementioned keyword index parameters. Uploaded to the blockchain.
4. The method according to claim 3, characterized in that, Step S40 is as follows: S41. Initialization: Scan the data file and build a dictionary. For each keyword w , build ,in To scan the set of all keywords in the data file, This is the set of all data file identifiers mapped to the keyword w; S42. Construct a lookup table that allows access to each linked list. The first element is located and decrypted; each entry in the lookup table corresponds to a key w. This entry is by<value,address> The value field contains the index key. and The decryption key for the first element, address represents The storage address of the first element, where To scan the set of all keywords in the data file, a linked list is used. Stored in an array In the middle, there is a set of nodes; S43. Create a search array For each keyword w Define the linked list node structure as follows , ,because Each element contains information about The information of the next element is obtained by decryption, which yields the corresponding file identifier stored in the node and the decryption key and location of the next node, until the node is empty, where " " is a string concatenation operator. The first one corresponding to the keyword w Data files File identifier, For the first The decryption key for each keyword node. For the first The address information of each key node in the table. This indicates the total number of all data file identifiers mapped by the keyword w.
5. The method according to claim 4, characterized in that, Step S50 is as follows: S51, the data user uses the received aggregated private key. Choose a random number Calculate intermediate parameters , , ,in Belongs to the integer group U represents the attribute set of the data user; S52, Data User Computation And encrypt its hash value into the first search trapdoor parameter. The second search trapdoor parameter and the third search trapdoor parameter Where q is the keyword that the data user wants to query. , , , group of integers Random numbers on the screen It is a multiplication cyclic group Generators, any Belongs to attribute set U; S53. The data user calculates the search trapdoor based on the above search trapdoor parameters. And send it to the blockchain.
6. The method according to claim 5, characterized in that, Step S60 is as follows: S61. When a data user submits a query trapdoor, the search smart contract in the blockchain will use the query trapdoor to perform a linear search on the secure searchable index. The attribute set U in the data does not satisfy the condition of the data set U. Related If the key is found, it will be matched with the next keyword index ciphertext; S62, if The attribute set in the middle satisfies and Related If a match is found, all successful matches will be sent to the verification smart contract.
7. The method according to claim 6, characterized in that, Step S70 is as follows: S71, Define a The subset of is ,based on and The search algorithm calculates a set of constants. , making ,in If U is the i-th row of the LSSS matrix, and U satisfies the condition that... Related Then, according to the matching rules, it checks whether the keywords q and w match. The matching rules are as follows: ; S72. If a match is successful, generate the decryption key for the first node in the linked list corresponding to the keyword queried in the decryption lookup table. Since... Each element contains information about The information of the next element is obtained by decryption, which can obtain the corresponding file identifier stored in the node, the decryption key of the next node, and the location, until the node is empty. The corresponding set of found file identifiers is then sent to the cloud server. S73: The cloud server sends the encrypted file set to the blockchain, verifies the integrity of the data through a smart contract, and then sends the encrypted data to the user.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, it implements the steps in the blockchain-based attribute-based searchable encrypted data sharing method as described in any one of claims 1 to 7.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the blockchain-based attribute-based searchable encrypted data sharing method as described in any one of claims 1 to 7.