Data sharing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202310107236.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-13
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2043-02-13
AI Technical Summary
[0005]本申请提供一种数据共享方法、装置、电子设备和存储介质,目的在于解决数据安全性、防止数据被篡改的问题
[0026] In the above implementation process, the re-encryption key ciphertext and fragmented ciphertext can be obtained simply and quickly through message sending and receiving. The re-encryption key ciphertext can be decrypted using one's own private key to accurately obtain the symmetric key. The plaintext data can be accurately obtained by reconstructing the fragmented ciphertext and decrypting the reconstructed fragmented ciphertext based on the symmetric key.
Smart Images

Figure CN116166749B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a data sharing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Blockchain technology is widely used in data sharing applications due to its distributed storage characteristics that make it difficult to tamper with.
[0003] Most current blockchain-based data sharing systems rely on a trusted storage node, such as Alibaba Cloud Storage. Typically, data providers upload file data directly to the cloud storage server in plaintext, where the server encrypts the data. Data requesters then download the file directly from the server using a provided download link.
[0004] Current data sharing methods rely on cloud storage servers to encrypt data, which could allow cloud storage providers to monitor and tamper with the shared data, potentially leading to data leaks. Summary of the Invention
[0005] This application provides a data sharing method, apparatus, electronic device, and storage medium, with the aim of solving the problems of data security and preventing data tampering.
[0006] In a first aspect, this application provides a data sharing method applied to a data provider, comprising: generating a symmetric key and a key pair; encrypting file content using the symmetric key to obtain content ciphertext; encrypting the symmetric key using the public key in the key pair to obtain key ciphertext; fragmenting the content ciphertext to obtain fragmented ciphertext; and uploading the fragmented ciphertext and the key ciphertext to at least one storage node.
[0007] In the above implementation process, the data provider encrypts the content, improving the security of shared data. Encrypting the key prevents its leakage, enhancing the security of key transmission and further improving the security of shared data. Fragmenting the encrypted content prevents complete interception during transmission; fragmented data can be transmitted concurrently, and in case of errors, only the erroneous fragment needs to be retransmitted, improving data transmission efficiency. By storing the data on storage nodes, the data provider can achieve offline data sharing.
[0008] Furthermore, uploading the fragmented ciphertext and the key ciphertext to at least one storage node includes: sending an on-chain transaction request to the blockchain node of the blockchain; receiving response information of the transaction request, the response information including a file identifier and a storage node identifier of the at least one storage node; and sending the fragmented ciphertext, the key ciphertext, and the file identifier to the at least one storage node according to the storage node identifier.
[0009] In the above implementation process, by sending a shared data on-chain transaction request to the blockchain node, the blockchain node can be quickly and efficiently notified to generate transaction information and allocate storage nodes. Simultaneously, the shared data on-chain transaction information can be made public to users. Upon receiving the response information, the data provider can quickly and accurately obtain the file identifier and storage node identifier, and send the fragmented encrypted text and key encrypted text to at least one storage node based on the storage node identifier. By placing the on-chain transaction information on the blockchain, the distributed storage characteristics of the blockchain can be leveraged to prevent arbitrary data tampering.
[0010] Furthermore, the method further includes: receiving a data authorization request sent by a data requester, the data authorization request including the request information and key ciphertext information of the data requester; the requester information including the identifier and public key of the data requester; the key ciphertext information including a file identifier and a storage node identifier; generating an authorization key based on the public key and one's own private key; and sending a proxy re-encryption request to the corresponding storage node based on the storage node identifier in the key ciphertext information, the proxy re-encryption request including the authorization key, the file identifier, and the identifier of the data requester.
[0011] In the above implementation process, by generating an authorization key and sending a proxy re-encryption request to the storage node, the storage node can authorize the data requester to access the data without the data provider's private key, thus ensuring the security of the data provider's private key.
[0012] Furthermore, the step of generating an authorization key based on the public key and one's own private key includes: generating an authorization key based on the public key of the data requester, one's own private key, and the authorization key formula Rk1 = g r’ Rk2=X*e(g s H0(ID) B )) r’ Rk3 = sk A -1 *H1(X), Rekey A->B = (Rk1||Rk2||Rk3), generate the authorization key, where g is a generator of G1, r' is a random number, and g r’ The r'th dot product of g, g s For the s-th dot product of g, IDB H0(ID) is the public key of the data requester. B ) is used to perform a hash operation on the public key of the data requester, e(g s H0(ID) B )) r’ For g s and H0(ID) B A bilinear mapping is performed on the parameter , and the mapping result is multiplied r' times. X is a random number, H1(X) is the hash operation performed on X, and sk A -1 The key is the reciprocal of the data provider's private key, where Rk1, Rk2, and Rk3 are intermediate values. A->B The authorization key is obtained by concatenating Rk1, Rk2, and Rk3, where "||" is the character concatenation symbol. In the above implementation, generating the authorization key using the aforementioned key generation method makes subsequent data re-encrypted using the authorization key more difficult to crack.
[0013] Secondly, this application provides a data sharing method applied to a blockchain node, comprising: receiving an on-chain transaction request from a data provider, the on-chain transaction request including the address of the data provider; assigning a file identifier and at least one storage node to the data provider according to the address; feeding back the file identifier and the storage node identifier to the data provider; receiving the storage address of fragmented ciphertext and key ciphertext and the file identifier sent by the at least one storage node; wherein the fragmented ciphertext is obtained by the data provider encrypting the shared data and then fragmenting it before uploading the data to the blockchain; the key ciphertext is obtained by the data provider encrypting a symmetric key; the symmetric key is used to encrypt the shared data; and for each storage node, storing the storage address of the fragmented ciphertext and the key ciphertext according to the file identifier.
[0014] In the above implementation process, by receiving and responding to on-chain transaction requests, the blockchain can quickly obtain on-chain transaction information from data providers and enable them to complete on-chain data storage based on the storage node identifier. By receiving and storing the storage addresses and file identifiers of fragmented ciphertext and key ciphertext, blockchain nodes can obtain the storage information of fragmented ciphertext and key ciphertext and publicly share data transaction information with users, facilitating data sharing.
[0015] Further, the step of assigning a file identifier and storage node to the data provider based on the address includes: obtaining the storage node identifier of at least one storage node closest to the data provider based on the address of the data provider; assigning a file identifier according to a preset rule; the file identifier is used to identify the shared data uploaded by the data provider to the at least one storage node.
[0016] In the above implementation process, by obtaining the storage node identifier of at least one storage node closest to the data provider, the transmission of encrypted content can be made more efficient. When the storage nodes are not unique, the encrypted content can be redundantly stored, preventing data sharing from being impossible when a single storage node fails, thus improving the stability of data sharing.
[0017] Further, obtaining the storage node identifier of at least one storage node closest to the data provider includes: sending a connectivity test request to all storage nodes, the request including the address of the data provider; receiving round-trip times sent by all storage nodes; the round-trip time being the round-trip time of a test message between nodes obtained by each storage node through sending a connectivity test command to the data provider; the connectivity test command sending a test message to the data provider; and filtering out the storage node identifier of at least one storage node with the smallest round-trip time from the round-trip times as the storage node information.
[0018] In the above implementation process, the blockchain node obtains the round-trip time by collecting the connectivity test instructions sent by the storage node and selects the shortest time method, which can quickly and effectively determine the storage node that is closest to the data provider or has the best network transmission performance.
[0019] Thirdly, this application discloses a data sharing method applied to a storage node, comprising: receiving a proxy re-encryption request sent by a data provider, the proxy re-encryption request including an authorization key, a file identifier, and a data requester identifier; obtaining the key ciphertext according to the file identifier, and performing proxy re-encryption on the key ciphertext using the authorization key to obtain a re-encrypted key ciphertext; storing the re-encrypted key ciphertext according to the file identifier; and sending an access permission update request to a blockchain node, the access permission update request including the file identifier, the data requester identifier, and the storage address of the re-encrypted key ciphertext, wherein the blockchain node stores an access permission table for the key ciphertext, and the access permission table is used to control the display of downloadable data to users with access permissions.
[0020] In the above implementation process, by combining the storage node and the semi-trusted proxy node into a pair of key ciphertexts for proxy re-encryption, compared with the existing technology of separating the storage node and the semi-trusted proxy node, the transmission time of data interaction between nodes can be saved and the proxy re-encryption efficiency can be improved. By sending the storage address of the re-encryption key ciphertext and the public key of the data requester to the blockchain node, the blockchain node can be informed of the data access information and notified to perform data access permission control.
[0021] Further, the step of using the authorized key to perform proxy re-encryption on the key ciphertext corresponding to the file identifier to obtain the re-encrypted key ciphertext includes: calculating the proxy re-encryption according to the proxy re-encryption formulas RC1'=C1, RC2'=C 2* e(C1, Rk3), RC3' = Rk1, RC4' = Rk2 perform proxy re-encryption on the key ciphertext corresponding to the file identifier to obtain the re-encrypted key ciphertext C. rfk =RC1'||RC2'||RC3'||RC4'. Where C1 and C2 are components of the key ciphertext, Rk1 and Rk2 are components of the authorization key, and C... rfk RC1', RC2', RC3', and RC4' are the ciphertext of the re-encryption key obtained by concatenation.
[0022] In the above implementation process, by using proxy re-encryption to obtain the re-encryption key ciphertext, the key ciphertext can be converted into re-encryption key ciphertext that can be decrypted by the private key of the data requester without exposing the key ciphertext content of the data provider, thereby improving the security of the data sharing process.
[0023] Fourthly, this application provides a data sharing method applied to a data requester, comprising: obtaining the ownership information of the requested data from the access permission table of a blockchain node, wherein the ownership information includes the information of the data provider, the storage node identifier, and the storage address; and downloading the requested data to the corresponding storage node according to the storage node identifier and the storage address.
[0024] In the above implementation process, by obtaining the ownership information of the requested data from the access permission table of the blockchain node, the requested data can be downloaded quickly and accurately based on the ownership information.
[0025] Further, the step of downloading the requested data to the corresponding storage node according to the storage node identifier and the storage address includes: sending a data download request to the corresponding storage node according to the storage node identifier, the request including the storage address; receiving the re-encryption key ciphertext and fragmented ciphertext sent by the storage node; decrypting the re-encryption key ciphertext according to one's own private key to obtain a symmetric key; reconstructing the fragmented ciphertext; and decrypting the reconstructed fragmented ciphertext according to the symmetric key to obtain plaintext data.
[0026] In the above implementation process, the re-encryption key ciphertext and fragmented ciphertext can be obtained simply and quickly through message sending and receiving. The re-encryption key ciphertext can be decrypted using one's own private key to accurately obtain the symmetric key. The plaintext data can be accurately obtained by reconstructing the fragmented ciphertext and decrypting the reconstructed fragmented ciphertext based on the symmetric key. Attached Figure Description
[0027] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a schematic diagram of the data sharing method provided in Embodiment 1 of this application;
[0029] Figure 2 This is a schematic diagram of the data sharing method provided in Embodiment 2 of this application;
[0030] Figure 3 This is a schematic flowchart of the data sharing method provided in Embodiment 3 of this application;
[0031] Figure 4 This is a schematic diagram of the data sharing device structure provided in Embodiment 4 of this application;
[0032] Figure 5 This is a schematic diagram of the data sharing device structure provided in Embodiment 5 of this application;
[0033] Figure 6 This is a schematic diagram of the data sharing device structure provided in Embodiment Six of this application;
[0034] Figure 7 This is a schematic diagram of the data sharing device structure provided in Embodiment 7 of this application;
[0035] Figure 8 This is a schematic diagram of the electronic device structure provided in Embodiment 8 of this application. Detailed Implementation
[0036] To better understand the technical solution of this application, the prior art is introduced below.
[0037] Current technologies for data sharing typically involve uploading data in plaintext to the storage devices of cloud storage providers, who then encrypt and store it, uploading the storage address to a blockchain node for users to download. Users obtain a download link from the blockchain node, download the required data from the cloud storage provider's storage device using that address, and decrypt the data using a password provided by the cloud storage provider.
[0038] Because the data in this data-sharing method is controlled by the cloud storage provider, they can easily tamper with and actively spread the data, causing data leaks and seriously threatening the security of shared data. Therefore, through creative research, the inventors have granted encryption permissions to the data provider. This prevents storage nodes from monitoring and tampering with the data content, uses ordinary third-party storage nodes for data storage, prevents cloud storage providers from having excessive data oversight authority, and leverages the distributed nature of blockchain to prevent on-chain data from being tampered with, thus ensuring the security of shared data.
[0039] The application scenarios of the data sharing method provided in this application are described in detail below.
[0040] This application can be applied to online / offline data sharing scenarios. Specifically, the network architecture of this application's technical solution includes storage nodes and a data provider. A communication connection exists between the storage nodes and the data provider. The data provider uses a symmetric key to encrypt and fragment the shared data, obtaining fragmented ciphertext, and then encrypts the symmetric key to obtain key ciphertext. The fragmented ciphertext and key ciphertext are then stored on the storage node.
[0041] For example, if user A wants to share file B on a blockchain network, they first generate a symmetric key and use it to encrypt file B. To improve the security and transmission efficiency of encrypted file B, the encrypted file B is fragmented, resulting in fragmented ciphertext. After file B is shared, it needs the symmetric key for decryption. Therefore, user A needs to provide this symmetric key when sharing data. However, to ensure the security of the symmetric key during transmission, it needs to be encrypted. Therefore, user A uses the public key from the public-private key pair generated by the blockchain system's key generator to encrypt the symmetric key, obtaining key ciphertext. User A then uploads the fragmented ciphertext and the key ciphertext to at least one storage node to achieve data sharing.
[0042] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0043] Example 1
[0044] This application provides a data sharing method, such as... Figure 1 As shown, this embodiment describes the data on-chain process of a data sharing method. This method is applied to a data provider and includes:
[0045] S101. Generate a symmetric key and key pair.
[0046] Specifically, a blockchain system has a key generator responsible for generating public and private key pairs for all nodes. The algorithm used to generate these key pairs is not specifically limited. The symmetric key is generated by the data provider.
[0047] Before this, the system's key generator will first perform an initialization operation.
[0048] Specifically, G1 and Gt are defined as cyclic groups of order q for large prime numbers, where G1 is an additive cyclic group and Gt is a multiplicative cyclic group.
[0049] 1. Define G1×G1->Gt as a bilinear mapping and g as a generator of G1.
[0050] 2. Construct two collision-resistant hash functions H0 and H1 that satisfy the following conditions:
[0051] H0 = {0, 1} * ->G1
[0052] H1=Gt->G1
[0053] Where {0,1} * G1 is a string of numbers of arbitrary length consisting of 0s and 1s. In a computer, G1 represents any value, and "->" represents a mapping relationship. H0 is the hash function that maps any value to G1, and H1 is the hash function that maps Gt to G1.
[0054] 3. Select a random number s that satisfies s∈Z q * Z serves as the master key for the key generator and is kept secret by the key generator. q * q is the set of natural prime numbers, which are positive integers that are relatively prime to q and range from 1 to q-1.
[0055] The following parameters will be made public on the blockchain network:
[0056] PP = {G1, H0, H1, g, g} s}
[0057] Among them, g s This refers to the s-th dot product of g, where s is the random number s from step 3 above.
[0058] After the initialization process is complete, blockchain users register accounts and connect their nodes to the blockchain system.
[0059] Specifically, the user node sends its own identity identifier as its registration public key to the key generator. The key generator hashes the user's registration public key to generate a user private key, which is then sent to the user node through a secure channel. The user's identity identifier is not specifically limited; it can be their own IP address combined with the user node's blockchain public key, which is also pre-generated by the key generator. The user private key generation algorithm can be expressed as:
[0060] sk A =H0(ID) A ) s
[0061] Among them, ID A H0 is the identifier of the data provider, and H0 is the hash function. s is the random number s from step 3 of the aforementioned system initialization process.
[0062] S102. Encrypt the file content using a symmetric key to obtain the ciphertext content.
[0063] Specifically, the data to be uploaded to the blockchain is encrypted using a symmetric key generated by the data provider, resulting in ciphertext. The encryption algorithm is not limited and can be any symmetric encryption algorithm. For example, the Data Encryption Standard (DES) algorithm can be used to encrypt the data to be uploaded to the blockchain.
[0064] S103. Use the public key in the key pair to encrypt the symmetric key to obtain the key ciphertext.
[0065] Specifically, the symmetric key is encrypted using the data provider's public key to obtain the ciphertext. The encryption algorithm is not specifically limited and can be any asymmetric encryption algorithm.
[0066] In one feasible implementation, the symmetric key is encrypted using the data provider's public key to obtain the ciphertext key. The specific process is as follows:
[0067] Let the symmetric key be M = ek, and choose a random number r such that r ∈ Z. q * The encryption calculation is performed according to the following formula:
[0068]
[0069] Among them, g r Represents the r-th dot product of g. e represents the bilinear mapping function, e(g) s H0(ID) A )) r Indicated by g s and hash function H0(ID) A The parameter ) is used to perform a bilinear mapping, and the mapping result is multiplied r times. || represents character concatenation, where C1 and C2 are intermediate values, and C... FK This is the final key ciphertext.
[0070] S104. The encrypted content is fragmented to obtain fragmented encrypted content.
[0071] Specifically, the encrypted content is divided into fragments of N bytes each, with the size of the last fragment being less than or equal to N. Here, N is a positive integer.
[0072] S105. Upload the fragmented ciphertext and the key ciphertext to at least one storage node.
[0073] Specifically, there are no specific restrictions on how the data provider uploads the ciphertext fragments and key ciphertext to the storage node.
[0074] In one feasible implementation, step S105, uploading the fragmented ciphertext and the key ciphertext to at least one storage node, includes:
[0075] S201. Send an on-chain transaction request to the blockchain node.
[0076] S202. Receive the response information for the transaction request. The response information includes the file identifier and the storage node identifier of at least one storage node.
[0077] S203. Send the fragmented ciphertext, key ciphertext, and file identifier to at least one storage node according to the storage node identifier.
[0078] Corresponding to step S105, when the data sharing method is applied to a blockchain node, the method includes:
[0079] S301. Receive the on-chain transaction request from the data provider, which includes the address of the data provider.
[0080] S302. Assign a file identifier and at least one storage node to the data provider based on the address.
[0081] S303. Feed back the file identifier and storage node identifier to the data provider.
[0082] S304. Receive the storage address and file identifier of the fragmented ciphertext and key ciphertext sent by at least one storage node. The fragmented ciphertext is obtained by the data provider encrypting the shared data and then fragmenting it before uploading the data to the blockchain. The key ciphertext is obtained by the data provider encrypting the symmetric key. The symmetric key is used to encrypt the shared data.
[0083] S305. For each storage node, store the storage address of the fragment ciphertext and key ciphertext according to the file identifier.
[0084] Specifically, in step S201, the data provider sends an on-chain transaction request to the blockchain node, with the request parameters including the data provider's address. After step S201, the blockchain node executes step S301, receiving the on-chain transaction request from the data provider and obtaining the data provider's address. Then, the blockchain node executes step S302. Since the blockchain node maintains a global on-chain transaction information table recording all shared file on-chain transaction information, the blockchain node sequentially generates a file identifier corresponding to the latest on-chain transaction request based on the allocated file identifiers, using this file identifier as the file identifier for the shared data in this on-chain transaction. Simultaneously, it assigns a storage node to the shared data in this on-chain transaction. When redundant storage is required for the shared data, the blockchain node assigns multiple storage nodes, and the method of assignment is not specifically limited. After the blockchain node assigns file identifiers and storage nodes to the shared data for this on-chain transaction, step S303 is executed, in which the file identifier and storage node identifier are fed back to the data provider via a message. Then, the data provider executes step S202, which involves receiving the blockchain node's response to the on-chain transaction request and extracting the file identifier and at least one storage node identifier from it. Next, the data provider executes step S203. Specifically, when the storage node identifier is unique, the data provider sends the fragmented ciphertext, key ciphertext, and file identifier to the corresponding storage node based on the storage node identifier. The fragmented ciphertext consists of N fragments, where N is a positive integer, and N fragments can form a complete ciphertext. When there are multiple storage node identifiers, for each storage node, the data provider sends a fragmented ciphertext with the same content, consisting of N fragments, the key ciphertext, and the file identifier. The storage node receives the fragmented ciphertext, key ciphertext, and corresponding file identifier from the data provider and stores them. It then sends the specific storage addresses of the fragmented ciphertext and key ciphertext to the blockchain node. The blockchain node executes step S304, which is to receive the storage addresses of the fragmented ciphertext and key ciphertext from the storage node, and executes step S305, which saves the storage addresses in the on-chain transaction information table.
[0085] In one feasible implementation, step S302, assigning a file identifier and at least one storage node to the data provider based on the address, includes:
[0086] a. Based on the address of the data provider, obtain the storage node identifier of at least one storage node closest to the data provider.
[0087] Specifically, there are no specific limitations on the method for obtaining the storage node closest to the data provider.
[0088] In one feasible implementation, step a, obtaining the storage node identifier of at least one storage node closest to the data provider, includes:
[0089] I. Send connectivity test requests to all storage nodes, including the address of the data provider. II. Receive round-trip times from all storage nodes. Round-trip time is the round-trip time of the test message between nodes obtained by each storage node through sending a connectivity test command to the data provider. The connectivity test command sends a test message to the data provider.
[0090] III. Select the storage node identifier of at least one storage node with the smallest round-trip time from the round-trip times and use it as the storage node identifier.
[0091] Specifically, in step I, the blockchain node sends a connectivity test request to all storage nodes, with the request parameters including the data provider's address. Upon receiving the connectivity test request, the storage node retrieves the data provider's address and sends a ping command to that address. This ping command sends ICMP (Independent Communication Management Protocol) messages to the data provider. The ping command tests the network connectivity between the storage node and the data provider by detecting the round-trip time (RTT) of the ICMP messages. The shorter the RTT, the better the network connectivity. The storage node then sends its RTT to the blockchain node. The blockchain node executes step II, receiving the RTTs from all storage nodes, and then executes step III, selecting the storage node identifier with the shortest RTT. When shared data requires redundant backup, the required number of storage nodes is determined based on the number of backups. The RTTs are then sorted in ascending order, and the same number of storage nodes as the number of backups are selected as the storage nodes for the shared data.
[0092] b. Assign file identifiers according to preset rules. File identifiers are used to identify shared data uploaded by the data provider to at least one storage node.
[0093] Specifically, each blockchain node maintains an on-chain transaction information table. This table assigns a file identifier for the shared data of each on-chain transaction request. This file identifier is generated sequentially based on existing file identifiers.
[0094] In the above implementation process, the data provider can quickly and efficiently notify the blockchain nodes to generate transaction information and allocate storage nodes by sending a request to share data on-chain. Simultaneously, the provider can publicly disclose the on-chain transaction information to users. Upon receiving the response information, the data provider can quickly and accurately obtain the file identifier and storage node identifier, and send the fragmented ciphertext and key ciphertext to at least one storage node based on the storage node identifier.
[0095] In the above implementation process, blockchain nodes can quickly obtain the on-chain transaction information of data providers by receiving and responding to on-chain transaction requests, and enable data providers to complete the on-chain storage of data based on the storage node identifier. By receiving and storing the storage addresses and file identifiers of fragmented ciphertext and key ciphertext, blockchain nodes can know the storage information of fragmented ciphertext and key ciphertext and publicly share data transaction information with users, facilitating data sharing.
[0096] Furthermore, by obtaining the storage node identifier of at least one storage node closest to the data provider, blockchain nodes can achieve redundant storage of encrypted content. This prevents data sharing from being disrupted in the event of a single storage node failure, thus improving the stability of data sharing. Moreover, because the storage node is closest to the data provider, the transmission of encrypted content is more efficient.
[0097] Furthermore, by collecting the round-trip time obtained from the connectivity test commands sent by the storage nodes and filtering out the shortest time, blockchain nodes can quickly and effectively determine the storage node that is closest to the data provider or has the best network transmission performance.
[0098] Example 2
[0099] Access control is a crucial component of data sharing. Once shared data is uploaded to the blockchain, access control is necessary to ensure its security. Only users with authorized access rights can retrieve and view information related to the shared data on the blockchain nodes. When a new user requests access authorization to the shared data, the access permissions need to be updated. This application provides a data sharing method, such as... Figure 2 As shown, this embodiment describes the access permission update process of a data sharing method. This method is applied to the data provider and further includes:
[0100] S401. Receive a data authorization request sent by a data requester. The data authorization request includes the data requester's request information and key ciphertext information. The requester information includes the data requester's identifier and public key. The key ciphertext information includes the file identifier and storage node identifier.
[0101] S402. Generate an authorization key based on the public key and your own private key.
[0102] S403. Send a proxy re-encryption request to the corresponding storage node based on the storage node identifier in the key ciphertext information. The proxy re-encryption request includes the authorization key, file identifier, and identifier of the data requester.
[0103] Correspondingly, the data sharing methods on the storage node side include:
[0104] S501. Receive a proxy re-encryption request sent by the data provider. The proxy re-encryption request includes an authorization key, a file identifier, and a data requester identifier.
[0105] S502. Obtain the key ciphertext based on the file identifier, and use the authorized key to perform proxy re-encryption on the key ciphertext to obtain the re-encrypted key ciphertext.
[0106] S503. Store the re-encryption key ciphertext according to the file identifier.
[0107] S504. Send an access permission update request to the blockchain node. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node stores an access permission table for the shared data corresponding to the file identifier. The access permission table is used to control the display of downloadable data to users with access permissions.
[0108] Specifically, the data requester queries the blockchain for information about the data owner, including the data provider's information and the storage node identifier. The data provider's information can include an IP address, contact information, etc.
[0109] Optionally, the data requester negotiates with the data provider based on the data provider's information to request access to the data. The negotiation method is not specifically limited and is determined based on the data provider's information. For example, if the data provider's information is an IP address, a data access authorization request is sent to that IP address. If the data provider's information is a contact method, such as a mobile phone number or WeChat ID, access permission can be negotiated through that contact method. If the data provider agrees to the authorization, the data requester sends its request information and encrypted key information to the data provider. The requester information includes the data requester's identifier and public key. The encrypted key information includes a file identifier and a storage node identifier. The data provider sequentially executes steps S401, S402, and S403, receiving the request information and encrypted key information sent by the data requester. Based on the public key and its own private key in the request information, it generates an authorization key; the method for generating the authorization key is not specifically limited. Then, based on the storage node identifier in the encrypted key information, it sends a proxy re-encryption request to the corresponding storage node. The proxy re-encryption request includes the authorization key, the file identifier, and the data requester's identifier. When there are multiple storage node identifiers, a proxy re-encryption request is sent to the storage node corresponding to each storage node identifier.
[0110] In addition to the above-mentioned optional methods, the data requester can also send its request information and key ciphertext directly to the data provider without prior consultation. If the data provider agrees to the authorization, steps S402 and S403 are executed sequentially to generate an authorization key and send the data request information and key ciphertext to the storage node. Then, the storage node executes steps S501-S504 sequentially to receive a proxy re-encryption request sent by the data provider. The proxy re-encryption request includes the authorization key, file identifier, and data requester identifier. Since the storage node maintains a file storage table internally, which includes file identifiers and the names and storage addresses of the corresponding stored data, in this application, the stored data includes key ciphertext and fragmented ciphertext. The storage address of the key ciphertext is found in the table based on the file identifier. The key ciphertext is extracted from the storage address and re-encrypted using the authorization key generated by the data requester in the aforementioned steps, generating a re-encrypted key ciphertext. The re-encryption algorithm is not specifically limited. The storage node stores the re-encrypted key ciphertext and saves the storage address in the corresponding file identifier field of the file storage table. Then, the storage node sends an access permission update request to the blockchain node. This request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node receives this request, extracts the data requester identifier and the storage address of the re-encryption key ciphertext, and saves this information to the corresponding file identifier in its internally maintained access permission table. At this point, the blockchain node has completed the data access permission update. The data requester can now see the desired data and the storage address of the re-encryption key ciphertext in the blockchain node's access permission table.
[0111] In one feasible implementation, step S402, generating an authorization key based on the public key and the user's private key, includes:
[0112] Based on the public key of the data requester, your own private key, and the authorization key, the formula Rk1 = g r’ Rk2=X*e(g s H0(ID) B )) r’ Rk3 = sk A -1 *H1(X), Rekey A->B = (Rk1||Rk2||Rk3), generate the authorization key, where g is a generator of G1, r' is a random number, and g r’ The r'th dot product of g, g s For the s-th dot product of g, ID B H0(ID) is the public key of the data requester. B ) is used to perform a hash operation on the public key of the data requester, e(g sH0(ID) B )) r’ For g s and H0(ID) B A bilinear mapping is performed on the parameter , and the mapping result is multiplied r' times. X is a random number, H1(X) is the hash operation performed on X, and sk A -1 The key is the reciprocal of the data provider's private key, where Rk1, Rk2, and Rk3 are intermediate values. A->B The authorization key is obtained by concatenating Rk1, Rk2, and Rk3, where "||" is a character concatenation symbol.
[0113] Specifically, the data provider generates an authorization key using its own private key and the data requester's public key, according to the formula described above.
[0114] In one feasible implementation, step S502 uses the authorized key to perform proxy re-encryption on the key ciphertext corresponding to the file identifier, obtaining the re-encrypted key ciphertext, including:
[0115] According to the proxy re-encryption calculation formula, RC1' = C1, RC2' = C 2* e(C1, Rk3), RC3' = Rk1, RC4' = Rk2 perform proxy re-encryption on the key ciphertext corresponding to the file identifier to obtain the re-encrypted key ciphertext C. rfk =RC1'||RC2'||RC3'||RC4'. Where C1 and C2 are components of the key ciphertext, Rk1 and Rk2 are components of the authorization key, and C... rfk RC1', RC2', RC3', and RC4' are the ciphertext of the re-encryption key obtained by concatenation.
[0116] Specifically, the storage node also acts as a semi-trusted proxy node, using the above formula to perform proxy re-encryption on the key ciphertext to obtain the re-encrypted key ciphertext.
[0117] In the above implementation process, the data provider generates an authorization key and sends a proxy re-encryption request to the storage node, which enables the storage node to authorize access to the data requester without knowing the data provider's private key, thus ensuring the security of the data provider's private key.
[0118] In the above implementation process, by combining the storage node and the semi-trusted proxy node into a pair of key ciphertexts for proxy re-encryption, compared with the existing technology of separating the storage node and the semi-trusted proxy node, the transmission time of data interaction between nodes can be saved and the proxy re-encryption efficiency can be improved. By sending the storage address of the re-encryption key ciphertext and the public key of the data requester to the blockchain node, the blockchain node can be informed of the data access information and notified to perform data access permission control.
[0119] Furthermore, the data provider can accurately generate the authorization key using the key generation formula.
[0120] Furthermore, the storage node obtains a re-encrypted key ciphertext by proxying the key ciphertext. This allows the key ciphertext to be converted into a re-encrypted key ciphertext that can be decrypted by the private key of the data requester without exposing the content of the key ciphertext of the data provider, thereby improving the security of the data sharing process.
[0121] Example 3
[0122] Once a data requester obtains access to the shared data, they can download the data based on the relevant information retrieved from the blockchain node. This application provides a data sharing method, such as... Figure 3 As shown, this embodiment describes the data download process of a data sharing method. The method is applied to the data requester and includes:
[0123] S601. Obtain the ownership information of the requested data from the access permission table of the blockchain node. The ownership information includes the information of the data provider, the storage node identifier, and the storage address.
[0124] S602. Download the requested data to the corresponding storage node based on the storage node identifier and storage address.
[0125] The information regarding the data provider to be requested is not specifically limited and can include the data provider's IP address, contact information, etc. When the requested data is stored redundantly, multiple storage nodes are identified.
[0126] Specifically, the access permission table on the blockchain node is public to users, but only users with access permissions can see the ownership information of the corresponding shared data and authorization keys. Users with access permissions retrieve the ownership information of the data to be requested from the access permission table of the blockchain node. Users select a storage node identifier from the ownership information and download the data to be requested from the corresponding storage node. The download method is not specifically limited.
[0127] In one feasible implementation, step S602, downloading the requested data to the corresponding storage node according to the storage node identifier and storage address, includes:
[0128] i. Send a data download request to the corresponding storage node based on the storage node identifier. The request includes the storage address.
[0129] ii. Receive the re-encryption key ciphertext and fragment ciphertext sent by the storage node.
[0130] iii. Decrypt the re-encrypted key ciphertext using your own private key to obtain the symmetric key.
[0131] iv. Reconstruct the fragmented ciphertext, and decrypt the reconstructed fragmented ciphertext using the symmetric key to obtain the plaintext data.
[0132] Specifically, the data requester sends a data download request to the corresponding storage node based on the selected storage node identifier, using the storage address of the requested data as the request parameter. The storage node receives the data download request, extracts the storage address of the requested data, and extracts the corresponding fragment ciphertext and re-encryption key ciphertext based on the file identifier corresponding to the storage address. The node then sends the fragment ciphertext and re-encryption key ciphertext to the data requester.
[0133] The data requester receives the re-encryption key ciphertext and fragment ciphertext sent by the storage node. It then decrypts the re-encryption key ciphertext using its own private key to obtain the symmetric key. Specifically, the data requester uses its private key to decrypt the re-encryption key ciphertext using the following formula to obtain the symmetric key. The decryption formula can be expressed as:
[0134]
[0135] Among them, RC′4, RC′3, and RC′1 are intermediate data generated by the storage node when performing proxy re-encryption on the key ciphertext, sk B Let M be the private key of the data requester, and e be a bilinear mapping function. H1(M1) is the hash operation performed on M1. M is the final symmetric key obtained through decryption.
[0136] After the data requester decrypts and obtains the symmetric key, it reassembles multiple fragments into a complete ciphertext based on the fragment identifiers in the fragmented ciphertext. For example, the fragmented ciphertext has the following fragment identifiers: 101001, 101003, 101002, and 101004. Based on the size of the fragment identifiers, the fragments are sorted in order, resulting in a fragment group numbered 101001, 101002, 101003, and 101004. All fragments are then sorted and reassembled using the method described above to obtain the ciphertext.
[0137] After obtaining the ciphertext content, the data requester uses a symmetric key to decrypt the ciphertext content, obtaining the plaintext data. The algorithm used to decrypt the ciphertext content with the symmetric key is not limited, but it must be compatible with the encryption algorithm of the symmetric key.
[0138] In the above implementation process, by obtaining the ownership information of the requested data from the access permission table of the blockchain node, the requested data can be downloaded quickly and accurately based on the ownership information.
[0139] Furthermore, by sending and receiving messages, the re-encryption key ciphertext and fragmented ciphertext can be obtained quickly and easily. By decrypting the re-encryption key ciphertext with one's own private key, the symmetric key can be accurately obtained. By reconstructing the fragmented ciphertext and decrypting the reconstructed fragmented ciphertext with the symmetric key, the plaintext data can be accurately obtained.
[0140] Example 4
[0141] This application provides a data sharing device 700, such as... Figure 4 As shown, the device is applied to the data provider and includes a first key generation module 701, a first encryption module 702, a fragmentation module 703, and a first sending module 704.
[0142] The first key generation module 701 is used to generate symmetric keys and key pairs.
[0143] The first encryption module 702 is used to encrypt the file content using a symmetric key to obtain the ciphertext content. It is also used to encrypt the symmetric key using the public key of the key pair to obtain the ciphertext key.
[0144] The fragmentation module 703 is used to fragment the ciphertext content to obtain fragmented ciphertext.
[0145] The first sending module 704 is used to upload the fragmented ciphertext and the key ciphertext to at least one storage node.
[0146] The first sending module 704 is specifically used to send on-chain transaction requests to blockchain nodes. It receives response information for the transaction request, which includes a file identifier and the storage node identifier of at least one storage node. Based on the storage node identifier, it sends the fragment ciphertext, key ciphertext, and file identifier to at least one storage node.
[0147] The data sharing device 700 is also used to receive data authorization requests sent by data requesters. The data authorization request includes the requester's request information and key ciphertext information. The requester information includes the requester's identifier and public key. The key ciphertext information includes a file identifier and a storage node identifier. An authorization key is generated based on the public key and the device's own private key. A proxy re-encryption request is sent to the corresponding storage node based on the storage node identifier in the key ciphertext information. The proxy re-encryption request includes the authorization key, the file identifier, and the data requester's identifier.
[0148] The data sharing device 700 is specifically used to share data based on the public key of the data requester, its own private key, and the authorization key, using the formula Rk1 = g. r’ Rk2=X*e(g s H0(ID) B )) r’ Rk3 = sk A -1 *H1(X), Rekey A->B = (Rk1||Rk2||Rk3), generate the authorization key, where g is a generator of G1, r' is a random number, and g r’ The r'th dot product of g, g s For the s-th dot product of g, ID B H0(ID) is the public key of the data requester. B To perform a hash operation on the public key of the data requester, e(g) s H0(ID) B )) r’ For g s and H0(ID) B A bilinear mapping is performed on the parameter , and the mapping result is multiplied r' times. X is a random number, H1(X) is the hash operation performed on X, and sk A -1 The Rekey is the reciprocal of the data provider's private key, with Rk1, Rk2, and Rk3 being intermediate values. A->B The authorization key is obtained by concatenating Rk1, Rk2, and Rk3. The "||" symbol is the character concatenation symbol.
[0149] The parts not described in detail in this application are referred to the descriptions of the data sharing methods in Embodiments 1 to 3, and will not be repeated here.
[0150] Example 5
[0151] This application provides a data sharing device 800, such as... Figure 5 As shown, the device is applied to a blockchain node and includes a first receiving module 801, an allocation module 802, a second receiving module 803, and a first storage module 804.
[0152] The first receiving module 801 is used to receive on-chain transaction requests from data providers, and the on-chain transaction requests include the address of the data provider.
[0153] The allocation module 802 is used to allocate a file identifier and at least one storage node to the data provider based on the data provider's address.
[0154] The second receiving module 803 is used to receive the storage address and file identifier of the fragmented ciphertext and key ciphertext sent by at least one storage node. The fragmented ciphertext is obtained by the data provider encrypting the shared data and then fragmenting it before uploading the data to the blockchain. The key ciphertext is obtained by the data provider encrypting the symmetric key. The symmetric key is used to encrypt the shared data.
[0155] The first storage module 804 is used to store the storage address of the fragmented ciphertext and the key ciphertext according to the file identifier for each storage node.
[0156] The allocation module 802 is specifically used to obtain the storage node identifier of at least one storage node closest to the data provider based on the data provider's address. It then allocates file identifiers according to preset rules. The file identifiers are used to identify shared data uploaded by the data provider to at least one storage node.
[0157] The allocation module 802 is specifically used to send connectivity test requests to all storage nodes, including the address of the data provider. It receives round-trip times from all storage nodes. The round-trip time is the round-trip time of the test message between nodes obtained by each storage node through sending a connectivity test command to the data provider. The connectivity test command sends a test message to the data provider. The module then selects the storage node identifier of at least one storage node with the smallest round-trip time from the round-trip times and uses it as the storage node identifier.
[0158] The parts not described in detail in this application are referred to the descriptions of the data sharing methods in Embodiments 1 to 3, and will not be repeated here.
[0159] Example 6
[0160] This application provides a data sharing device 900, such as... Figure 6 As shown, the device is applied to a storage node and includes a third receiving module 901, a re-encryption key generation module 902, a second storage module 903, and a second sending module 904.
[0161] The third receiving module 901 is used to receive a proxy re-encryption request sent by the data provider. The proxy re-encryption request includes an authorization key, a file identifier, and a data requester identifier.
[0162] The re-encryption key generation module 902 is used to obtain the key ciphertext based on the file identifier, and to perform proxy re-encryption on the key ciphertext using the authorized key to obtain the re-encryption key ciphertext.
[0163] The second storage module 903 is used to store the re-encryption key ciphertext according to the file identifier.
[0164] The second sending module 904 is used to send an access permission update request to the blockchain node. The access permission update request includes a file identifier, a data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node stores the access permission information of the key ciphertext.
[0165] The re-encryption key generation module 902 is specifically used to calculate the re-encryption key according to the proxy re-encryption formula RC1'=C1, RC2'=C 2* e(C1, Rk3), RC3' = Rk1, RC4' = Rk2 perform proxy re-encryption on the key ciphertext corresponding to the file identifier to obtain the re-encrypted key ciphertext C. rfk =RC1'||RC2'||RC3'||RC4'. Where C1 and C2 are components of the key ciphertext, Rk1 and Rk2 are components of the authorization key, and C... rfk RC1', RC2', RC3', and RC4' are the ciphertext of the re-encryption key obtained by concatenation.
[0166] The parts not described in detail in this application are referred to the descriptions of the data sharing methods in Embodiments 1 to 3, and will not be repeated here.
[0167] Example 7
[0168] This application provides a data sharing device 1000, such as... Figure 7 As shown, the device is applied to the data requester and includes an acquisition module 1001 and a download module 1002.
[0169] The acquisition module 1001 is used to obtain the ownership information of the requested data from the access permission table of the blockchain node. The ownership information includes the information of the data provider, the storage node identifier, and the storage address.
[0170] Download module 1002 is used to download the requested data to the corresponding storage node based on the storage node identifier and storage address.
[0171] The download module 1002 is specifically used to send a data download request to the corresponding storage node based on the storage node identifier. The request includes the storage address. It receives the re-encryption key ciphertext and fragmented ciphertext sent by the storage node. It decrypts the re-encryption key ciphertext using its own private key to obtain the symmetric key. It reassembles the fragmented ciphertext and decrypts the reassembled fragmented ciphertext using the symmetric key to obtain the plaintext data.
[0172] The parts not described in detail in this application are referred to the descriptions of the data sharing methods in Embodiments 1 to 3, and will not be repeated here.
[0173] Example 8
[0174] This application provides an electronic device 1100, such as... Figure 8 As shown, it includes a processor 1101 and a memory 1002. The processor 1101 is used to execute a program stored in the memory 1102 to implement the data sharing method as described in any one of Embodiments 1 to 3.
[0175] Understandable. Figure 8 The structure shown is for illustrative purposes only; the electronic device may also include components that are more advanced than those shown. Figure 8 The more or fewer components shown, or having the same Figure 8 The different configurations shown.
[0176] For example, the processor 1101 and the memory 1102 may be connected via a communication bus. As another example, the electronic device may also include components such as a display, mouse, and keyboard.
[0177] In this embodiment, the processor 1101 can be a central processing unit, a microprocessor, a microcontroller, etc., but this is not a limitation. The memory 1102 can be a random access memory, a read-only memory, a programmable read-only memory, an erasable read-only memory, an electrically erasable read-only memory, etc., but this is not a limitation.
[0178] In the embodiments of this application, the electronic device can be, but is not limited to, physical devices such as desktop computers, laptops, smartphones, smart wearable devices, and in-vehicle devices, or virtual devices such as virtual machines. Furthermore, the electronic device is not necessarily a single device; it can be a combination of multiple devices, such as a server cluster, etc.
[0179] This embodiment also provides a computer-readable storage medium, such as a floppy disk, optical disk, hard disk, flash memory, USB flash drive, SD (Secure Digital Memory Card), MMC (Multimedia Card), etc., in which one or more programs implementing the above steps are stored. These one or more programs can be executed by one or more processors to implement the data sharing methods described in Embodiments 1 to 3. Further details will not be elaborated here.
[0180] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0181] In the various embodiments of this application, the functional modules can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0182] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.
[0183] In this article, "multiple" refers to two or more.
[0184] The above are merely embodiments of this application and are not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A data sharing method, characterized in that, Applied to data providers, the method includes: Generate symmetric keys and key pairs; The file content is encrypted using the symmetric key to obtain the ciphertext content; The symmetric key is encrypted using the public key in the key pair to obtain the key ciphertext. The encrypted content is fragmented to obtain fragmented encrypted content; The fragmented ciphertext and the key ciphertext are uploaded to at least one storage node; The step of uploading the fragmented ciphertext and the key ciphertext to at least one storage node includes: Send an on-chain transaction request to the blockchain node; The response information received from the transaction request includes a file identifier and a storage node identifier of the at least one storage node; When the storage node identifier is unique, the fragmented ciphertext, the key ciphertext, and the file identifier are sent to the corresponding storage node according to the storage node identifier, and the fragmented ciphertext consists of N fragments; when there are multiple storage node identifiers, for each storage node, a fragmented ciphertext, the key ciphertext, and the file identifier with the same content and N fragments are sent to the other party; where N is a positive integer, and the content ciphertext is composed of N fragments; The method further includes: The system receives a data authorization request from a data requester, the data authorization request including the requester's request information and key ciphertext information; the request information includes the data requester's identifier and public key; the key ciphertext information includes a file identifier and a storage node identifier; Generate an authorization key based on the public key and your own private key; Based on the storage node identifier in the key ciphertext information, a proxy re-encryption request is sent to the corresponding storage node. Upon receiving the proxy re-encryption request, the storage node sends an access permission update request to the blockchain node. This allows the data requester to see the storage address of the data to be accessed and the re-encryption key ciphertext from the access permission table, and also allows the data requester to obtain the owner information of the requested data from the access permission table, and download the requested data from the corresponding storage node based on the storage node identifier and storage address. The proxy re-encryption request includes the authorization key, the file identifier, and the data requester identifier. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The re-encryption key ciphertext is obtained based on the file identifier and the authorization key. The blockchain node stores an access permission table for the shared data corresponding to the file identifier. The access permission update request is used to update the access permission table. The access permission table is used to control the display of downloadable data to users with access permissions. The blockchain node is configured to save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table according to the access permission update request. The ownership information includes the information of the data provider to be requested, the storage node identifier, and the storage address.
2. The data sharing method as described in claim 1, characterized in that, The step of generating an authorization key based on the public key and one's own private key includes: Based on the public key of the data requester, your own private key, and the authorization key, the formula Rk1=g r’ Rk2=X*e(g s H0(ID) B )) r’ Rk3=sk A -1 * H1(X), Rekey A->B =( Rk1|| Rk2|| Rk3), generate the authorization key, where g is a generator of G1, r' is a random number, and g r’ The r'th dot product of g, g s For the s-th dot product of g, ID B H0 (ID) is the public key of the data requester. B ) is used to perform a hash operation on the public key of the data requester, e(g s H0(ID) B )) r’ For g s and H0(ID) B A bilinear mapping is performed on the parameter , and the mapping result is multiplied r' times. X is a random number, H1(X) is the hash operation performed on X, and sk A -1 The key is the reciprocal of the data provider's private key, where Rk1, Rk2, and Rk3 are intermediate values. A->B The authorization key is obtained by concatenating Rk1, Rk2, and Rk3, where the "||" symbol is a character concatenation symbol.
3. A data sharing method, characterized in that, Applied to blockchain nodes, the method includes: Receive on-chain transaction requests from data providers, wherein the on-chain transaction requests include the address of the data providers; Based on the address, assign a file identifier and at least one storage node to the data provider; The file identifier and the storage node identifier are fed back to the data provider; The system receives the storage address of the fragmented ciphertext and the key ciphertext, and the file identifier sent by at least one storage node; the fragmented ciphertext is obtained by the data provider encrypting the shared data before uploading it to the blockchain and then fragmenting it; the key ciphertext is obtained by the data provider encrypting the symmetric key; the symmetric key is used to encrypt the shared data; the fragmented ciphertext consists of N fragments, where N is a positive integer, and the content ciphertext is composed of N fragments. For each storage node, the storage address of the fragmented ciphertext and the key ciphertext is stored according to the file identifier; The method further includes: Receive access permission update requests from storage nodes; According to the access permission update request, the access permission table of the shared data corresponding to the file identifier stored in the blockchain node is updated so that the data requester can see the storage address of the data to be accessed and the re-encryption key ciphertext from the access permission table, and the data requester can obtain the owner information of the data to be requested from the access permission table, and download the data to be requested to the corresponding storage node according to the storage node identifier and storage address. The owner information includes the information of the data provider to be requested, the storage node identifier and the storage address. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node stores an access permission table for the shared data corresponding to the file identifier. The access permission update request is used to update the access permission table, which is used to control the display of downloadable data to users with access permissions. The blockchain node is configured to save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table according to the access permission update request.
4. The data sharing method as described in claim 3, characterized in that, The step of assigning a file identifier and at least one storage node to the data provider based on the address includes: Based on the address of the data provider, obtain the storage node identifier of at least one storage node closest to the data provider; File identifiers are assigned according to preset rules; the file identifiers are used to identify shared data uploaded by the data provider to the at least one storage node.
5. The data sharing method as described in claim 4, characterized in that, The step of obtaining the storage node identifier of at least one storage node closest to the data provider includes: Send connectivity test requests to all storage nodes, the requests including the address of the data provider; Receive round-trip times from all storage nodes; the round-trip time is the round-trip time of a test message between nodes obtained by each storage node through sending a connectivity test command to the data provider; the connectivity test command sends a test message to the data provider. The storage node identifier of at least one storage node with the smallest round-trip time is selected from the round-trip times and used as the storage node identifier.
6. A data sharing method, characterized in that, Applied to storage nodes, the method includes: Receive a proxy re-encryption request sent by the data provider, the proxy re-encryption request including an authorization key, a file identifier, and a data requester identifier; The key ciphertext is obtained based on the file identifier, and the key ciphertext is re-encrypted by proxy using the authorized key to obtain the re-encrypted key ciphertext. The re-encryption key ciphertext is stored according to the file identifier; An access permission update request is sent to a blockchain node. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node stores an access permission table for the shared data corresponding to the file identifier. The access permission update request is used to update the access permission table, which controls the display of downloadable data to users with access permissions. The blockchain node is configured to, based on the access permission update request, save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table. This allows the data requester to see the data to be accessed and the storage address of the re-encryption key ciphertext in the access permission table, and to obtain the owner information of the requested data from the access permission table. The data requester then downloads the requested data from the corresponding storage node based on the storage node identifier and storage address. The owner information includes the information of the data provider, the storage node identifier, and the storage address.
7. The data sharing method as described in claim 6, characterized in that, The step of using an authorized key to perform proxy re-encryption on the ciphertext corresponding to the file identifier to obtain the re-encrypted key ciphertext includes: According to the proxy re-encryption calculation formula RC1 ’ =C1,RC2 ’ =C 2* e(C1, Rk3), RC3 ’ =Rk1,RC4 ’ =Rk2 performs proxy re-encryption on the key ciphertext corresponding to the file identifier to obtain the re-encrypted key ciphertext C rfk = RC1 ’ || RC2 ’ || RC3 ’ || RC4 ’ Wherein, C1 and C2 are components of the key ciphertext, and Rk1 and Rk2 are components of the authorization key. rfk For RC1 ’ RC2 ’ RC3 ’ RC4 ’ This is the ciphertext of the re-encryption key obtained by concatenation.
8. A data sharing method, characterized in that, Applied to the data requester, the method includes: The access permission table of the blockchain node is used to obtain the ownership information of the requested data. The ownership information includes the information of the data provider, the storage node identifier, and the storage address. The access permission table is used to control the display of downloadable data to users with access permissions. The access permission table is updated according to the access permission update request sent by the storage node to the blockchain node. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node is configured to save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table according to the access permission update request. The data requester can see the data to be accessed and the storage address of the re-encryption key ciphertext from the access permission table. Download the requested data to the corresponding storage node based on the storage node identifier and the storage address.
9. The data sharing method as described in claim 8, characterized in that, The step of downloading the requested data to the corresponding storage node according to the storage node identifier and the storage address includes: A data download request is sent to the corresponding storage node based on the storage node identifier, and the request includes the storage address; Receive the re-encryption key ciphertext and fragmented ciphertext sent by the storage node; Decrypt the re-encrypted key ciphertext using your own private key to obtain the symmetric key; Reassemble the fragmented ciphertext, and decrypt the reassembled fragmented ciphertext using the symmetric key to obtain plaintext data.
10. A data sharing device, characterized in that, Applied to data providers, including: The first key generation module is used to generate symmetric keys and key pairs; The first encryption module is used to encrypt the file content using the symmetric key to obtain the ciphertext of the content; and to encrypt the symmetric key using the public key in the key pair to obtain the ciphertext of the key. The fragmentation module is used to fragment the encrypted content to obtain fragmented encrypted content; The first sending module is used to upload the fragmented ciphertext and the key ciphertext to at least one storage node; The first sending module is specifically used to send an on-chain transaction request to a blockchain node; receive response information for the transaction request, the response information including a file identifier and a storage node identifier of the at least one storage node; when the storage node identifier is unique, the ciphertext fragments, the key ciphertext, and the file identifier are sent to the corresponding storage node according to the storage node identifier, wherein the ciphertext fragments consist of N fragments; when there are multiple storage node identifiers, for each storage node, a ciphertext fragment with the same content, a key ciphertext, and a file identifier with N fragments is sent to the other party; wherein N is a positive integer, and the ciphertext content consists of N fragments; The data sharing device is further configured to receive a data authorization request sent by a data requester, the data authorization request including the requester's request information and key ciphertext information; the request information including the data requester's identifier and public key; the key ciphertext information including a file identifier and a storage node identifier; generate an authorization key based on the public key and its own private key; and send a proxy re-encryption request to the corresponding storage node based on the storage node identifier in the key ciphertext information, so that upon receiving the proxy re-encryption request, the storage node sends an access permission update request to the blockchain node, enabling the data requester to see the storage address of the data to be accessed and the re-encryption key ciphertext from the access permission table, and enabling the data requester to obtain the owner information of the requested data from the access permission table, and download the requested data from the corresponding storage node based on the storage node identifier and storage address. The request requests data; wherein, the proxy re-encryption request includes the authorization key, the file identifier, and the data requester identifier; the access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext; the re-encryption key ciphertext is obtained based on the file identifier and the authorization key; the blockchain node stores an access permission table for the shared data corresponding to the file identifier; the access permission update request is used to update the access permission table; the access permission table is used to control the display of downloadable data to users with access permissions; the blockchain node is configured to, based on the access permission update request, save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table; the ownership information includes the information of the data provider to be requested, the storage node identifier, and the storage address.
11. A data sharing device, characterized in that, Applied to blockchain nodes, including: The first receiving module is used to receive on-chain transaction requests from data providers, wherein the on-chain transaction requests include the address of the data provider; The allocation module is used to allocate a file identifier and at least one storage node to the data provider based on the data provider's address; The second receiving module is used to receive the storage address of the fragmented ciphertext and the key ciphertext and the file identifier sent by the at least one storage node; the fragmented ciphertext is obtained by the data provider encrypting the shared data and then fragmenting it before uploading the data to the blockchain; the key ciphertext is obtained by the data provider encrypting the symmetric key; the symmetric key is used to encrypt the shared data; the fragmented ciphertext consists of N fragments, where N is a positive integer, and the N fragments constitute the content ciphertext; The first storage module is used to store the storage address of the fragmented ciphertext and the key ciphertext according to the file identifier for each storage node; The data sharing device is further configured to receive access permission update requests from storage nodes; update the access permission table of the shared data corresponding to the file identifier stored in the blockchain node according to the access permission update request, so that the data requester can see the storage address of the data to be accessed and the re-encryption key ciphertext from the access permission table, and obtain the owner information of the data to be requested from the access permission table, and download the data to be requested from the corresponding storage node according to the storage node identifier and storage address, wherein the owner information includes the information of the data provider to be requested, the storage node identifier, and the storage address; wherein, the access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext, the blockchain node stores the access permission table of the shared data corresponding to the file identifier, the access permission update request is used to update the access permission table, the access permission table is used to control the display of downloadable data to users with access permissions, and the blockchain node is configured to save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table according to the access permission update request.
12. A data sharing device, characterized in that, Applied to storage nodes, including: The third receiving module is used to receive a proxy re-encryption request sent by the data provider. The proxy re-encryption request includes an authorization key, a file identifier, and a data requester identifier. The re-encryption key generation module is used to obtain the key ciphertext according to the file identifier, and to perform proxy re-encryption on the key ciphertext using the authorized key to obtain the re-encryption key ciphertext. The second storage module is used to store the re-encryption key ciphertext according to the file identifier; The second sending module is used to send an access permission update request to the blockchain node. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node stores an access permission table for the shared data corresponding to the file identifier. The access permission update request is used to update the access permission table. The access permission table is used to control the display of downloadable data to users with access permissions. The blockchain node is configured to, according to the access permission update request, save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table, so that the data requester can see the data to be accessed and the storage address of the re-encryption key ciphertext from the access permission table, and so that the data requester can obtain the owner information of the requested data from the access permission table, and download the requested data to the corresponding storage node according to the storage node identifier and storage address. The owner information includes the information of the data provider, the storage node identifier, and the storage address.
13. A data sharing device, characterized in that, Applied to the data requester, including: The acquisition module is used to obtain the ownership information of the requested data from the access permission table of the blockchain node. The ownership information includes the information of the data provider, the storage node identifier, and the storage address. The access permission table is used to control the display of downloadable data to users with access permissions. The access permission table is updated according to the access permission update request sent by the storage node to the blockchain node. The access permission update request includes the file identifier, the data requester identifier, and the storage address of the re-encryption key ciphertext. The blockchain node is configured to save the data requester identifier and the storage address of the re-encryption key ciphertext at the corresponding file identifier in the access permission table according to the access permission update request. The data requester can see the data to be accessed and the storage address of the re-encryption key ciphertext from the access permission table. The download module is used to download the requested data to the corresponding storage node according to the storage node identifier and the storage address.
14. An electronic device, characterized in that, include: Processor and memory; The processor is used to execute a program stored in the memory to implement the method as described in any one of claims 1 to 9.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs that can be executed by one or more processors to implement the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Blockchain and cloud data collaborative sharing method
CN111523133A
Supervisable cross-chain private data sharing method and device
CN115242555A