A Blockchain Data Sharing Method and System Based on Homomorphic Encryption
By using homomorphic encryption technology in the blockchain network to encrypt query keywords and data, the problem of data leakage caused by untrusted third parties is solved, and the security and confidentiality of data sharing are achieved, ensuring that only authorized clients can obtain plaintext data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- STATE GRID XIONGAN FINANCIAL TECH GRP CO LTD
- Filing Date
- 2022-12-19
- Publication Date
- 2026-05-05
AI Technical Summary
In existing technologies, the untrustworthiness of third-party computing service providers makes it impossible to guarantee the security of shared data. Especially in scenarios where confidential data sharing is required, plaintext data processing may lead to the leakage of user information.
Homomorphic encryption technology is used to encrypt query keywords and data through the blockchain network, ensuring that the data exists in ciphertext form throughout the transmission process and is only decrypted into plaintext on the client side. Homomorphic public and private keys are used for data sharing and verification.
It ensures data security and confidentiality during data sharing, guaranteeing that only authorized clients can access plaintext shared data, thereby improving the security and integrity of data transmission.
Smart Images

Figure CN116015597B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and more specifically, to a blockchain data sharing method and system based on homomorphic encryption. Background Technology
[0002] With the development of internet technology, the number of enterprises and users is constantly increasing, and the amount of data is also growing. This massive amount of data brings huge benefits to enterprise profits and research institutions. However, processing big data requires substantial computing resources, resulting in high costs. To address this, many vendors offer high-complexity, relatively low-cost computing services, allowing enterprises and research institutions to directly utilize third-party services when performing large-scale data computations.
[0003] In some scenarios, data confidentiality is crucial. For example, in sharing disease data, patient information needs to be kept confidential; in asset analysis in the financial sector, sensitive customer information needs to be hidden. However, third-party computing service providers are not entirely trustworthy. If plaintext data is processed through these providers, it may lead to the leakage of user information, compromising the security of shared data. Summary of the Invention
[0004] In view of this, embodiments of this application disclose a blockchain data sharing method and system based on homomorphic encryption to improve the security of shared data.
[0005] The technical solutions provided in this application are as follows:
[0006] In a first aspect, embodiments of this application provide a blockchain data sharing method based on homomorphic encryption, the method comprising:
[0007] The client sends the query keywords to the service provider;
[0008] The service provider performs homomorphic encryption on the query keywords to obtain encrypted query keywords, and uses the encrypted query keywords to determine the data filtering results from the homomorphic index table; wherein, the homomorphic index table is provided by the blockchain network, and the homomorphic index table includes: homomorphically encrypted keywords, ciphertext shared data corresponding to the homomorphically encrypted keywords, and the data filtering results include the ciphertext shared data corresponding to the query keywords;
[0009] The service provider sends the data filtering results to the client.
[0010] The client determines the target encrypted sharing data based on the data filtering results and generates a data sharing request.
[0011] The client sends the data sharing request and the client information to be verified to the blockchain network through the service provider.
[0012] The blockchain network determines whether to agree to the data sharing request based on the customer information to be verified.
[0013] When the blockchain network determines that it agrees to the data sharing request, the blockchain network uses a homomorphic public key to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data, thereby obtaining homomorphically encrypted shared data; the homomorphic public key is provided by the certification authority;
[0014] The blockchain network sends the homomorphic encrypted shared data to the client through the service provider.
[0015] The client uses a homomorphic private key to decrypt the homomorphically encrypted shared data to obtain plaintext shared data; the homomorphic private key is provided by the authentication center.
[0016] In one possible implementation, the method further includes:
[0017] The client uses its private key to sign the data sharing request, thus obtaining a signed data sharing request; the client's private key is provided by the authentication center.
[0018] The blockchain network determines whether to agree to the data sharing request based on the customer information to be verified, including:
[0019] The blockchain network uses the client's public key to verify the signed data sharing request; the client's public key is provided by the certification authority.
[0020] If the verification is successful, the blockchain network determines whether there is customer information in the pre-stored customer information that matches the customer information to be verified;
[0021] If the pre-stored customer information contains customer information that matches the customer information to be verified, the blockchain network determines that it agrees to the data sharing request.
[0022] In one possible implementation, the method further includes:
[0023] When the blockchain network determines that it agrees to the data sharing request, the blockchain network sends a message indicating that the sharing has been successfully established to the certification center;
[0024] The authentication center sets the encryption parameters for homomorphic encryption and generates a homomorphic public key and a homomorphic private key;
[0025] The authentication center sends the encryption parameters, the homomorphic public key, and the homomorphic private key to the service provider;
[0026] The service provider sends the encryption parameters and the homomorphic public key to the blockchain network;
[0027] The service provider sends the homomorphic private key to the client.
[0028] In one possible implementation, the message indicating successful establishment of the shared account carries the customer information to be verified, and the method further includes:
[0029] The authentication center determines the corresponding customer public key based on the customer information to be verified, and uses the customer public key to encrypt the homomorphic private key to obtain the encrypted homomorphic private key;
[0030] The client uses its private key to decrypt the encrypted homomorphic private key to obtain the homomorphic private key; the client private key is provided by the authentication center.
[0031] In one possible implementation, the blockchain network uses a homomorphic public key to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data, obtaining homomorphically encrypted shared data, including:
[0032] The blockchain network uses the homomorphic public key and the encryption parameters to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data, thereby obtaining homomorphically encrypted shared data.
[0033] The method further includes:
[0034] The service provider calculates the homomorphic encrypted shared data based on the encryption parameters to obtain the calculated homomorphic encrypted shared data.
[0035] The server sends the calculated homomorphic encrypted shared data to the client.
[0036] The client uses a homomorphic private key to decrypt the homomorphically encrypted shared data to obtain plaintext shared data, including:
[0037] The client uses a homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain plaintext shared data.
[0038] In one possible implementation, the method further includes:
[0039] The blockchain network performs a hash calculation on the homomorphic encrypted shared data to obtain a first hash value, and sends the first hash value to the service provider.
[0040] The service provider performs a hash calculation on the homomorphic encrypted shared data to obtain a second hash value;
[0041] The service provider determines whether the first hash value and the second hash value are consistent;
[0042] If the first hash value and the second hash value are the same, the service provider calculates the homomorphic encrypted shared data according to the encryption parameters to obtain the calculated homomorphic encrypted shared data.
[0043] If the first hash value and the second hash value are inconsistent, the service provider sends a message to the blockchain network to retransmit the data.
[0044] In one possible implementation, the method further includes:
[0045] The service provider performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a third hash value, and sends the third hash value to the client;
[0046] The client performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a fourth hash value;
[0047] The client determines whether the third hash value and the fourth hash value are consistent;
[0048] If the third hash value and the fourth hash value are the same, the client uses the homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain the plaintext shared data.
[0049] If the third hash value and the fourth hash value are inconsistent, the client sends a message to the service provider to retransmit the data.
[0050] In one possible implementation, the method further includes:
[0051] When the data provider generates new plaintext shared data, it extracts keywords from the new plaintext shared data, performs homomorphic encryption on the keywords, and obtains homomorphically encrypted keywords.
[0052] The data provider encrypts the new plaintext shared data to obtain ciphertext shared data.
[0053] The data provider uploads the homomorphically encrypted keywords and the ciphertext shared data to the blockchain network;
[0054] The blockchain network generates a homomorphic index table based on the homomorphically encrypted keywords and the ciphertext shared data.
[0055] In one possible implementation, the method further includes:
[0056] The client sends authentication data to the authentication center; the authentication data includes customer information.
[0057] The certification center reviews the certification data;
[0058] If the audit is successful, the certification center generates a client public key and a client private key, and stores the certification data and the client public key in the certification center.
[0059] The authentication center sends the customer information and the customer public key to the blockchain network through the service provider.
[0060] The authentication center sends the client's private key and a registration success message to the client through the service provider.
[0061] Secondly, embodiments of this application provide a blockchain data sharing system based on homomorphic encryption, the system comprising: a client, a service provider, a blockchain network, and an authentication center;
[0062] The client is used to send query keywords to the service provider;
[0063] The service provider is used to perform homomorphic encryption on the query keywords to obtain encrypted query keywords, and use the encrypted query keywords to determine data filtering results from the homomorphic index table; wherein, the homomorphic index table is provided by the blockchain network, and the homomorphic index table includes: homomorphically encrypted keywords, ciphertext shared data corresponding to the homomorphically encrypted keywords, and the data filtering results include the ciphertext shared data corresponding to the query keywords;
[0064] The service provider is also used to send the data filtering results to the client;
[0065] The client is also used to determine the target encrypted shared data based on the data filtering results and generate a data sharing request;
[0066] The client is also used to send the data sharing request and the customer information to be verified to the blockchain network through the service provider;
[0067] The blockchain network is used to determine whether to agree to the data sharing request based on the customer information to be verified;
[0068] The blockchain network is also used to determine, when agreeing to the data sharing request, to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data using a homomorphic public key, to obtain homomorphically encrypted shared data; the homomorphic public key is provided by the certification authority;
[0069] The blockchain network is also used to send the homomorphic encrypted shared data to the client through the service provider;
[0070] The client is also used to decrypt the homomorphically encrypted shared data using a homomorphic private key to obtain plaintext shared data; the homomorphic private key is provided by the authentication center.
[0071] Based on the above technical solution, this application has the following beneficial effects:
[0072] This application discloses a blockchain data sharing method and system based on homomorphic encryption. The method includes: a client sending query keywords to a service provider; the service provider homomorphically encrypting the query keywords to obtain encrypted query keywords, and using the encrypted query keywords to determine data filtering results from a homomorphic index table; the service provider sending the data filtering results to the client; the client determining target encrypted shared data based on the data filtering results and generating a data sharing request; the client sending the data sharing request and client information to be verified to the blockchain network through the service provider; the blockchain network determining whether to agree to the data sharing request based on the client information; when the blockchain network agrees to the data sharing request, the blockchain network homomorphically encrypting the plaintext shared data corresponding to the target encrypted shared data using a homomorphic public key to obtain homomorphically encrypted shared data; the blockchain network sending the homomorphically encrypted shared data to the client through the service provider; and the client decrypting the homomorphically encrypted shared data using a homomorphic private key to obtain the plaintext shared data. Therefore, this application embodiment achieves homomorphic encrypted retrieval by homomorphically encrypting the query keywords provided by the client, ensuring that the client can only obtain the encrypted shared data corresponding to the query keywords, thus guaranteeing the security of the shared data. Moreover, blockchain networks homomorphically encrypt plaintext shared data before transmission, so all information appears in ciphertext form during network transmission. Only the endpoint of data sharing, i.e. the client, can decrypt the plaintext shared data, thus improving the security of shared data. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the published drawings without creative effort.
[0074] Figure 1 This is a flowchart illustrating a blockchain data sharing method based on homomorphic encryption, as disclosed in an embodiment of this application.
[0075] Figure 2 This is a schematic diagram of the architecture of a blockchain data sharing system based on homomorphic encryption disclosed in an embodiment of this application;
[0076] Figure 3 This is a flowchart illustrating another blockchain data sharing method based on homomorphic encryption disclosed in an embodiment of this application;
[0077] Figure 4 This is a flowchart illustrating yet another blockchain data sharing method based on homomorphic encryption disclosed in an embodiment of this application;
[0078] Figure 5 This is a schematic diagram of a homomorphic encryption process disclosed in an embodiment of this application;
[0079] Figure 6 This is a schematic diagram of a relinearization process disclosed in an embodiment of this application;
[0080] Figure 7 This is a schematic diagram of a rescaling process disclosed in an embodiment of this application. Detailed Implementation
[0081] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0082] This application discloses a blockchain data sharing method and system based on homomorphic encryption. The method includes: a client sending query keywords to a service provider; the service provider homomorphically encrypting the query keywords to obtain encrypted query keywords, and using the encrypted query keywords to determine data filtering results from a homomorphic index table; the service provider sending the data filtering results to the client; the client determining target encrypted shared data based on the data filtering results and generating a data sharing request; the client sending the data sharing request and client information to be verified to the blockchain network through the service provider; the blockchain network determining whether to agree to the data sharing request based on the client information; when the blockchain network agrees to the data sharing request, the blockchain network homomorphically encrypting the plaintext shared data corresponding to the target encrypted shared data using a homomorphic public key to obtain homomorphically encrypted shared data; the blockchain network sending the homomorphically encrypted shared data to the client through the service provider; and the client decrypting the homomorphically encrypted shared data using a homomorphic private key to obtain the plaintext shared data. Therefore, this application embodiment achieves homomorphic encrypted retrieval by homomorphically encrypting the query keywords provided by the client, ensuring that the client can only obtain the encrypted shared data corresponding to the query keywords, thus guaranteeing the security of the shared data. Moreover, blockchain networks homomorphically encrypt plaintext shared data before transmission, so all information appears in ciphertext form during network transmission. Only the endpoint of data sharing, i.e. the client, can decrypt the plaintext shared data, thus improving the security of shared data.
[0083] See Figure 1 The flowchart of a blockchain data sharing method based on homomorphic encryption disclosed in this application embodiment includes:
[0084] S101. The client sends the query keywords to the service provider.
[0085] It should be noted that the client needs to register with the authentication center before subsequent data sharing can take place.
[0086] S102. The service provider performs homomorphic encryption on the query keywords to obtain encrypted query keywords, and uses the encrypted query keywords to determine the data filtering results from the homomorphic index table; wherein, the homomorphic index table is provided by the blockchain network, and the homomorphic index table includes: homomorphically encrypted keywords, ciphertext shared data corresponding to the homomorphically encrypted keywords, and the data filtering results include the ciphertext shared data corresponding to the query keywords;
[0087] In this application embodiment, the blockchain network refers to a blockchain data network composed of multiple data providers.
[0088] In this embodiment, the service provider can utilize homomorphic encryption algorithms such as ElGamal and Paillier to perform homomorphic encryption and ciphertext retrieval on the query keywords. The specific algorithm is not limited and can be selected and configured according to actual needs. It should be noted that ElGamal is an internationally recognized public-key cryptosystem. Its encryption algorithm is based on the Diffile-Hellman key exchange algorithm, proposed by Taher ElGamal in 1985. Its security is based on the discrete logarithm problem over a finite field and possesses multiplicative homomorphism.
[0089] In this embodiment, the service provider can perform ElGamal homomorphic encryption on the query keywords and calculate their inverses to obtain the inverse results. Then, it can perform homomorphic multiplication on each of the ElGamal homomorphically encrypted keywords in the homomorphic index table to obtain the calculation results. Based on the calculation results, it can determine the data filtering results corresponding to the query keywords.
[0090] S103. The service provider sends the data filtering results to the client.
[0091] S104. The client determines the target encrypted sharing data based on the data filtering results and generates a data sharing request.
[0092] S105. The client sends the data sharing request and the client information to be verified to the blockchain network through the service provider.
[0093] S106. The blockchain network determines whether to agree to the data sharing request based on the customer information to be verified.
[0094] S107. When the blockchain network determines that it agrees to the data sharing request, the blockchain network uses a homomorphic public key to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data to obtain homomorphically encrypted shared data; the homomorphic public key is provided by the certification center.
[0095] In this embodiment, the CKKS homomorphic public key can be used to perform CKKS homomorphic encryption on the plaintext shared data corresponding to the target ciphertext shared data to obtain homomorphically encrypted shared data. Of course, other homomorphic encryption algorithms can also be selected to perform homomorphic encryption on the plaintext shared data; there are no specific restrictions, and the choice can be made according to actual needs. It should be noted that the CKKS homomorphic encryption scheme comes from the paper "Homomorphic encryption for arithmetic of approximate numbers," where CKKS is the acronym of the authors: Jung Hee Cheon1, Andrey Kim, Miran Kim, and Yongsoo Song.
[0096] S108. The blockchain network sends the homomorphic encrypted shared data to the client through the service provider.
[0097] S109. The client uses a homomorphic private key to decrypt the homomorphically encrypted shared data to obtain plaintext shared data; the homomorphic private key is provided by the authentication center.
[0098] As can be seen, this embodiment of the application achieves homomorphic ciphertext retrieval by homomorphically encrypting the query keywords provided by the client, ensuring that the client can only obtain the ciphertext shared data corresponding to the query keywords, thereby guaranteeing the security of the shared data. Furthermore, the blockchain network homomorphically encrypts the plaintext shared data before transmission, so all information appears in ciphertext form during network transmission, and only the endpoint of data sharing, i.e., the client, can decrypt and obtain the plaintext shared data, thus improving the security of the shared data.
[0099] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in this application includes:
[0100] S201. The client uses its private key to sign the data sharing request, thereby obtaining a signed data sharing request; the private key is provided by the authentication center.
[0101] S202, The client sends the signed data sharing request and the client information to be verified to the blockchain network;
[0102] S203, The blockchain network uses the client's public key to verify the signed data sharing request; the client's public key is provided by the certification authority;
[0103] In this embodiment of the application, the blockchain network can use multiple pre-stored client public keys to verify the signed data sharing request one by one until the verification is successful or the signed sharing request has been verified using all pre-stored client public keys.
[0104] S204. If the verification is successful, the blockchain network determines whether there is customer information in the pre-stored customer information that is consistent with the customer information to be verified.
[0105] If the verification fails, the blockchain network sends a message to the client indicating that the share establishment has failed.
[0106] S205. If the pre-stored customer information contains customer information that matches the customer information to be verified, the blockchain network determines that it agrees to the data sharing request.
[0107] If the pre-stored customer information does not contain customer information that matches the customer information to be verified, the blockchain network sends a message to the client indicating that the sharing establishment has failed.
[0108] As can be seen, in the data sharing process of this application embodiment, it is necessary to verify the digital signature and customer information. Only when both the data signature and customer information are verified will the client's data sharing request be approved, thus further ensuring the security of the shared data.
[0109] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in the embodiments of this application further includes:
[0110] S301. When the blockchain network determines that it agrees to the data sharing request, the blockchain network sends a message indicating that the sharing has been successfully established to the certification center.
[0111] S302. The authentication center sets the encryption parameters for homomorphic encryption and generates a homomorphic public key and a homomorphic private key;
[0112] S303, The authentication center sends the encryption parameters, the homomorphic public key, and the homomorphic private key to the service provider;
[0113] S304. The service provider sends the encryption parameters and the homomorphic public key to the blockchain network;
[0114] S305. The service provider sends the homomorphic private key to the client.
[0115] As can be seen, in this embodiment of the application, the authentication center will allocate a new homomorphic key pair for each data sharing process, and the old homomorphic key pair will be discarded when the data sharing is completed. In this way, by updating the key pair, even if an attacker obtains the homomorphic key pair that is being used, he will not be able to obtain subsequent messages when the data sharing process ends, thus further ensuring the security of the shared data.
[0116] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in this application embodiment carries the customer information to be verified in the message indicating successful sharing. The method further includes:
[0117] S401. The authentication center determines the corresponding customer public key based on the customer information to be verified, and uses the customer public key to encrypt the homomorphic private key to obtain the encrypted homomorphic private key.
[0118] S402, The authentication center sends the encrypted homomorphic private key to the client through the service provider;
[0119] S402. The client uses its private key to decrypt the encrypted homomorphic private key to obtain the homomorphic private key; the client private key is provided by the authentication center.
[0120] As can be seen, in this embodiment of the application, the certification center uses the client's public key to encrypt the homomorphic private key. In this way, the homomorphic private key is transmitted to the client in an encrypted state, which ensures the security of the homomorphic private key and further improves the security of shared data.
[0121] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in the embodiments of this application includes:
[0122] S501. The blockchain network uses the homomorphic public key and the encryption parameters to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data to obtain homomorphically encrypted shared data.
[0123] S502, The blockchain network sends the homomorphic encrypted shared data to the service provider;
[0124] S503. The service provider calculates the homomorphic encrypted shared data according to the encryption parameters to obtain the calculated homomorphic encrypted shared data.
[0125] S504. The server sends the calculated homomorphic encrypted shared data to the client.
[0126] S505. The client uses the homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain plaintext shared data.
[0127] As can be seen, in this embodiment of the application, the encrypted computation is performed by the service provider, which solves the problem that the client may not have the corresponding computing capabilities when facing scenarios that require large-scale data computation.
[0128] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in the embodiments of this application further includes:
[0129] S601. The blockchain network performs a hash calculation on the homomorphic encrypted shared data to obtain a first hash value, and sends the first hash value to the service provider.
[0130] S602. The service provider performs a hash calculation on the homomorphic encrypted shared data to obtain a second hash value;
[0131] S603. The service provider determines whether the first hash value and the second hash value are consistent;
[0132] S604. If the first hash value and the second hash value are the same, the service provider calculates the homomorphic encrypted shared data according to the encryption parameters to obtain the calculated homomorphic encrypted shared data.
[0133] S605. If the first hash value and the second hash value are inconsistent, the service provider sends a message to the blockchain network to retransmit the data.
[0134] As can be seen, in this embodiment of the application, the integrity of homomorphically encrypted shared data is verified by performing hash calculation on the homomorphically encrypted shared data through the blockchain network and the service provider, thus ensuring the integrity of the shared data transmitted subsequently.
[0135] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in the embodiments of this application further includes:
[0136] S701. The service provider performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a third hash value, and sends the third hash value to the client.
[0137] S702. The client performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a fourth hash value;
[0138] S703, The client determines whether the third hash value and the fourth hash value are consistent;
[0139] S704. If the third hash value and the fourth hash value are the same, the client uses the homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain plaintext shared data.
[0140] S705. If the third hash value and the fourth hash value are inconsistent, the client sends a message to the service provider to retransmit the data.
[0141] As can be seen, in this embodiment of the application, the service provider and the client perform hash calculation on the calculated homomorphic encrypted shared data, thereby verifying the integrity of the calculated homomorphic encrypted shared data and ensuring the integrity of the shared data obtained from subsequent decryption.
[0142] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in the embodiments of this application further includes:
[0143] S801. When the data provider generates new plaintext shared data, it extracts keywords from the new plaintext shared data, performs homomorphic encryption on the keywords, and obtains homomorphically encrypted keywords.
[0144] S802. The data provider encrypts the new plaintext shared data to obtain ciphertext shared data.
[0145] In this embodiment, the new plaintext shared data can be encrypted using SM4 symmetric encryption algorithm, AES encryption algorithm, or DES encryption algorithm, etc. There are no specific limitations; the choice can be made according to actual needs. SM4 symmetric encryption algorithm is a block cipher algorithm, symmetric encryption, with both key length and block length being 128 bits.
[0146] S803, The data provider uploads the homomorphically encrypted keyword and the ciphertext shared data to the blockchain network;
[0147] S804. The blockchain network generates a homomorphic index table based on the homomorphically encrypted keywords and the ciphertext shared data.
[0148] In this embodiment, the blockchain network can periodically update the homomorphic index table and periodically send the updated homomorphic index table to the service provider.
[0149] As can be seen, the data in the homomorphic index table in this embodiment is encrypted. Thus, the service provider obtains the encrypted data and performs ciphertext retrieval, ensuring the confidentiality of the shared data.
[0150] In one possible implementation, the blockchain data sharing method based on homomorphic encryption disclosed in the embodiments of this application further includes:
[0151] S901, The client sends authentication data to the authentication center; the authentication data includes customer information;
[0152] S902. The certification center reviews the certification data;
[0153] S903. If the audit is successful, the certification center generates a client public key and a client private key, and stores the certification data and the client public key in the certification center.
[0154] S904. The authentication center sends the customer information and the customer public key to the blockchain network through the service provider.
[0155] S905, The authentication center sends the client's private key and a registration success message to the client through the service provider.
[0156] As can be seen, the client's authentication data needs to be reviewed in this embodiment. Only when the authentication data is approved can the client successfully register and obtain the shared data, thus further ensuring the security of the shared data.
[0157] This application discloses a blockchain data sharing method based on homomorphic encryption, the method comprising:
[0158] S1: The client sends the query keywords to the service provider;
[0159] S2: The service provider performs ElGamal homomorphic encryption on the query keywords to obtain encrypted query keywords. Using these encrypted keywords, it determines the data filtering results from the homomorphic index table. The homomorphic index table is provided by the blockchain network and includes: the ElGamal homomorphically encrypted keywords and the corresponding ciphertext shared data. The ciphertext shared data is obtained by encrypting the plaintext shared data using the SM4 symmetric encryption algorithm. The data filtering results include the ciphertext shared data corresponding to the query keywords.
[0160] S3: The service provider sends the data filtering results to the client;
[0161] S4: The client determines the target encrypted sharing data based on the data filtering results, generates a data sharing request, and signs the data sharing request using the client's private key; this client's private key is provided by the certification authority.
[0162] S5: The client sends the signed data sharing request and the client information to be verified to the blockchain network;
[0163] S6: Verify the signed data sharing request using the client's public key; if the verification is successful, the blockchain network determines whether there is customer information in the pre-stored customer information that matches the customer information to be verified; if there is customer information in the pre-stored customer information that matches the customer information to be verified, the blockchain network determines that it agrees to the data sharing request and generates a message indicating that the sharing has been successfully established; wherein, the client's public key is provided by the certification center, and the message indicating that the sharing has been successfully established carries the customer information to be verified.
[0164] S7: The blockchain network will send a message of successful establishment to the certification authority;
[0165] S8: When the authentication center receives the message that the sharing has been successfully established, it sets the encryption parameters of CKKS homomorphic encryption and generates a CKKS homomorphic private key and a CKKS homomorphic public key; it determines the corresponding customer public key according to the customer information to be verified, and uses the customer public key to encrypt the CKKS homomorphic private key to obtain the encrypted CKKS homomorphic private key.
[0166] S9: The authentication center sends the encryption parameters, the encrypted CKKS homomorphic private key, and the CKKS homomorphic public key to the service provider;
[0167] S10: The service provider sends the encryption parameters and the CKKS homomorphic public key to the blockchain network;
[0168] S11: The service provider sends the encrypted CKKS homomorphic private key to the client;
[0169] S12: The blockchain network homomorphically encrypts the plaintext shared data corresponding to the target ciphertext shared data according to the encryption parameters and the CKKS homomorphic public key to obtain homomorphically encrypted shared data; and performs hash calculation on the homomorphically encrypted shared data to obtain the first hash value;
[0170] S13: The blockchain network sends the homomorphically encrypted shared data and the first hash value to the service provider;
[0171] S14: The service provider performs a hash calculation on the homomorphic encrypted shared data to obtain a second hash value; it determines whether the first hash value and the second hash value are consistent; if the first hash value and the second hash value are consistent, it performs a calculation on the homomorphic encrypted shared data according to the encryption parameters to obtain the calculated homomorphic encrypted shared data; it performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a third hash value.
[0172] S15. The service provider sends the calculated homomorphic encrypted shared data and the third hash value to the client.
[0173] S16: The client performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a fourth hash value; it checks whether the third hash value and the fourth hash value are consistent; if the third hash value and the fourth hash value are consistent, it uses the client's private key to decrypt the encrypted CKKS homomorphic private key to obtain the CKKS homomorphic private key; it uses the CKKS homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain the plaintext shared data.
[0174] As can be seen, this application embodiment designs a hybrid homomorphic encryption scheme, using a combination of ElGamal homomorphic encryption algorithm, SM4 symmetric encryption algorithm, and CKKS homomorphic encryption algorithm for encryption, each responsible for security and privacy protection and authentication capabilities, respectively. Furthermore, it employs a ciphertext retrieval scheme combining blockchain and homomorphic encryption. The blockchain network generates a homomorphic retrieval table based on existing data indexes and ciphertext, and periodically updates the homomorphic index table, ensuring that data is always stored in ciphertext form in a third-party database. This guarantees security and computational power while also providing ease of retrieval.
[0175] See Figure 2 This is a schematic diagram of the architecture of a blockchain data sharing system based on homomorphic encryption disclosed in an embodiment of this application. The system includes: State Grid institutions, customers, service providers, and certification centers; wherein, multiple service providers form a third-party computing network, and multiple State Grid institutions form the State Grid blockchain data network. It can be understood that the State Grid blockchain data network is equivalent to the aforementioned blockchain network, the customer is equivalent to the aforementioned client, and the third-party computing network is equivalent to the aforementioned service provider.
[0176] The Authentication Center (Authentication Center) is a fully trusted entity, operated and managed by a department within the State Grid Corporation of China. The Authentication Center is responsible for managing the data sharing process and is the core of this process. During data sharing, it is responsible for: ① generating legitimate identity credentials for newly joined State Grid institutions or customers; ② managing State Grid institutions; ③ managing homomorphic keys, being responsible for generating homomorphic key pairs, and delivering encryption parameters to service providers for broadcast; ④ generating customer key pairs and encrypting homomorphic private keys using the customer's public key.
[0177] The State Grid Corporation of China (SGCC) is a trusted entity possessing a large amount of data and the right to decide whether to share resources, aiming to share data under the premise of data security. Within the entire sharing system, a SGCC blockchain data network, composed of multiple SGCC institutions, is used for data sharing and storage among SGCC institutions. The SGCC blockchain data network periodically generates homomorphic search tables for service providers and clients to retrieve data. The entity responsible for the data sharing process is: ① When new shared data is available, encrypt the shared data and upload the ciphertext to the SGCC blockchain data network. Use a homomorphic encryption algorithm to encrypt plaintext keywords for ciphertext retrieval, and periodically update the homomorphic search table to provide homomorphic search services to service providers and clients. ② Receive data sharing requests from clients and choose to accept or reject the data sharing application. ③ Receive the homomorphic public key and encrypt the data. ④ Upload the encrypted ciphertext to the service provider.
[0178] The service providers are untrusted entities, third-party organizations with substantial computing resources, providing cloud servers for the data sharing framework. Multiple service providers exist within this framework, collectively forming a third-party computing network. Their responsibilities in the data sharing process include: ① performing encrypted retrieval of State Grid data using user-provided keywords. ② broadcasting encrypted parameters. ③ temporarily storing encrypted text and parameters. ④ performing homomorphic computation. ⑤ acting as a relay for communication between participating parties.
[0179] The client, an untrusted entity or user, represents the end point of the data sharing process. The client requires certain data from the State Grid Corporation for research. The responsible parties in the data sharing process are: ① Submitting a data sharing request. ② Receiving the client's private key and using it to sign the data sharing request. ③ Decrypting the homomorphic private key using the client's private key, and then using the homomorphic private key to verify and decrypt the encrypted data, thereby obtaining the required plaintext result.
[0180] See Figure 3 This is a flowchart illustrating another blockchain data sharing method based on homomorphic encryption disclosed in this application. The data sharing process mainly uses the ElGamal homomorphic encryption algorithm, the SM4 symmetric encryption algorithm, and the CKKS homomorphic encryption algorithm. The main steps are: generating a homomorphic lookup table, customer registration, data sharing application and ciphertext retrieval, CKKS homomorphic key pair generation, data encryption and uploading, ciphertext calculation, and ciphertext decryption. New State Grid agencies or users not yet joined the sharing system need to register before data sharing can occur. See also... Figure 4This is a flowchart illustrating another blockchain data sharing method based on homomorphic encryption disclosed in this application. The authentication center is used to generate CKKS algorithm parameters, generate CKKS context, and generate CKKS keys; the service provider is used to forward requests, save encryption parameters, broadcast encryption parameters, and perform ciphertext calculation; the State Grid Corporation is used to judge sharing requests, encrypt data, and send ciphertext; and the customer is used to register, request data sharing, receive ciphertext, and decrypt it. The following is combined with... Figure 3 and Figure 4 The overall data sharing process is explained.
[0181] Step 1: Generate a homomorphic search table.
[0182] When State Grid Corporation of China (SGCC) generates new plaintext shared data, it extracts data keywords from the new plaintext shared data and uses these keywords for ElGamal homomorphic encryption as a data index. The new plaintext shared data is then encrypted using SM4 to obtain ciphertext shared data, which is stored on the SGCC blockchain data network. The SGCC blockchain data network generates a homomorphic search table based on the existing data index and the ciphertext shared data, and periodically updates the homomorphic index table. The homomorphic index table provides data retrieval functionality to customers, allowing them to select keywords, and the service provider to process and query the data.
[0183] Step 2: Customer registration.
[0184] Unregistered customers must register before requesting shared data. Unregistered customers upload their personal information and authentication materials to the authentication center, which reviews the materials. If approved, the authentication center enters the information into the system, generates a customer key pair (pk, sk), sends the customer's private key sk to the customer for safekeeping, and stores the customer's public key pk along with the customer information in the system, returning a registration completion message to the customer. If registration fails, a reason for failure is returned to the customer.
[0185] Step 3: Data sharing application and encrypted text retrieval.
[0186] After a customer completes registration, they can filter data using the homomorphic index table provided by the State Grid Blockchain Data Network. The customer sends the keywords they want to query to the service provider, who then performs ElGamal homomorphic encryption and inverses the encryption. The inverse is then used to perform homomorphic multiplication with each keyword in the index table. The index table entries that result in 1 are the filtering results. The results are then returned to the customer along with some encrypted data information, such as keywords, upload time, and data size, without any specific restrictions.
[0187] It's important to note that the ElGamal homomorphic encryption algorithm randomly generates a secret number k during encryption. This k is not included in the public key, leading to different ciphertexts obtained by encrypting the same plaintext multiple times with the same public key, making direct comparison impossible. However, the secret number k does not affect ElGamal's homomorphic multiplication operation. Therefore, the property of the inverse can be used to perform the search. For example, the service provider first encodes the search keyword Q into a hexadecimal string using Unicode, then converts it to an integer form to obtain Q*. After homomorphically encrypting Q* with ElGamal, we get enc(Q*), and then calculate the inverse (enc(Q*))^-1. The service provider then performs a homomorphic multiplication of (enc(Q*))^-1 with the homomorphically encrypted keyword enc(M) in the homomorphic index table, decrypts the result, and based on the properties of ElGamal's homomorphic multiplication and inverse, when the same keyword is calculated, the result is 1. The index entries with a result of 1 are the filtering results. When different keywords are calculated, the decrypted result is a positive integer, Dec(Enc(m))=β(γ^X)^-1mod p. Where E(m)={γ=g^k mod p,β=mY^k mod p}, Y=g^X mod p. The private key is {X}, X∈(1,p-1), the public key is {p,g,Y}, and k is a random number between 0 and 1. It should be understood that the above is merely an illustrative example and should not be construed as a limitation of this application.
[0188] The customer filters the returned data and sends a sharing request. The system then forwards the customer's sharing request and customer information to the relevant State Grid agency through the service provider. The relevant State Grid agency can decide whether to provide the data based on the customer information and informs the customer of the result through the service provider. When the State Grid agency agrees to the sharing request, it uploads a message indicating successful sharing to the authentication center.
[0189] Step 4: Generate CKKS homomorphic key pairs.
[0190] When the certification authority receives a message indicating successful sharing, it generates a CKKS homomorphic key pair. The CKKS homomorphic encryption algorithm can be implemented using the Tenseal library in a Python environment.
[0191] The parameters required for CKKS homomorphic encryption include the scaling factor, the polymodulus degree, and the coefficient modulus sizes. Specifically, the scaling factor: In the CKKS homomorphic encryption algorithm, before encrypting data, the data needs to be encoded, converting real-number vectors into plaintext polynomials. During the encoding stage, the message is amplified using the scaling factor, and during the decoding stage, it is divided by the scaling factor to restore the original message size. Therefore, the value of the scaling factor affects the encoding accuracy; a larger scaling factor results in higher decoding accuracy. The polynomial degree: Z on the polynomial ring... q =Z q [X] / Φ M Φ in (X) M The series N, Φ of (X) M (X) is a cyclotomic polynomial, M = N / 2. The choice of the modular polynomial series will affect the number of coefficients in the plaintext polynomial, the size of the ciphertext elements, the computational performance of the scheme, and the security level. Modulus of the modular polynomial coefficients: The modulus of the polynomial coefficients (list of prime numbers), i.e., q, will affect the size of the ciphertext elements, the security level L of the scheme, and the security level.
[0192] When data sharing is established, the certification authority sets encryption parameters and generates a CKKS homomorphic key pair. The certification authority broadcasts the encryption parameters through the service provider, broadcasts the CKKS homomorphic public key through the service provider, and encrypts the CKKS homomorphic private key s using the client's public key pk from step two, obtaining s′ = Enc(pk, s). The encrypted CKKS homomorphic private key s′ is then sent to the corresponding client through the service provider.
[0193] Step 5: Data encryption and upload.
[0194] After receiving the sharing request, the State Grid Corporation of China encrypts the data using the CKKS homomorphic public key sent by the certification center. The encryption process involves encrypting the encoded plaintext message m(X) to obtain ciphertext C. The private key (1, s) and public key (b = -a·s + e, a) are used, where s and a are vectors, and e is a random number. Then the ciphertext (C0, C1) = r(b, a) + (m + e1, e2), where r is a random integer, e1 and e2 are random polynomials, and the multiplication in the calculation is polynomial multiplication. For a detailed explanation of the homomorphic encryption process for plaintext data, please refer to [link to documentation]. Figure 5 .
[0195] It should be noted that the final encrypted result contains noise, but this is also part of the message. The CKKS homomorphic encryption scheme yields an approximate result after encryption and decryption.
[0196] After the State Grid Corporation encrypts the plaintext shared data, it sends the homomorphically encrypted shared data to a third-party computing network, where the service provider performs ciphertext computation and forwards the result to the designated customer.
[0197] Step Six: Ciphertext Calculation.
[0198] When homomorphically encrypted shared data enters a third-party computing network, it will automatically search for an available service provider, which will then perform the specified ciphertext computation. The ciphertext computation includes at least one of the following: homomorphic addition, homomorphic multiplication, and rotation.
[0199] Homomorphic addition: C(m1+m2)=C(m1)+C(m2).
[0200] Homomorphic multiplication: C(m1*m2)=C(m1)*C(m2).
[0201] Since homomorphic multiplication causes the ciphertext size and magnification factor to expand, relinearization and rescaling are automatically performed after homomorphic multiplication. Relinearization is used to control the ciphertext dimension to prevent the ciphertext size from expanding, and rescaling maintains the stability of the magnification factor by discarding the low-order part of the ciphertext.
[0202] Since the vector encoded by the CKKS homomorphic encryption algorithm exists in polynomial form, the ciphertext C = (C0, C1) has the plaintext polynomial form C(s) = C0 + C1s. Multiplying ciphertext by ciphertext will increase the number of terms in the product polynomial, such as C(s) * C′(s) = d0 + d1s + d1s 2 Relinearization involves transforming the three terms in the product into the original two terms, i.e., C(s)*C′(s)=d0+d1s+d1s 2 =d′0+d′1s, see the detailed relinearization process. Figure 6 .
[0203] Rescaling uses a hierarchical multiplication mechanism. CKKS designed a finite multiplication fully homomorphic encryption mechanism and introduced a modular chain Q = q0·p. L Here, p is a prime number close to Δ, and L is the multiplication depth. The modulus of the newly encrypted ciphertext is Q. Because the CKKS homomorphic encryption algorithm multiplies information by Δ during the encoding phase, Δ increases with each ciphertext multiplication. This increase can be offset by dividing the coefficients by p, ensuring that the ciphertext data contains only one Δ throughout. However, this results in a decrease in the multiplication depth. See [link to details on the rescaling process] for more information. Figure 7 .
[0204] Rotation: C(rot(m, λ) * ))=rot(C(m),λ * ).
[0205] Rotation involves shifting the ciphertext to the left and appending any overflowing ciphertext to the end. For example, when the original sequence is (1,2,3,4,5,6,7,8,9), after the operation rot(C(m), 1), the ciphertext becomes (2,3,4,5,6,7,8,9,1). When the original sequence is (1,2,3,4,5,6,7,8,9), after the operation rot(C(m), 4), the ciphertext becomes (5,6,7,8,9,1,2,3,4). After the ciphertext calculation is complete, the service provider sends the calculated ciphertext to the designated client. It is understood that the above is merely an illustrative example and should not be construed as a limitation of this application.
[0206] Step 7: Decrypt the ciphertext.
[0207] After the client receives the ciphertext, they first decrypt the encrypted homomorphic private key s' obtained in step four using the formula s = Dec(sk, s′) to obtain the CKKS homomorphic private key s. Then, they decrypt the ciphertext. The ciphertext is (C0, C1), and the client's homomorphic private key is s. During decryption, m≈C0+C1s is calculated.
[0208] Because relinearization and rescaling operations are used during the ciphertext computation, a small portion of the ciphertext is omitted, resulting in noise in the decrypted result. The CKKS scheme treats this noise as part of the plaintext, so the decrypted result can only approximate the plaintext *m*. The specific decryption process is: C0 + C1S = rb + m + e1 + ra·s + e2s = m + e1 + e2s - er. After decryption, the client receives the calculated shared data, and the data sharing process ends.
[0209] This application discloses a blockchain data sharing system based on homomorphic encryption, which includes: a client, a service provider, a blockchain network, and an authentication center;
[0210] The client is used to send query keywords to the service provider;
[0211] The service provider is used to perform homomorphic encryption on the query keywords to obtain encrypted query keywords, and use the encrypted query keywords to determine data filtering results from the homomorphic index table; wherein, the homomorphic index table is provided by the blockchain network, and the homomorphic index table includes: homomorphically encrypted keywords, ciphertext shared data corresponding to the homomorphically encrypted keywords, and the data filtering results include the ciphertext shared data corresponding to the query keywords;
[0212] The service provider is also used to send the data filtering results to the client;
[0213] The client is also used to determine the target encrypted shared data based on the data filtering results and generate a data sharing request;
[0214] The client is also used to send the data sharing request and the customer information to be verified to the blockchain network through the service provider;
[0215] The blockchain network is used to determine whether to agree to the data sharing request based on the customer information to be verified;
[0216] The blockchain network is also used to determine, when agreeing to the data sharing request, to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data using a homomorphic public key, to obtain homomorphically encrypted shared data; the homomorphic public key is provided by the certification authority;
[0217] The blockchain network is also used to send the homomorphic encrypted shared data to the client through the service provider;
[0218] The client is also used to decrypt the homomorphically encrypted shared data using a homomorphic private key to obtain plaintext shared data; the homomorphic private key is provided by the authentication center.
[0219] As can be seen, this application discloses a blockchain data sharing system based on homomorphic encryption. The client sends query keywords to the service provider; the service provider homomorphically encrypts the query keywords to obtain encrypted query keywords, and uses these encrypted query keywords to determine data filtering results from a homomorphic index table; the service provider sends the data filtering results to the client; the client determines the target encrypted shared data based on the data filtering results and generates a data sharing request; the client sends the data sharing request and the client information to be verified to the blockchain network through the service provider; the blockchain network determines whether to agree to the data sharing request based on the client information to be verified; when the blockchain network agrees to the data sharing request, it homomorphically encrypts the plaintext shared data corresponding to the target encrypted shared data using a homomorphic public key to obtain homomorphically encrypted shared data; the blockchain network sends the homomorphically encrypted shared data to the client through the service provider; the client decrypts the homomorphically encrypted shared data using a homomorphic private key to obtain the plaintext shared data. By homomorphically encrypting the query keywords provided by the client, homomorphic encrypted retrieval is achieved, ensuring that the client can only obtain the encrypted shared data corresponding to the query keywords, thus guaranteeing the security of the shared data. Moreover, blockchain networks homomorphically encrypt plaintext shared data before transmission, so all information appears in ciphertext form during network transmission. Only the endpoint of data sharing, i.e. the client, can decrypt the plaintext shared data, thus improving the security of shared data.
[0220] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the client is further configured to sign the data sharing request using a client private key to obtain a signed data sharing request; the client private key is provided by the authentication center.
[0221] The blockchain network is also used to verify the signed data sharing request using the client's public key; the client's public key is provided by the certification authority.
[0222] The blockchain network is further configured to, if the verification is successful, determine whether there is customer information in the pre-stored customer information that matches the customer information to be verified; if there is customer information in the pre-stored customer information that matches the customer information to be verified, determine that the data sharing request is agreed to.
[0223] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the blockchain network is further configured to send a message indicating successful establishment of the sharing to the authentication center when it determines that it agrees to the data sharing request;
[0224] The authentication center is used to set the encryption parameters for homomorphic encryption and generate homomorphic public and private keys.
[0225] The authentication center is also used to send the encryption parameters, the homomorphic public key, and the homomorphic private key to the service provider.
[0226] The service provider is also used to send the encryption parameters and the homomorphic public key to the blockchain network;
[0227] The service provider is also used to send the homomorphic private key to the client.
[0228] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the message indicating successful establishment of the sharing carries the customer information to be verified.
[0229] The authentication center is also used to determine the corresponding customer public key based on the customer information to be verified, and to encrypt the homomorphic private key using the customer public key to obtain the encrypted homomorphic private key;
[0230] The client is also used to decrypt the encrypted homomorphic private key using the client's private key to obtain the homomorphic private key; the client's private key is provided by the authentication center.
[0231] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the blockchain network is specifically used to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data using the homomorphic public key and the encryption parameters to obtain homomorphically encrypted shared data.
[0232] The service provider is also used to calculate the homomorphic encrypted shared data according to the encryption parameters to obtain the calculated homomorphic encrypted shared data;
[0233] The server is also used to send the calculated homomorphic encrypted shared data to the client;
[0234] The client is specifically used to decrypt the calculated homomorphic encrypted shared data using a homomorphic private key to obtain plaintext shared data.
[0235] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the blockchain network is further used to perform hash calculation on the homomorphically encrypted shared data to obtain a first hash value, and send the first hash value to the service provider.
[0236] The service provider is also used to perform hash calculation on the homomorphic encrypted shared data to obtain a second hash value;
[0237] The service provider is also used to determine whether the first hash value and the second hash value are consistent;
[0238] The service provider is specifically used to calculate the homomorphic encrypted shared data according to the encryption parameters if the first hash value and the second hash value are the same, so as to obtain the calculated homomorphic encrypted shared data.
[0239] The service provider is also configured to send a message to the blockchain network to retransmit data if the first hash value and the second hash value are inconsistent.
[0240] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the service provider is further configured to perform hash calculation on the calculated homomorphic encrypted shared data to obtain a third hash value, and send the third hash value to the client;
[0241] The client is also used to perform hash calculation on the calculated homomorphic encrypted shared data to obtain a fourth hash value;
[0242] The client is also used to determine whether the third hash value and the fourth hash value are consistent;
[0243] The client is specifically used to decrypt the calculated homomorphic encrypted shared data using a homomorphic private key if the third hash value and the fourth hash value are the same, to obtain plaintext shared data.
[0244] The client is also configured to send a message to the service provider to retransmit data if the third hash value and the fourth hash value are inconsistent.
[0245] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the data provider is used to extract keywords from the new plaintext shared data when new plaintext shared data is generated, and to perform homomorphic encryption on the keywords to obtain homomorphically encrypted keywords;
[0246] The data provider is also used to encrypt the new plaintext shared data to obtain ciphertext shared data;
[0247] The data provider is also used to upload the homomorphically encrypted keywords and the ciphertext shared data to the blockchain network;
[0248] The blockchain network is also used to generate a homomorphic index table based on the homomorphically encrypted keywords and the ciphertext shared data.
[0249] In one possible implementation, in the blockchain data sharing system based on homomorphic encryption disclosed in this application embodiment, the client is further configured to send authentication data to the authentication center; the authentication data includes customer information;
[0250] The certification center is also used to audit the certification data;
[0251] The authentication center is also used to generate a customer public key and a customer private key if the audit is passed, and to store the authentication data and the customer public key in the authentication center;
[0252] The authentication center is also used to send the customer information and the customer public key to the blockchain network through the service provider.
[0253] The authentication center is also used to send the client's private key and a registration success message to the client through the service provider.
[0254] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0255] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.
[0256] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0257] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A blockchain data sharing method based on homomorphic encryption, characterized in that, The method includes: The client sends the query keywords to the service provider; The service provider performs homomorphic encryption on the query keywords to obtain encrypted query keywords, and uses the encrypted query keywords to determine the data filtering results from the homomorphic index table; wherein, the homomorphic index table is provided by the blockchain network, and the homomorphic index table includes: homomorphically encrypted keywords, ciphertext shared data corresponding to the homomorphically encrypted keywords, and the data filtering results include the ciphertext shared data corresponding to the query keywords; The service provider sends the data filtering results to the client. The client determines the target encrypted sharing data based on the data filtering results and generates a data sharing request. The client sends the data sharing request and the client information to be verified to the blockchain network through the service provider. The blockchain network determines whether to agree to the data sharing request based on the customer information to be verified. When the blockchain network determines that it agrees to the data sharing request, the blockchain network uses a homomorphic public key to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data, thereby obtaining homomorphically encrypted shared data; the homomorphic public key is provided by the certification authority; The blockchain network sends the homomorphic encrypted shared data to the client through the service provider. The client uses a homomorphic private key to decrypt the homomorphically encrypted shared data to obtain plaintext shared data; the homomorphic private key is provided by the authentication center.
2. The method according to claim 1, characterized in that, The method further includes: The client uses its private key to sign the data sharing request, thus obtaining a signed data sharing request; the client's private key is provided by the authentication center. The blockchain network determines whether to agree to the data sharing request based on the customer information to be verified, including: The blockchain network uses the client's public key to verify the signed data sharing request; the client's public key is provided by the certification authority. If the verification is successful, the blockchain network determines whether there is customer information in the pre-stored customer information that matches the customer information to be verified; If the pre-stored customer information contains customer information that matches the customer information to be verified, the blockchain network determines that it agrees to the data sharing request.
3. The method according to claim 1, characterized in that, The method further includes: When the blockchain network determines that it agrees to the data sharing request, the blockchain network sends a message indicating that the sharing has been successfully established to the certification center; The authentication center sets the encryption parameters for homomorphic encryption and generates a homomorphic public key and a homomorphic private key; The authentication center sends the encryption parameters, the homomorphic public key, and the homomorphic private key to the service provider; The service provider sends the encryption parameters and the homomorphic public key to the blockchain network; The service provider sends the homomorphic private key to the client.
4. The method according to claim 3, characterized in that, The message indicating successful sharing carries the customer information to be verified, and the method further includes: The authentication center determines the corresponding customer public key based on the customer information to be verified, and uses the customer public key to encrypt the homomorphic private key to obtain the encrypted homomorphic private key; The client uses its private key to decrypt the encrypted homomorphic private key to obtain the homomorphic private key; the client private key is provided by the authentication center.
5. The method according to claim 3, characterized in that, The blockchain network uses a homomorphic public key to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data, obtaining homomorphically encrypted shared data, including: The blockchain network uses the homomorphic public key and the encryption parameters to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data, thereby obtaining homomorphically encrypted shared data. The method further includes: The service provider calculates the homomorphic encrypted shared data based on the encryption parameters to obtain the calculated homomorphic encrypted shared data. The service provider sends the calculated homomorphic encrypted shared data to the client. The client uses a homomorphic private key to decrypt the homomorphically encrypted shared data to obtain plaintext shared data, including: The client uses a homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain plaintext shared data.
6. The method according to claim 5, characterized in that, The method further includes: The blockchain network performs a hash calculation on the homomorphic encrypted shared data to obtain a first hash value, and sends the first hash value to the service provider. The service provider performs a hash calculation on the homomorphic encrypted shared data to obtain a second hash value; The service provider determines whether the first hash value and the second hash value are consistent; If the first hash value and the second hash value are the same, the service provider calculates the homomorphic encrypted shared data according to the encryption parameters to obtain the calculated homomorphic encrypted shared data. If the first hash value and the second hash value are inconsistent, the service provider sends a message to the blockchain network to retransmit the data.
7. The method according to claim 5, characterized in that, The method further includes: The service provider performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a third hash value, and sends the third hash value to the client; The client performs a hash calculation on the calculated homomorphic encrypted shared data to obtain a fourth hash value; The client determines whether the third hash value and the fourth hash value are consistent; If the third hash value and the fourth hash value are the same, the client uses the homomorphic private key to decrypt the calculated homomorphic encrypted shared data to obtain the plaintext shared data. If the third hash value and the fourth hash value are inconsistent, the client sends a message to the service provider to retransmit the data.
8. The method according to claim 1, characterized in that, The method further includes: When the data provider generates new plaintext shared data, it extracts keywords from the new plaintext shared data, performs homomorphic encryption on the keywords, and obtains homomorphically encrypted keywords. The data provider encrypts the new plaintext shared data to obtain ciphertext shared data. The data provider uploads the homomorphically encrypted keywords and the ciphertext shared data to the blockchain network; The blockchain network generates a homomorphic index table based on the homomorphically encrypted keywords and the ciphertext shared data.
9. The method according to claim 1, characterized in that, The method further includes: The client sends authentication data to the authentication center; the authentication data includes customer information. The certification center reviews the certification data; If the audit is successful, the certification center generates a client public key and a client private key, and stores the certification data and the client public key in the certification center. The authentication center sends the customer information and the customer public key to the blockchain network through the service provider. The authentication center sends the client's private key and a registration success message to the client through the service provider.
10. A blockchain data sharing system based on homomorphic encryption, characterized in that, The system includes: a client, a service provider, a blockchain network, and a certification center; The client is used to send query keywords to the service provider; The service provider is used to perform homomorphic encryption on the query keywords to obtain encrypted query keywords, and use the encrypted query keywords to determine data filtering results from the homomorphic index table; wherein, the homomorphic index table is provided by the blockchain network, and the homomorphic index table includes: homomorphically encrypted keywords, ciphertext shared data corresponding to the homomorphically encrypted keywords, and the data filtering results include the ciphertext shared data corresponding to the query keywords; The service provider is also used to send the data filtering results to the client; The client is also used to determine the target encrypted shared data based on the data filtering results and generate a data sharing request; The client is also used to send the data sharing request and the customer information to be verified to the blockchain network through the service provider; The blockchain network is used to determine whether to agree to the data sharing request based on the customer information to be verified; The blockchain network is also used to determine, when agreeing to the data sharing request, to homomorphically encrypt the plaintext shared data corresponding to the target ciphertext shared data using a homomorphic public key, to obtain homomorphically encrypted shared data; the homomorphic public key is provided by the certification authority; The blockchain network is also used to send the homomorphic encrypted shared data to the client through the service provider; The client is also used to decrypt the homomorphically encrypted shared data using a homomorphic private key to obtain plaintext shared data; the homomorphic private key is provided by the authentication center.
Citation Information
Patent Citations
Information sharing and secure multi-party computing model based on block chain
CN109388960A
Searchable encrypted data security sharing method based on homomorphic encryption and blockchain
CN111835500A