IPFS-based Blockchain Data Proxy Re-encryption Model
By verifying the zero-knowledge proof of the data requester in the blockchain and generating a re-encryption key, combining IPFS nodes to obtain data for re-encryption, the high cost of blockchain data storage and DDoS attacks are solved, and the security and efficiency of data encryption are improved.
Patent Information
- Application Number
- CN202210771483.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2042-06-30
AI Technical Summary
In a blockchain environment, data storage is under high cost pressure, and third-party re-encryption service providers are vulnerable to DDoS attacks, resulting in wasted computing resources.
By receiving the zero-knowledge proof information of the data requester, verifying its legitimacy, performing re-encryption in the smart contract, and using the public and private keys of the data provider to generate a re-encryption key, combining the IPFS node to obtain data for re-encryption, and adjusting the Token reward or punishment based on whether the re-encryption is successful or not.
It improves the security of the data encryption process, avoids waste of computing resources caused by DDoS attacks, and improves the effectiveness and security of data encryption.
Smart Images

Figure CN115348054B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of storage data management, and in particular to a blockchain data proxy re-encryption method and system based on IPFS. Background Art
[0002] Currently, data storage in blockchain environments is highly redundant. Every node joining a blockchain must synchronize all blockchain transaction data. Consequently, storing massive amounts of data directly on the blockchain faces significant cost pressures. To address this, data providers must collect and encrypt shared data and store it in the IPFS distributed storage system, based on a peer-to-peer network.
[0003] In the process of collecting and encrypting shared data, the shared data requested by the data requester must be re-encrypted by a third-party service provider, and the re-encrypted data must be provided to the data requester.
[0004] However, third-party service providers are vulnerable to DDoS attacks when providing re-encryption services. For example, third-party service providers receive a large number of malicious re-encryption keys to encrypt non-existent data, which will undoubtedly cause a waste of computing resources.
[0005] In view of this, it is necessary to provide a data encryption method that can improve security. Summary of the Invention
[0006] The purpose of this application is to provide a blockchain data proxy re-encryption method and system based on IPFS to improve the security of the data encryption process.
[0007] To achieve the above objectives, the present invention provides a blockchain data proxy re-encryption method and system based on IPFS. The technical solution is as follows:
[0008] In a first aspect, a blockchain data proxy re-encryption method based on IPFS is provided, wherein the method is applied to a third-party proxy re-encryption service provider, and the method comprises:
[0009] Receiving a data request from a data requester, wherein the data request carries zero-knowledge proof information;
[0010] In the smart contract in the blockchain, verify whether the zero-knowledge proof parameters are legal;
[0011] If it is legal, the heavily encrypted data is transmitted to the data requester.
[0012] Furthermore, before receiving the data request sent by the data requester, the method includes:
[0013] Receive the certification information generated by the data requester using the Zokrates tool;
[0014] Send the proof information to the blockchain and authenticate it through a smart contract;
[0015] If the identity authentication is successful, zero-knowledge proof information is generated and fed back to the data requester.
[0016] Furthermore, the heavily encrypted data is obtained as follows:
[0017] Receive the re-encryption key uploaded by the data provider;
[0018] Obtain the data corresponding to the data request from the IPFS node through the hash index;
[0019] The data is re-encrypted according to the re-encryption key.
[0020] Furthermore, the method includes:
[0021] The re-encryption key is generated by the data provider according to the public key and the private key; wherein, the data provider obtains the public key from the data requester.
[0022] Furthermore, after the third-party proxy re-encryption service provider re-encrypts the data corresponding to the data request, the method further includes:
[0023] If the re-encryption is successful, the corresponding token is obtained from the smart contract;
[0024] If the re-encryption fails, the corresponding token will be deducted from the smart contract.
[0025] In a second aspect, a blockchain data proxy re-encryption system based on IPFS is provided, the system comprising: a data requester and a third-party proxy re-encryption service provider; wherein:
[0026] The data requester is configured to send a data request to the third-party proxy re-encryption service provider, wherein the data request carries zero-knowledge proof information;
[0027] The third-party proxy re-encryption service provider is used to verify whether the zero-knowledge proof parameters are legal in the smart contract in the blockchain; if legal, it transmits the re-encrypted data to the data requester.
[0028] Furthermore, the third-party proxy re-encryption service provider is also used to:
[0029] Receive the certification information generated by the data requester using the Zokrates tool;
[0030] Send the proof information to the blockchain and authenticate it through a smart contract;
[0031] If the identity authentication is successful, zero-knowledge proof information is generated and fed back to the data requester.
[0032] Furthermore, the system further includes a data provider, the data provider being configured to upload a re-encryption key to the third-party proxy re-encryption service provider;
[0033] Accordingly, the third-party agent re-encryption service provider is used to
[0034] Receive the re-encryption key uploaded by the data provider;
[0035] Obtain the data corresponding to the data request from the IPFS node through the hash index;
[0036] The data is re-encrypted according to the re-encryption key.
[0037] Furthermore, the data provider is also used to:
[0038] The re-encryption key is generated according to a public key and a private key; wherein the data provider obtains the public key from the data requester.
[0039] Furthermore, the third-party proxy re-encryption service provider is used to:
[0040] If the re-encryption is successful, the corresponding token is obtained from the smart contract;
[0041] If the re-encryption fails, the corresponding token will be deducted from the smart contract.
[0042] The technical solution provided by the embodiments of the present invention provides the following beneficial effects: when a third-party proxy re-encryption service provider re-encrypts data requested by a data requester, it must verify the validity or legitimacy of the data request within the smart contract based on the zero-knowledge proof information included in the data requester's data request. Only after verification is successful will the re-encrypted data be transmitted to the data requester. This allows the third-party proxy re-encryption service provider to verify the data requester's data request when re-encrypting the data requested by the data requester, thereby avoiding the waste of computing resources that could occur if the third-party proxy re-encryption service provider is attacked by a DDoS attack, and thereby improving the security of the data encryption process. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 Schematic diagram of a method for proxy re-encryption of blockchain data based on IPFS in an embodiment of the present invention;
[0045] Figure 2 Schematic diagram of a method for generating zero-knowledge proof information in an embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of obtaining or deleting a Token when a third-party proxy re-encryption service provider performs re-encryption on data in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0048] See also Figure 1 The method for blockchain data proxy re-encryption based on IPFS in an embodiment of the present invention may include the following steps:
[0049] S101: Receive a data request sent by a data requester, where the data request carries zero-knowledge proof information.
[0050] In implementation, the third-party proxy re-encryption service provider needs to receive zero-knowledge proof information provided by the data requester before re-encrypting the data. The zero-knowledge proof information is carried in the data request sent by the data requester.
[0051] In an alternative embodiment, see Figure 2 , zero-knowledge proof information is generated in the following way: the third-party proxy re-encryption service provider receives the proof information generated by the data requester using the Zokrates tool, sends the proof information to the blockchain, and performs identity authentication through the smart contract. If the identity authentication is successful, the zero-knowledge proof information is generated and fed back to the data requester.
[0052] In this embodiment, zero-knowledge proof technology can ensure that identity proof is completed without exposing the user's identity. In this implementation, the ZoKrates tool is used to implement the zero-knowledge proof mechanism.
[0053] Specifically, the generated identity authentication smart contract is deployed in the blockchain environment using the ZoKrates tool. The deployment tool can be built using a Java-based Web3 library. The data requester generates the corresponding proof information locally through the ZoKrates tool and adds it to the data request sent to the third-party proxy re-encryption service provider. After receiving the data request, the third-party proxy re-encryption service provider sends the proof information in the data request to the blockchain, verifies the identity of the data requester through the smart contract, and feeds back the zero-knowledge proof information to the data requester if the verification is successful.
[0054] S102: In the smart contract in the blockchain, verify whether the zero-knowledge proof parameters are legal.
[0055] S103: If legal, transmit the heavily encrypted data to the data requester.
[0056] During implementation, the third-party proxy re-encryption service provider verifies the zero-knowledge proof parameters and only provides re-encryption services for the data corresponding to the data request after verification of their legitimacy.
[0057] In an optional embodiment, a third-party proxy re-encryption service provider can receive the re-encryption key uploaded by the data provider, obtain the data corresponding to the data request from the IPFS node through the hash index, and re-encrypt the data according to the re-encryption key.
[0058] In implementation, the process of a third-party proxy re-encryption service provider performing re-encryption on the data corresponding to the data request is performed by monitoring an event event, and when the data requester uploads the re-encryption key, an event event can be triggered, thereby triggering the third-party proxy re-encryption service provider to perform re-encryption on the data.
[0059] Specifically, smart contracts in a blockchain environment are divided into data storage contracts and data management contracts. The data storage contract is responsible for storing user data and maintains a data table of data requesters within it. Each data requester uses its account address as a unique identifier. Large amounts of data are first uploaded to IPFS, and then the hash value of the data is stored in the smart contract. Small amounts of data are stored directly in the smart contract. In this way, based on the data request and the smart contract, the third-party proxy re-encryption service agency can query the hash value of the data that needs to be re-encrypted, obtain the data corresponding to the data request from the IPFS node based on the hash value, and re-encrypt the data using the re-encryption key uploaded by the data provider. The re-encrypted data is then transmitted to the data requester.
[0060] Furthermore, to further enhance the security of data encryption, a re-encryption key can be generated by the data provider based on a public key and a private key. The data provider obtains the public key from the data requester. This linking of the re-encryption key generation process with the data requester's public key and the data provider's locally generated private key makes the generated re-encryption key even more difficult to decipher, thereby enhancing data encryption security.
[0061] In an optional embodiment, the data in the data provider can be stored in the following manner:
[0062] First, the data provider creates a random temporary encryption key locally and uses the temporary encryption key to encrypt the data. Then, the data is encrypted again using the public key and uploaded to the IPFS node. After receiving the data, the IPFS node returns the hash value of the data, which is stored in the smart contract.
[0063] In addition, in an optional real-time mode, see Figure 3 When a third-party proxy re-encryption service provider provides re-encryption services to a data requester, they can obtain corresponding tokens from the smart contract as a reward. If the data re-encryption process fails or is inefficient, the corresponding tokens will be deducted from the smart contract as a penalty. In this way, when a data requester sends a data request to a third-party proxy re-encryption service provider, they can determine the service quality of the third-party proxy re-encryption service provider based on the corresponding token quantity, thereby improving the processing efficiency of data requests.
[0064] Based on the same concept, an embodiment of the present invention also provides a blockchain data proxy re-encryption system based on IPFS, which includes: a data requester and a third-party proxy re-encryption service provider; wherein:
[0065] The data requester is configured to send a data request to the third-party proxy re-encryption service provider, wherein the data request carries zero-knowledge proof information;
[0066] The third-party proxy re-encryption service provider is used to verify whether the zero-knowledge proof parameters are legal in the smart contract in the blockchain; if legal, it transmits the re-encrypted data to the data requester.
[0067] Furthermore, the third-party proxy re-encryption service provider is also used to:
[0068] Receive the certification information generated by the data requester using the Zokrates tool;
[0069] Send the proof information to the blockchain and authenticate it through a smart contract;
[0070] If the identity authentication is successful, zero-knowledge proof information is generated and fed back to the data requester.
[0071] Furthermore, the system further includes a data provider, the data provider being configured to upload a re-encryption key to the third-party proxy re-encryption service provider;
[0072] Accordingly, the third-party agent re-encryption service provider is used to
[0073] Receive the re-encryption key uploaded by the data provider;
[0074] Obtain the data corresponding to the data request from the IPFS node through the hash index;
[0075] The data is re-encrypted according to the re-encryption key.
[0076] Furthermore, the data provider is also used to:
[0077] The re-encryption key is generated according to a public key and a private key; wherein the data provider obtains the public key from the data requester.
[0078] Furthermore, the third-party proxy re-encryption service provider is used to:
[0079] If the re-encryption is successful, the corresponding token is obtained from the smart contract;
[0080] If the re-encryption fails, the corresponding token will be deducted from the smart contract.
[0081] As can be seen from the above, the embodiment of the present invention provides a method and system for blockchain data proxy re-encryption based on IPFS. When a third-party proxy re-encryption service provider performs re-encryption on the data requested by the data requester, it is necessary to verify the validity or legality of the data request in the smart contract based on the zero-knowledge proof information carried in the data request sent by the data requester, and only transmit the re-encrypted data to the data requester after the verification is passed. In this way, when the third-party proxy re-encryption service provider performs re-encryption on the data requested by the data requester, it can verify the data request sent by the data requester, thereby avoiding the situation where the third-party proxy re-encryption service provider suffers a DDoS attack, resulting in a waste of computing resources, thereby improving the security of the data encryption process.
[0082] The device embodiments described above are merely illustrative. The units described by the separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Those skilled in the art will be able to understand and implement the present invention without inventive effort.
[0083] Through the description of the above-mentioned embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above-mentioned technical solution or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0084] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A blockchain data proxy re-encryption method based on IPFS, characterized in that: The method is applied to a third-party proxy re-encryption service provider, and the method includes: Receive a data request sent by a data requester, wherein the data request carries zero-knowledge proof information, and the zero-knowledge proof information is fed back to the data requester by the third-party proxy re-encryption service provider after the identity of the data requester is successfully authenticated; In the smart contract in the blockchain, verify whether the zero-knowledge proof parameters are legal; If legal, transmit the re-encrypted data to the data requester, wherein the re-encryption key is generated by the data provider based on the public key and private key. The data provider obtains the public key from the data requester and generates the private key locally. If the re-encryption is successful, the corresponding token is obtained from the smart contract; If the re-encryption fails, the corresponding token will be deducted from the smart contract; The service quality of the third-party proxy re-encryption service provider is determined based on the number of tokens.
2. The method according to claim 1, characterized in that Before receiving the data request sent by the data requester, the method includes: Receive the certification information generated by the data requester using the Zokrates tool; Send the proof information to the blockchain and authenticate it through a smart contract; If the identity authentication is successful, zero-knowledge proof information is generated and fed back to the data requester.
3. The method according to claim 1, characterized in that The heavily encrypted data is obtained as follows: Receive the re-encryption key uploaded by the data provider; Obtain the data corresponding to the data request from the IPFS node through the hash index; The data is re-encrypted according to the re-encryption key.
4. A blockchain data proxy re-encryption system based on IPFS, characterized in that: The system includes: a data requester and a third-party proxy re-encryption service provider; wherein: The data requester is configured to send a data request to the third-party proxy re-encryption service provider, wherein the data request carries zero-knowledge proof information, and the third-party proxy re-encryption service provider feeds back the zero-knowledge proof information to the data requester after the data requester's identity is authenticated; The third-party proxy re-encryption service provider is used to verify whether the zero-knowledge proof parameters are legal in the smart contract in the blockchain; if legal, the re-encrypted data is transmitted to the data requester, wherein the re-encryption key is generated by the data provider based on the public key and private key, the data provider obtains the public key from the data requester, and the data provider generates the private key locally; if the re-encryption is successful, the corresponding token is obtained from the smart contract; if the re-encryption fails, the corresponding token is deducted from the smart contract; the service quality of the third-party proxy re-encryption service provider is determined based on the number of tokens.
5. The system according to claim 4, characterized in that The third-party proxy re-encryption service provider is also used to: Receive the certification information generated by the data requester using the Zokrates tool; Send the proof information to the blockchain and authenticate it through a smart contract; If the identity authentication is successful, zero-knowledge proof information is generated and fed back to the data requester.
6. The system according to claim 4, characterized in that The system further includes a data provider, the data provider being configured to upload a re-encryption key to the third-party proxy re-encryption service provider; Accordingly, the third-party agent re-encryption service provider is used to Receive the re-encryption key uploaded by the data provider; Obtain the data corresponding to the data request from the IPFS node through the hash index; The data is re-encrypted according to the re-encryption key.
Citation Information
Patent Citations
Block chain-based proxy re-encryption method and system, and storage medium
CN111541678A
Private data storage and access control method and system based on block chain
CN112989415A
Zero-knowledge proof verifiable certificate digital identity management system and method based on block chain smart contract
CN114186248A