A blockchain-based attribute searchable encryption system and method
By introducing blockchain and IPFS modules into the EHRs sharing system, decentralized key management and distributed storage are realized, which solves the problems of single point of failure and privacy leakage in the traditional CP-ABSE solution and improves data storage and sharing. security and trustworthiness, providing fast access control.
Patent Information
- Application Number
- CN202310499781.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-05
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2043-05-05
AI Technical Summary
The traditional attribute-based searchable encryption (CP-ABSE) solution has problems such as single point of failure, key leakage, untrustworthy cloud platform and privacy leakage caused by centralized storage in the EHRs sharing system, making it difficult to achieve efficient and secure data storage and shared.
Adopting a blockchain-based attribute searchable encryption system, through the combination of EHRs owner module, visitor module, blockchain module and IPFS module, decentralized key management, smart contract triggering and distributed storage are achieved to ensure Data access control and search process transparency and security.
It effectively solves the problem of single point of failure and key leakage, enhances the security and credibility of search results, provides a fast and secure access control solution, and ensures efficient and safe storage and sharing of EHRs.
Smart Images

Figure CN116450746B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a blockchain-based attribute searchable encryption system and method. Background Art
[0002] Searchable encryption provides an effective mechanism for secure search of encrypted data. However, most existing searchable schemes grant data accessors unlimited search capabilities without considering their search permissions. In practical applications, granting search permissions to data accessors is a very important measure to implement data access control.
[0003] The attribute-based searchable encryption (CP-ABSE) scheme allows data owners to perform fine-grained search authorization and access control on data accessors. The data owner encrypts the index keywords according to the specified access policy, and the encrypted index keywords can be searched only if the attributes of the data accessor meet the access policy. In recent years, CP-ABSE has attracted widespread attention due to its advantages such as one-to-many encrypted data sharing, fine-grained access control, and ciphertext searchability.
[0004] However, the EHRs sharing system based on CP-ABSE still faces some challenges: ① The implementation of the traditional CP-ASBE solution is highly dependent on the authorization center, which is prone to single point failure, key leakage and other problems. ② The traditional CP-ABSE search function is executed by the cloud platform, resulting in unreliable results and even returning wrong search results. ③ The cloud server is responsible for the centralized storage of EHRs files, which is prone to single point failure, privacy leakage and other problems. ④ EHRs users often have only limited device resources and find it difficult to cope with complex computing tasks.
[0005] Blockchain has the advantages of decentralization, immutability, and traceability, and can ensure the transparency of operations and the integrity of data by recording all access requests and operations. Therefore, combining blockchain and CP-ABSE is a feasible path to achieve efficient and secure storage and sharing of EHRs. Summary of the invention
[0006] In order to solve the above technical problems, the present invention proposes a blockchain-based attribute searchable encryption system and method, which can effectively solve the problems of single point failure, key leakage, etc. caused by the traditional CP-ABSE solution that is highly dependent on a single trusted authorization center.
[0007] To achieve the above objectives, the present invention provides a blockchain-based attribute searchable encryption system, comprising:
[0008] EHRs owner module: responsible for file construction, encryption and uploading;
[0009] EHRs visitor module: used to generate search tokens matching keywords, download ciphertext and decrypt said ciphertext;
[0010] Blockchain module: used to generate keys, verify transaction information, and execute smart contracts;
[0011] IPFS module: used for distributed storage of EHRs encrypted files;
[0012] The EHRs owner module is connected to the blockchain module, the EHRs visitor module is bidirectionally connected to the blockchain module and the IPFS module respectively, and the IPFS module is bidirectionally connected to the EHRs owner module.
[0013] Preferably, the EHRs owner module includes:
[0014] Keyword set unit: used to construct EHRs file M = {m0,m1,…,m l-1 The corresponding keyword set W = {w0,w1,…,w l-1};
[0015] Access structure generation unit: used to formulate an access control policy for the file set M, and generate a corresponding ADD access structure according to the access control policy;
[0016] Ciphertext generation unit: used to use the symmetric key set K = {k0, k1, ..., k l-1} Encrypt the file set M to generate a ciphertext set The CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, and generates ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, For I w The common parameters in (σ i ,σ' i )(0≤i≤l-1) respectively correspond to l keywords; based on the CP-ABSE algorithm of the ADD access structure, according to the effective path R t Encrypt the secret value s and generate ciphertext components respectively and Finally, the ciphertext Store it on IPFS and get the Hash corresponding to the ciphertext CT storage value;
[0017] Upload storage transaction unit: used to upload the Hashstorage Value and Keyword Index I w Packaging, generating storage transaction TX storage , and upload it to the blockchain module.
[0018] Preferably, the EHRs visitor module includes:
[0019] Key acquisition unit: used to upload the attribute set S to the blockchain module and obtain the decryption key SK constructed by the blockchain module;
[0020] Upload search transaction unit: used to determine the search keyword w according to the file usage requirements, and generate a search token T using the decryption key SK and the search keyword w w , and according to the search token T w , generate the corresponding search transaction TX search , uploaded to the blockchain module, and obtained the Hash of the ciphertext when it is recognized as having data access rights search value;
[0021] Decryption unit: according to the Hash search The corresponding ciphertext is obtained from IPFS, and the decryption of the symmetric key and ciphertext data is gradually completed.
[0022] Preferably, the blockchain module includes:
[0023] System initialization unit: used to initialize system parameters, generate system public key and user decryption key;
[0024] Transaction verification and execution unit: used to store transaction TX storage and search transaction TX search Verification and execution of
[0025] Keyword search unit: used to use the search token of the EHRs owner to match the keyword index on the blockchain. If the match is successful, the storage address Hash of the ciphertext corresponding to the keyword is obtained. storage , and sent to the EHRs visitor module.
[0026] Preferably, the IPFS module includes:
[0027] Data upload unit: used to receive EHRs encrypted files uploaded by EHRs owners and generate corresponding Hash storage value;
[0028] Data download unit: used to download data based on the Hash provided by EHRs visitors search The value returned is the EHRs file in ciphertext form.
[0029] In order to achieve the above object, the present invention also provides a property searchable encryption method based on blockchain, comprising:
[0030] Initialize system parameters based on the blockchain module, generate system master key MK and system public key PK, and generate user public key PK for EHRs owner module and EHRs visitor module user and signature key SK user ;
[0031] Through the EHRs owner module construction and EHRs file M = {m0,m1,…,m l-1 The corresponding keyword set W = {w0,w1,…,w l-1}; formulate an access control policy for the file set M, and generate a corresponding ADD access structure according to the access control policy; use the symmetric key set K to encrypt the file set M to generate a ciphertext set The CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, and generates ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, For I w The common parameters in (σ i ,σ' i )(0≤i≤l-1) corresponds to l keywords respectively;
[0032] Based on the CP-ABSE algorithm of the ADD access structure, according to the effective path R t Encrypt the secret value s and generate ciphertext components respectively and Finally, the ciphertext Store it on IPFS and get the Hash corresponding to the ciphertext CT storage value; the Hash storage The value is the same as the keyword index I w Packaging, generating storage transaction TX storage , and upload it to the blockchain module; the blockchain module completes the storage transaction TX storage Perform verification, and after successful verification, store it;
[0033] The EHRs visitor module uploads the attribute set S to the blockchain module and obtains the decryption key SK constructed by the blockchain module; the EHRs visitor module determines the search keyword w according to the file usage requirements, and generates a search token T using the decryption key SK and the search keyword w. w; According to the search token T w , generate the corresponding search transaction TX search , and upload it to the blockchain module;
[0034] The blockchain module searches for the transaction TX search Verify, and after successful verification, trigger the smart contract to search for matching keyword indexes. If the keyword index and the search token T w If the match is successful, the corresponding ciphertext storage address Hash is returned search to the EHRs visitor module;
[0035] The EHRs visitor module stores the encrypted address Hash search Get the EHRs ciphertext stored on the IPFS module;
[0036] The IPFS module returns the found ciphertext to the EHRs visitor module;
[0037] After receiving the corresponding ciphertext, the EHRs visitor module decrypts it to obtain the symmetric key, and further decrypts it to obtain the EHRs file in plain text.
[0038] Preferably, the blockchain-based module initializes system parameters and generates user public keys PK for the EHRs owner module and the EHRs visitor module. user and signature key SK user ,include:
[0039] The blockchain master node determines the bilinear mapping parameters (G,G T ,e,p,g), and broadcast it to other nodes;
[0040] Blockchain Node BN θ Randomly select a cyclic group Z based on the set of attributes managed p The element t' θ,1 ,t' θ,2 ,...,t' θ,j ,t” θ,1 ,t” θ,2 ,...,t” θ,j , and randomly select (a θ ,b θ ,c θ ,α θ )∈Z p , generate node master key MK θ = θ ,b θ ,c θ ,α θ > and node public key And broadcast to other blockchain nodes;
[0041] The blockchain master node selects the hash function H0:{0,1} * →Z p * , using the Pedersen(k,n) secret sharing protocol to share the node master key MK θ (0≤θ≤N-1) is reconstructed into the system master key MK=<a,b,c,α> , and calculate the system public key PK = <g,g a ,g b ,g c ,π α >, where π = e(g,g);
[0042] The blockchain master node generates the user public key PK for the EHRs owner module DO and user signature key SK DO , Generate user public key PK for EHRs visitor module DU and user signature key SK DU .
[0043] Preferably, the CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, including:
[0044] The EHRs owner uses the symmetric key set K to encrypt the file set M to generate a ciphertext set
[0045] The CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, and generates ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, which are I w The common parameters in (σ i ,σ i ') correspond to l keywords respectively; CP-ABSE algorithm based on the ADD access structure, according to the effective path R t (The set is denoted as R) Encrypt the secret value s and generate ciphertext components respectively and
[0046] The final generated ciphertext
[0047] Preferably, obtaining the decryption key SK constructed by the blockchain module comprises:
[0048] Blockchain Node BNθ (0≤θ≤N-1)Set tsk θ = 0, the managed system attribute att θ ={att θ,1 ,att θ,2 ,…,att θ,j} is matched with the user attribute set S:
[0049] For att θ Any attribute att in θ,m (1≤m≤j), if att θ,m ∈S, then tsk θ =tsk θ +t' θ,m , otherwise tsk θ =tsk θ +t″ θ,m ;
[0050] After the attribute matching is completed, the blockchain node BN θ (0≤θ≤N-1) tsk θ Send to the blockchain master node;
[0051] The blockchain master node structure And randomly select an element r∈Z p , complete the following calculations:
[0052]
[0053] D = g r / tsk
[0054]
[0055] Finally, generate the decryption key for EHRs accessors
[0056] Preferably, obtaining the EHRs file in plain text includes:
[0057] The EHRs visitor decrypts the ciphertext CT using the decryption key SK; if the attribute S of the EHRs visitor satisfies the ADD access structure, according to the valid path R that is satisfied t and its terminal node value y i , complete the calculation according to the following formula:
[0058]
[0059]
[0060]
[0061] in, Indicates the use of k i Complete symmetric decryption;
[0062] Finally, the EHRs visitor decrypts and obtains the EHRs file in plain text.
[0063] Compared with the prior art, the present invention has the following advantages and technical effects:
[0064] (1) The present invention utilizes the decentralized characteristics of blockchain and uses it as a trusted authorization center to generate a public key PK and a master key MK for the system, generates a user public key and a user signature key for the user (EHRs owner or EHRs visitor), and generates a decryption key for the EHRs visitor, thereby solving the problems of single point failure and key leakage caused by the traditional CP-ABSE solution that is highly dependent on a single trusted authorization center.
[0065] (2) The present invention proposes a keyword-searchable encryption mechanism based on blockchain, in which smart contracts can be automatically triggered according to user needs, perform keyword searches and return the storage address of ciphertext. The automatic triggering and execution of smart contracts and the irreversibility of search results recorded on the blockchain enhance the security, reliability and correctness of the search process and results.
[0066] (3) The CP-ABSE access control scheme based on the ADD access structure designed in the present invention has the function of quickly decrypting files and is a safe, novel and efficient access control scheme. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0068] Figure 1 The following is a flowchart of a Fabric transaction according to an embodiment of the present invention;
[0069] Figure 2 A module connection diagram of a blockchain-based attribute searchable encryption system according to an embodiment of the present invention;
[0070] Figure 3 This is a system model diagram of a blockchain-based attribute searchable encryption system according to an embodiment of the present invention;
[0071] Figure 4 This is a workflow diagram of the blockchain-based attribute searchable encryption method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0072] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0073] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0074] Theoretical basic knowledge related to the present invention
[0075] (1) Fabric consortium chain transaction process (such as Figure 1 ),in:
[0076] The typical transaction process of Hyperledger Fabric is as follows:
[0077] ① The client uses the application programming interface (API) provided by the supported SDK (Go, Java) to construct a transaction submission proposal. The transaction proposal mainly includes the following elements:
[0078] channelID: channel information.
[0079] chaincodeID: chaincode information to be called.
[0080] timestamp: timestamp.
[0081] sign: client signature.
[0082] txPayload: The content of the submitted transaction itself, including two items.
[0083] operation: The smart contract method to be called and the corresponding parameters.
[0084] metadata: call related attributes
[0085] ②The endorsing node verifies the received transaction proposal request.
[0086] Whether the transaction proposal format is correct.
[0087] The transaction has not been submitted before.
[0088] Whether the client signature submitting the transaction proposal is valid.
[0089] Whether the requester who submitted the transaction proposal has the corresponding execution permission in the channel.
[0090] ③After the above requirements are met, the endorsement node takes the "transaction proposal" as the input parameter and calls the function in the chaincode. If the chaincode is successfully executed, it returns the information value, which includes the return value. At this time, the data in the blockchain ledger is not really changed. Endorses the "transaction result" and responds to the client.
[0091] ④ After the application collects enough messages and endorsement signatures, it constructs a legitimate transaction request and broadcasts the request to the sorting service node.
[0092] ⑤The sorting node receives transactions from all channels in the network, sorts them in chronological order, and creates transaction blocks.
[0093] ⑥ The sorting node broadcasts the transaction block to the master nodes of all organizations in the same channel.
[0094] ⑦ The master node verifies the received blocks (whether the transaction message structure is correct, whether it is repeated, whether there are sufficient endorsements, and the read-write set version), and writes the results into the local ledger after verification.
[0095] ⑧Synchronize blocks: The master node broadcasts synchronously to other nodes in the organization (ensuring that they are in the same channel). The default number of nodes broadcasted to other nodes is 3 adjacent nodes. This broadcast quantity can be modified through configuration. Cross-organization broadcasts are the responsibility of the anchor nodes in the organization.
[0096] ⑨ Update the ledger: After receiving the block, the anchor node will verify each transaction in the block, check whether the input and output that the transaction depends on are consistent with the current state of the blockchain, and verify whether the endorsement policy is satisfied. After the verification is completed, the block will be appended to the local blockchain, the ledger will be updated, and the world state will be modified.
[0097] (2) CP-ABSE algorithm
[0098] The CP-ABSE algorithm combines the CP-ABE algorithm and the SE algorithm. The EHRs data owner uses a specific access policy to encrypt multi-level files and generates keyword indexes corresponding to the multi-level files. The EHRs data access party generates a corresponding search token, searches for the corresponding ciphertext, and decrypts the ciphertext using a specific private key.
[0099] Setup(1 k ): This algorithm is executed by the blockchain to initialize the entire system and generate the system public key PK and the system master key MK.
[0100] Encrypt(PK θ (0≤θ≤N-1),PK,M,W,K,ADD): This algorithm is executed by the EHRs data owner and uses the symmetric key set K to encrypt the plaintext set M to obtain Encrypt the symmetric key set K to obtain {C i |0≤i≤l-1}, according to the effective path R t (The set is denoted as R) Encrypt the secret value s and generate ciphertext components respectively and Generate ciphertext Encrypt the keyword set W to get the corresponding keyword index set Finally, (CT, I w ) is sent to IPFS for distributed storage.
[0101] KeyGen(PK, MK, S): Executed by the blockchain, the EHRs data accessor inputs his own attribute set S and outputs the data accessor's key SK.
[0102] Trap(PK, SK, S, w): This algorithm is executed by the EHRs data accessor, and the EHRs provides the corresponding search keyword w to generate the corresponding search token T w , and finally the EHRs data accessor will search for the token T w and attribute set S are sent to the smart contract for keyword matching.
[0103] Search(T w ,TX search ,S): This algorithm is executed by the blockchain, input search token T w And attribute set S, trigger the smart contract to perform keyword search and return the hash address of the corresponding ciphertext stored in IPFS.
[0104] Decrypt(PK,SK,S,CT): This algorithm is executed by the EHRs data accessor, using his own private key SK to decrypt the corresponding ciphertext C i To decrypt, first obtain the corresponding symmetric key K, and then use the key to decrypt the ciphertext Decryption is performed to generate the EHRs plaintext file M.
[0105] (2) Pedersen (k, n) Secret Sharing Protocol
[0106] The Pedersen (k, n) secret sharing protocol does not require an authorized center. Assume that there are n participants P = {P1, P2, ..., P n}, in this protocol, no central processor is required, each participant P θ Share your secret value S with other participants θ A secret S shared by a group of participants is a θ (For example, all S θ The protocol consists of the following methods.
[0107] Master secret generation: Each participant P θ Choose a secret value S θ , the main secret
[0108] Sub-secret sharing value generation: This contains n Shamir secret sharing algorithms. Each participant P θ We can choose a polynomial f of degree k-1 θ (x) etc. θ =f θ (0). Participant P θ Calculate and send slave shared values To other participants P i .
[0109] Master secret shared value generation: receiving n sub-secret values P θ Calculate the master secret
[0110] Master Secret Reconstruction: Assumptions At least k parties work together to reconstruct the master secret value Where L θ According to the Lagrange interpolation formula:
[0111]
[0112] Figure 2 The module connection diagram of the blockchain-based attribute searchable encryption system includes four different modules: blockchain module, IPFS module, EHRs owner module, and EHRs visitor module. Figure 3 System model diagram for blockchain-based attribute searchable encryption system. Figure 4 Workflow diagram for blockchain-based attribute searchable encryption method.
[0113] Generate ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, For I w The common parameters in (σ i ,σ' i ) correspond to l keywords respectively; based on the CP-ABSE algorithm of the ADD access structure, according to the effective path R t (The set is denoted by R) to encrypt the secret value s.
[0114] (1) EHRs owner module. The EHRs owner is responsible for file construction and encrypted upload.
[0115] Specifically include: ① Divide the generated EHRs into l different categories of files M = {m0, m1, ..., m l-1}, and construct the corresponding keyword set W = {w0, w1, ..., w l-1};②Construct the symmetric key set K = {k0, k1, ..., k l-1}, and complete the encryption of M; ③ formulate multiple access control policies for M, and generate corresponding ADD access structures according to the policies; ④ use the ADD access structure to encrypt the symmetric key set K and the keyword set W based on the CP-ABSE algorithm newly proposed by the present invention, and generate the corresponding ciphertext {C i |0≤i≤l-1} and ⑤According to the effective path R t (The set is denoted as R) Encrypt the secret value s and generate ciphertext components respectively and {C Rt |R t ∈R}; ⑥ The ciphertext > Store on IPFS and obtain the Hash corresponding to each ciphertext storage ⑦Hash storage Value and I w Packaging and storing transaction TX through blockchain storage The winding operation is completed.
[0116] (2) EHRs visitor module. EHRs visitor is responsible for data retrieval and decryption.
[0117] Specifically, it includes: ① Upload the attribute set S to the blockchain and obtain the decryption key SK constructed by the blockchain; ② Determine the search keyword w according to the file usage requirements, and further use SK and w to generate the search token T w ③According to T w Generate the corresponding search transaction TX search , and upload it to the blockchain; ④ When the search transaction is verified by the node, the search smart contract is triggered, and the EHRs visitor is recognized as having data usage rights, the EHRs visitor will obtain the Hash of the ciphertext corresponding to the search keyword w search Value; ⑤According to Hash search The corresponding ciphertext is obtained from IPFS, and the decryption of the symmetric key and EHRs data is gradually completed.
[0118] (3) Blockchain module: Mainly responsible for key generation, smart contract execution, transaction storage, etc.
[0119] Specifically include: ① Initialize system parameters, generate system public key and user decryption key; ② Blockchain storage transaction TX storageVerification and execution; ③ Blockchain search transaction TX search verification and execution.
[0120] (4) IPFS module: IPFS is responsible for the distributed storage of EHRs files.
[0121] Specifically include: ① Receive files uploaded by EHRs owners and construct Hash storage Value; ② Based on the Hash provided by the EHRs visitor search The value returned is the EHRs file in ciphertext form.
[0122] from Figure 2 It can be seen that the workflow of EHRs data encryption and sharing can be divided into the following steps:
[0123] ① The blockchain initializes system parameters, generates the system master key MK and system public key PK, and generates user public keys and signature keys for EHRs owners and EHRs visitors.
[0124] ② The EHRs owner specifies the access control policy for the EHRs data of type l and generates the corresponding ADD structure; p Select the corresponding symmetric key set K = {k0, k1, ..., k l-1}, and encrypt l EHRs files M={m0,m1,…,m l-1}Get multi-file ciphertext collection Using the ADD access structure, the key set K = {k0, k1, ..., k l-1} and keyword set W = {w0,w1,…,w l-1}, generating the ciphertext {C i |0≤i≤l-1} and keyword index
[0125] ③EHRs owners will encrypt Distributed storage on IPFS, obtain the Hash generated by IPFS storage .
[0126] ④EHRs owners will Hash storage and keyword index I w Packaged into storage transaction TX storage , and written into the blockchain.
[0127] ⑤The EHRs accessor sends the attribute set S to the blockchain and requests the decryption key.
[0128] ⑥ The blockchain node generates a decryption key SK for EHRs visitors with the help of the secret sharing protocol Pedersen(k,n).
[0129] ⑦ EHRs visitor uses the decryption key SK to generate a search token T w .
[0130] ⑧EHRs visitor constructs search transaction TX search , and upload it to the blockchain.
[0131] ⑨Search for transaction TX search After successful verification, the smart contract will be triggered to search for the matching keyword index. If the index and the trapdoor match successfully, the corresponding ciphertext storage address Hash will be returned. search To EHRs visitors.
[0132] ⑩EHRs visitors based on Hash search Get the ciphertext of EHRs stored on IPFS.
[0133] IPFS returns the found ciphertext to the EHRs visitor.
[0134] After receiving the corresponding ciphertext, the EHRs visitor decrypts it to obtain the symmetric key, and further decrypts it to obtain the EHRs file in plain text.
[0135] Specific algorithm:
[0136] Setup(1 k ): The algorithm is executed by the blockchain and mainly includes two steps: 1) Blockchain node BN θ (0≤θ≤N-1) constructs and manages the attribute set att θ (0≤θ≤N-1) related master key MK θ (0≤θ≤N-1), 2) The master node constructs the system public key PK and master key MK. The specific process is as follows:
[0137] ① The blockchain master node determines the bilinear mapping parameters (G,G T ,e,p,g) and broadcast it to other nodes.
[0138] ②Blockchain Node BN θ (0≤θ≤N-1) According to the attribute set managed attθ={attθ ,1 ,attθ ,2 ,…,attθ ,j}(For θ≠θ', ) Randomly select cyclic group Z p The element t' θ,1 ,t' θ,2 ,...,t' θ,j ,t” θ,1,t” θ,2 ,...,t” θ,j ; and randomly select (a θ ,b θ ,c θ ,α θ )∈Z p , generate the master key MK θ = θ ,b θ ,c θ ,α θ >, public key And broadcast it to other nodes.
[0139] ③The blockchain master node selects two hash functions H0:{0,1} * →Z p * , use the Pedersen(k,n) protocol to convert MK θ (0≤θ≤N-1) reconstructed as the main key MK=<a,b,c,α> , and calculate the corresponding public key PK = <g,g a ,g b ,g c ,π α >, where π=e(g,g).
[0140] ④The blockchain master node generates a user public key PK for the EHRs owner DO and signature key SK DO , Generate user public key PK for EHRs accessor DU and signature key SK DU , and sent to EHRs owners and EHRs visitors together with the system public key PK.
[0141] KeyGen(PK,MK,S): This algorithm is run by blockchain nodes to generate decryption keys for users.
[0142] ①BN θ (0≤θ≤N-1) According to the managed attribute set att θ ={att θ,1 ,att θ,2 ,…,att θ,j}. Blockchain Node BN θ (0≤θ≤N-1) define tsk θ = 0, the managed system attribute att θ ={att θ,1 ,att θ,2 ,…,att θ,j}Match with user attribute set S: for att θ Any attribute att inθ,m (1≤m≤j), if att θ,m ∈S, then tsk θ =tsk θ +t' θ,m , otherwise tsk θ =tsk θ +t' θ ' ,m ; After all attributes in S are matched, BN θ (0≤θ≤N-1) tsk θ Sent to the blockchain master node.
[0143] ②Blockchain master node structure And randomly select an element r∈Z p , complete the following calculations:
[0144]
[0145] D = g r / tsk (2)
[0146]
[0147] Finally, generate the decryption key for EHRs accessors
[0148] Encrypt(PK θ (0≤θ≤N-1),PK,W,M,K,ADD): This algorithm is mainly executed by the EHRs owner to complete the EHRs encryption. Assume that the set of files that the EHRs owner intends to share is M = {m0,m1,…,m l-1}, the encryption algorithm is specifically divided into the following steps:
[0149] ① The owner of EHRs determines the l-1}The corresponding symmetric key set K={k0,k1,…,k l-1}, complete the file encryption based on symmetric key.
[0150]
[0151] ② EHRs owners from the circulation group Z p Randomly select v0,v1,…,v l-1 , generates a pseudo-Boolean function based on the access control policy of each file And construct the ADD access structure to get ADD contains T valid paths R={R0,R1,…,R T-1}, for path R t, all the attributes contained in it are recorded as I t In addition, the values of the l non-zero terminal nodes are Y = {y i |0≤i≤l-1}. EHRs owners randomly select s∈Z p ,calculate
[0152]
[0153]
[0154]
[0155] Among them, T var From PK θ (0≤θ≤N-1), when var∈att θ (0≤θ≤N-1) and the value is positive, That is, var =t' θ,var ; when var∈att θ (0≤θ≤N-1) and the value is negative, That is t var =t" θ,var .
[0156] ③ The EHRs owner selects a keyword set W corresponding to l files = {w0,w1,…,w l-1}, randomly select μ∈Z p ,calculate
[0157]
[0158]
[0159]
[0160] ⑤ EHRs owners will encrypt Store in IPFS and get the Hash returned by IPFS storage . Further generate storage transactions and set the encrypted index set Sent to the blockchain, as shown in Table 1, where H is the hash function, SK DO is the signature private key, and Sign is the signature function. The blockchain node executes the transaction verification algorithm as shown in Table 2, where PK DO To verify the public key, Verify is the verification function.
[0161] Table 1
[0162]
[0163] Table 2
[0164]
[0165] Trap(PK,SK,w): This algorithm is mainly executed by EHRs visitors. When EHRs visitors want to access specific data containing keyword w, a searchable transaction TX containing keyword w is generated. search and search token T w TX search 、T w , the attribute set S is submitted to the blockchain, as shown in Table 3.
[0166] Table 3
[0167]
[0168] Search(T w ,TX search ,S) receives the searchable transaction TX submitted by the user search After that, the blockchain triggers the search contract, as shown in Table 4. If the search is successful, the Hash search To EHRs owners, so that they can get the same hash as IPFS search The mapped ciphertext.
[0169] Table 4
[0170]
[0171] Table 5
[0172]
[0173] Among them, Table 5 is the algorithm 7 called in Table 4, and Table 6 is the specific meaning of each symbol in the embodiment of the present invention.
[0174] Decrypt(PK,SK,S,CT): The EHRs visitor uses its key SK to decrypt the ciphertext CT. If the attribute S of the EHRs visitor satisfies the ADD access structure, according to the valid path R that satisfies t and its terminal node value y i , by completing the calculation according to the following formulas (11)-(13), we can obtain EHRs in plain text.
[0175]
[0176]
[0177]
[0178] Table 6
[0179]
[0180] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A blockchain-based attribute searchable encryption system, characterized in that: include: EHRs owner module: responsible for file construction, encryption and uploading; EHRs visitor module: used to generate search tokens matching keywords, download ciphertext and decrypt said ciphertext; Blockchain module: used to generate keys, verify transaction information, and execute smart contracts; IPFS module: used for distributed storage of EHRs encrypted files; The EHRs owner module is connected to the blockchain module, the EHRs visitor module is bidirectionally connected to the blockchain module and the IPFS module respectively, and the IPFS module is bidirectionally connected to the EHRs owner module; A blockchain-based attribute searchable encryption method, applied to a blockchain-based attribute searchable encryption system, comprising: Initialize system parameters based on the blockchain module, generate system master key MK and system public key PK, and generate user public key PK for EHRs owner module and EHRs visitor module user and signature key SK user ; Through the EHRs owner module construction and EHRs file M = {m0,m1,…,m l-1 The corresponding keyword set W = {w0,w1,…,w l-1 }; formulate an access control policy for the file set M, and generate a corresponding ADD access structure according to the access control policy; use the symmetric key set K to encrypt the file set M to generate a ciphertext set The CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, and generates ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, For I w The common parameters in (σ i ,σ i ')(0≤i≤l-1) corresponds to l keywords respectively; Based on the CP-ABSE algorithm of the ADD access structure, according to the effective path R t Encrypt the secret value s and generate ciphertext components respectively and Finally, the ciphertext Store it on IPFS and get the Hash corresponding to the ciphertext CT storage value; the Hash storage The value is the same as the keyword index I w Packaging, generating storage transaction TX storage , and upload it to the blockchain module; the blockchain module completes the storage transaction TX storage Perform verification, and after successful verification, store it; The EHRs visitor module uploads the attribute set S to the blockchain module and obtains the decryption key SK constructed by the blockchain module; the EHRs visitor module determines the search keyword w according to the file usage requirements, and generates a search token T using the decryption key SK and the search keyword w. w ; According to the search token T w , generate the corresponding search transaction TX search , and upload it to the blockchain module; The blockchain module searches for the transaction TX search Verify, and after successful verification, trigger the smart contract to search for matching keyword indexes. If the keyword index and the search token T w If the match is successful, the corresponding ciphertext storage address Hash is returned search to the EHRs visitor module; The EHRs visitor module stores the encrypted address Hash search Get the EHRs ciphertext stored on the IPFS module; The IPFS module returns the found ciphertext to the EHRs visitor module; After receiving the corresponding ciphertext, the EHRs visitor module decrypts it to obtain the symmetric key, and further decrypts it to obtain the EHRs file in plain text; The blockchain-based module initializes system parameters and generates user public keys PK for the EHRs owner module and the EHRs visitor module user and signature key SK user ,include: The blockchain master node determines the bilinear mapping parameters (G,G T ,e,p,g), and broadcast it to other nodes; Blockchain Node BN θ Randomly select a cyclic group Z based on the set of attributes managed p """""' Element t θ,1 ,t θ,2 ,...,t θ,j ,t θ,1 ,t θ,2 ,...,t θ,j , and randomly select (a θ ,b θ ,c θ ,α θ )∈Z p , generate node master key MK θ = θ ,b θ ,c θ ,α θ > and node public key And broadcast to other blockchain nodes; The blockchain master node selects the hash function H0:{0,1} * →Z p * , using the Pedersen(k,n) secret sharing protocol to share the node master key MK θ (0≤θ≤N-1) is reconstructed into the system master key MK=<a,b,c,α> , and calculate the system public key PK = <g,g a ,g b ,g c ,π α >, where π = e(g,g); The blockchain master node generates the user public key PK for the EHRs owner module DO and user signature key SK DO , Generate user public key PK for EHRs visitor module DU and user signature key SK DU .
2. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: The EHRs owner module includes: Keyword set unit: used to construct EHRs file M = {m0,m1,…,m l-1 The corresponding keyword set W = {w0,w1,…,w l-1 }; Access structure generation unit: used to formulate an access control policy for the file set M, and generate a corresponding ADD access structure according to the access control policy; Ciphertext generation unit: used to use the symmetric key set K = {k0, k1, ..., k l-1 } Encrypt the file set M to generate a ciphertext set The CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, and generates ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, For I w The common parameters in (σ i ,σ i ')(0≤i≤l-1) respectively correspond to l keywords; based on the CP-ABSE algorithm of the ADD access structure, according to the effective path R t Encrypt the secret value s and generate ciphertext components respectively and {C Rt |R t ∈R}; finally, the ciphertext Store it on IPFS and get the Hash corresponding to the ciphertext CT storage value; Upload storage transaction unit: used to upload the Hash storage Value and Keyword Index I w Packaging, generating storage transaction TX storage , and uploaded to the blockchain module.
3. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: The EHRs visitor module includes: Key acquisition unit: used to upload the attribute set S to the blockchain module and obtain the decryption key SK constructed by the blockchain module; Upload search transaction unit: used to determine the search keyword w according to the file usage requirements, and generate a search token T using the decryption key SK and the search keyword w w , and according to the search token T w , generate the corresponding search transaction TX search , uploaded to the blockchain module, and obtained the Hash of the ciphertext when it is recognized as having data access rights search value; Decryption unit: according to the Hash search The corresponding ciphertext is obtained from IPFS, and the decryption of the symmetric key and ciphertext data is gradually completed.
4. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: The blockchain module includes: System initialization unit: used to initialize system parameters, generate system public key and user decryption key; Transaction verification and execution unit: used to store transaction TX storage and search transaction TX search Verification and execution of Keyword search unit: used to use the search token of the EHRs owner to match the keyword index on the blockchain. If the match is successful, the storage address Hash of the ciphertext corresponding to the keyword is obtained. storage , and sent to the EHRs visitor module.
5. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: The IPFS module includes: Data upload unit: used to receive EHRs encrypted files uploaded by EHRs owners and generate corresponding Hash storage value; Data download unit: used to download data based on the Hash provided by EHRs visitors search The value returned is the EHRs file in ciphertext form.
6. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: The CP-ABSE algorithm based on the ADD access structure completes encryption of the symmetric key set K and the keyword set W, including: The EHRs owner uses the symmetric key set K to encrypt the file set M to generate a ciphertext set The CP-ABSE algorithm based on the ADD access structure completes the encryption of the symmetric key set K and the keyword set W, and generates ciphertext {C i |0≤i≤l-1} and Among them C i (0≤i≤l-1) corresponds to l symmetric keys respectively, For I w The common parameters in (σ i ,σ i ') correspond to l keywords respectively; CP-ABSE algorithm based on the ADD access structure, according to the effective path R t Encrypt the secret value s, the effective path R t The set is denoted as R, and the ciphertext components are generated respectively and The final generated ciphertext 7. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: Obtaining a decryption key SK constructed by the blockchain module, including: Blockchain Node BN θ (0≤θ≤N-1)Set tsk θ = 0, the managed system attribute att θ ={att θ,1 ,att θ,2 ,…,att θ,j } is matched with the user attribute set S: For att θ Any attribute att in θ,m (1≤m≤j), if att θ,m ∈S, then tsk θ =tsk θ +t' θ,m , otherwise tsk θ =tsk θ +t' θ ' ,m ; After the attribute matching is completed, the blockchain node BN θ (0≤θ≤N-1) tsk θ Send to the blockchain master node; The blockchain master node structure And randomly select an element r∈Z p , complete the following calculations: D=g r / tsk Finally, generate the decryption key for EHRs accessors 8. The blockchain-based attribute searchable encryption system according to claim 1, characterized in that: The obtaining of the EHRs file in plain text includes: The EHRs visitor decrypts the ciphertext CT using the decryption key SK; if the attribute S of the EHRs visitor satisfies the ADD access structure, according to the valid path R that is satisfied t and its terminal node value y i , complete the calculation according to the following formula: in, Indicates the use of k i Complete symmetric decryption; Finally, the EHRs visitor decrypts and obtains the EHRs file in plain text.
