Data sharing method and system and computer program product

Through the data sharing method combined with homomorphic encryption and blockchain technology, the problem of insufficient data privacy leakage and security in the e-commerce environment is solved, efficient and secure data sharing is achieved, and the digital development of the power industry is promoted.

CN120567409APending Publication Date: 2025-08-29SHENZHEN POWER SUPPLY BUREAU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510615780.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

In the cross-departmental and cross-institutional e-use business environment, the existing data interconnection methods have the problems of privacy leakage and insufficient data security, especially the centralized storage model is vulnerable to attacks and the risk of data tampering is high.

Method used

Homomorphic encryption technology is used to encrypt data, and IPFS cluster and blockchain technology are used to store and access control data, generate data fingerprints through hash functions for immutable verification, and combine it with a trusted authorization center to achieve flexible access control.

Benefits of technology

Effectively prevent data leakage and tampering during transmission and storage, ensure data security and privacy protection, realize efficient and flexible data sharing, improve data access efficiency and traceability, and reduce management costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120567409A_ABST
    Figure CN120567409A_ABST
Patent Text Reader

Abstract

The invention provides a data sharing method and device and a computer program product, and aims to realize safety, privacy protection and efficient sharing of data, and the method comprises the following steps: a trusted authorization center generates a homomorphic encryption public and private key pair for a data provider; the data provider performs homomorphic encryption on the original data by using the public key and then uploads the original data to the IPFS cluster, and the cluster calculates a data hash address and generates a data fingerprint; and the data provider sets an access control strategy, performs attribute encryption on the data fingerprint, and uploads a result to the data sharing block chain. And when a data visitor requests for access, the block chain verifies the matching between the attribute of the data visitor and the access control strategy, and if the matching is successful, the visitor is allowed to obtain the encrypted data and decrypt the encrypted data by using the corresponding private key, and finally original plaintext data is obtained. According to the method, data privacy and security are effectively protected, and flexible data sharing is realized at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electricity consumption data collection, and in particular to a data sharing method and system, and a computer program product. Background Art

[0002] With the digital development of the power industry, the amount of data related to the electricity business environment has exploded. This data, covering a wide range of aspects including user electricity usage behavior, power equipment operation, and market transactions, is extremely valuable for power companies to optimize their operations, make market decisions, and improve customer services. In the process of data interconnection and interoperability across departments and institutions, electricity business environment data faces severe privacy protection and security challenges. On the one hand, traditional data interconnection and interoperability methods, such as directly transmitting raw plaintext data or simply sharing it after desensitization, pose privacy risks, potentially leading to the misuse of user information and the disclosure of corporate trade secrets, harming the interests of all parties. On the other hand, existing technologies lack security in data storage and access control, and cannot meet the stringent requirements for the interconnection and interoperability of electricity business environment data. For example, centralized data storage models are vulnerable to attacks and pose a high risk of data tampering. Summary of the Invention

[0003] The purpose of the present invention is to propose a data sharing method and system, and a computer program product to achieve privacy protection, secure sharing, and effective supervision of electricity business environment data.

[0004] To achieve the above object, according to a first aspect of the present invention, a data sharing method is provided, the method comprising:

[0005] The trusted authorization center generates a homomorphic encryption public-private key pair for the data provider;

[0006] The data provider uses the homomorphic encryption public key to homomorphically encrypt the original plaintext data to obtain the first ciphertext data, and uploads the first ciphertext data to the IPFS cluster;

[0007] The IPFS cluster calculates a hash address of the first ciphertext data using a hash function, performs signature calculation on the hash address to obtain a signature, and generates a data fingerprint based on the hash address and the signature;

[0008] The data provider sets an access control policy for the first ciphertext data, encrypts the data fingerprint by attributes to obtain second ciphertext data, and uploads the second ciphertext data and the access control policy to the data sharing blockchain;

[0009] When a data accessor accesses the original plaintext data, the data accessor submits a data access request to the data sharing blockchain;

[0010] The data sharing blockchain verifies whether the attributes of the data accessor match the access control policy based on the data access request. If not, access is prohibited. If so, the data accessor obtains the second ciphertext data from the data sharing blockchain, obtains the attribute private key and the homomorphic encryption private key from the trusted authorization center, performs attribute decryption on the second ciphertext data according to the attribute private key to obtain the data fingerprint, extracts the hash address from the data fingerprint, downloads the first ciphertext data from the IPFS cluster according to the hash address, and performs homomorphic decryption on the first ciphertext data according to the homomorphic encryption private key to obtain the original plaintext data.

[0011] According to a second aspect of the present invention, a data sharing system is provided, comprising a trusted authorization center, a data provider, a data sharing blockchain, and a data accessor for executing the method according to the first aspect.

[0012] According to a third aspect of the present invention, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions instruct a computer device to perform operations corresponding to the method according to the first aspect.

[0013] The above-mentioned data sharing method, system, and computer program product have the following beneficial effects:

[0014] By using homomorphic encryption technology, original plaintext data remains encrypted during transmission and storage, effectively preventing data theft or leakage during transmission and significantly enhancing the protection of user privacy and trade secrets. Encrypted data is stored in an IPFS cluster, and data fingerprints are generated through hash functions and signature calculations, ensuring data immutability and traceability. The application of blockchain technology further ensures data storage security and strict access control. Data providers can set access control policies to ensure that only data accessors who meet specific attributes can access data. This flexible access control mechanism effectively prevents unauthorized access and data misuse. By encrypting data fingerprints with attributes and uploading them to a data-sharing blockchain, efficient data sharing is achieved. Data accessors can quickly obtain the required data through a simple verification process, improving the efficiency and convenience of data sharing. The application of blockchain technology makes all data access and sharing activities traceable, facilitating data supervision and auditing, and contributing to the establishment of a transparent and trusted data sharing environment.

[0015] In summary, the method of the present invention simplifies the data sharing process, reduces intermediate links, and reduces the cost of data management and maintenance. At the same time, the automated and intelligent access control mechanism also reduces the need for manual intervention, further reducing management costs. By providing a safe and reliable data sharing mechanism, the present invention helps to break down data silos, promote data interconnection and collaboration between different departments and institutions, and promote the digital development of the power industry. In summary, the data sharing method proposed in the present invention achieves efficient and flexible data sharing while ensuring data privacy and security, providing strong support for the digital transformation of the power industry and the optimization of the electricity business environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required 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.

[0017] Figure 1 The figure is a flow chart of a data sharing method in one embodiment of the present invention.

[0018] Figure 2 This is a framework diagram of a data sharing system in one embodiment of the present invention. DETAILED DESCRIPTION

[0019] The detailed description of the accompanying drawings is intended as an illustration of the current embodiment of the present invention and is not intended to represent the only form in which the present invention can be implemented. It should be understood that the same or equivalent functions can be accomplished by different embodiments that are intended to be included in the spirit and scope of the present invention.

[0020] See Figure 1 An embodiment of the present invention provides a data sharing method, the method comprising the following steps:

[0021] Step S10: The trusted authorization center generates a homomorphic encryption public-private key pair for the data provider;

[0022] Specifically, the data provider is, for example, a power company. In this embodiment, a trusted authorization center generates a pair of homomorphic encryption keys for the data provider, consisting of a public key and a private key. Homomorphic encryption is a special encryption method that allows calculations to be performed on encrypted data without first decrypting it. The public key is used to encrypt the data, and the private key is used to decrypt it. This step ensures the security of the data during the encryption process.

[0023] Step S20: The data provider uses the homomorphic encryption public key to homomorphically encrypt the original plaintext data to obtain first ciphertext data, and uploads the first ciphertext data to the IPFS cluster;

[0024] Specifically, the data provider uses the homomorphic encryption public key generated in the previous step to encrypt the original plaintext data it possesses, generating the first ciphertext data. This encryption method ensures the security of the data during transmission and storage. The data provider then uploads this first ciphertext data to the IPFS (InterPlanetary File System) cluster, a distributed storage system that can improve data storage efficiency and security.

[0025] Step S30: The IPFS cluster calculates a hash address of the first ciphertext data using a hash function, performs signature calculation on the hash address to obtain a signature, and generates a data fingerprint based on the hash address and the signature;

[0026] Specifically, after receiving the first ciphertext data, the IPFS cluster uses a hash function to calculate the data's hash address, a data summary that uniquely identifies the data. It then performs a signature calculation on the hash address to generate a signature that proves the data's integrity and origin. Finally, the hash address and signature are combined to generate a data fingerprint for subsequent data verification and access control.

[0027] Step S40: The data provider sets an access control policy for the first ciphertext data, encrypts the data fingerprint by attributes to obtain second ciphertext data, and uploads the second ciphertext data and the access control policy to the data sharing blockchain.

[0028] Specifically, the data provider sets an access control policy for the first ciphertext data, defining which attributes of data accessors can access the data. Attribute encryption technology is then used to encrypt the data fingerprint, generating the second ciphertext data. Finally, the second ciphertext data and the access control policy are uploaded to the data-sharing blockchain. The technical characteristics of the blockchain ensure the security, immutability, and traceability of this data.

[0029] Step S50: When a data accessor accesses the original plaintext data, the data accessor submits a data access request to the data sharing blockchain;

[0030] Specifically, data accessors, such as scientific research institutions, enterprises, etc., need to access the original plaintext data. They need to submit a data access request to the data sharing blockchain. This request contains the accessor's attribute information for subsequent access control verification.

[0031] Step S60: The data sharing blockchain verifies whether the attributes of the data accessor match the access control policy based on the data access request. If not, access is prohibited. If so, the data accessor obtains the second ciphertext data from the data sharing blockchain, obtains the attribute private key and the homomorphic encryption private key from the trusted authorization center, performs attribute decryption on the second ciphertext data according to the attribute private key to obtain the data fingerprint, extracts the hash address from the data fingerprint, downloads the first ciphertext data from the IPFS cluster according to the hash address, and performs homomorphic decryption on the first ciphertext data according to the homomorphic encryption private key to obtain the original plaintext data;

[0032] Specifically, after receiving a data access request, the data sharing blockchain first verifies whether the requester's attributes match the preset access control policy. If the match fails, access is prohibited. If the match is successful, the data accessor can obtain the second ciphertext data from the data sharing blockchain and obtain the corresponding attribute private key and homomorphic encryption private key from the trusted authorization center. Use the attribute private key to decrypt the second ciphertext data to obtain the data fingerprint. Extract the hash address from the data fingerprint, and download the first ciphertext data from the IPFS cluster based on this address. Finally, use the homomorphic encryption private key to decrypt the first ciphertext data to obtain the original plaintext data. This series of steps ensures that only visitors who meet the access control policy can obtain the original data, while ensuring the security of the data during transmission and storage.

[0033] Furthermore, the data sharing blockchain includes multiple nodes, each of which corresponds to a user, such as a data provider or a data accessor. The data sharing blockchain of this embodiment proposes the following consensus mechanism:

[0034] 1) Node initialization: All nodes in the system (including power companies, other enterprises, scientific research institutions, etc.) are assigned an initial score of 100 and randomly divided into a consensus node set and a candidate node set. The consensus node set is responsible for executing the consensus process, while the candidate nodes only update their local state when consensus is reached and do not participate in the consensus process. There are N nodes in the system, and the maximum number of Byzantine nodes allowed is b. To ensure that the system can reach consensus under all circumstances, the number of consensus nodes CN must satisfy CN ≥ 3b + 1. Here, the number of consensus nodes is set to N / 2.

[0035] 2) Master node selection: The master node selection strategy is defined as y = vmodCN, where v is the view number. If the master node is attacked or fails, the system will perform a view switch and the next qualified node will replace it as the master node.

[0036] 3) Request phase: The data accessor node sends a request message to the master node;

[0037] 4) Pre-preparation phase: After the master node receives the request from the data accessor, it enters the pre-preparation phase. In this phase, the master node broadcasts the request message to all replica nodes. After receiving the message, the replica nodes verify it. If the verification passes, it enters the preparation phase. If the verification fails, no operation is performed.

[0038] 5) Preparation phase: Nodes that pass the pre-prepare message verification enter the preparation phase and broadcast the preparation message to other nodes. While sending the preparation message, the node also receives and verifies the preparation messages broadcast by other nodes. If the verification is successful, the node enters the response phase.

[0039] 6) Response phase: The node entering the response phase verifies the message and feeds the result back to the master node; when the master node receives more than 2f +1 When the same confirmation message is received, it is considered that a consensus has been reached;

[0040] 7) Consensus result processing and node update: The master node provides the confirmation result to all nodes (including candidate nodes) and updates the scores of all nodes at the same time; for nodes whose confirmation results are consistent with the final consensus result, the score increases by 1 point; for inconsistent nodes, the score decreases by 5 points; after processing every 50 requests, the system updates the consensus node set and candidate node set; removes the m nodes with the lowest scores from the consensus node set and adds them to the end of the candidate node set; selects the m nodes with the highest scores from the candidate node set, adds them to the consensus node set, and renumbers these nodes, thus completing a complete consensus process.

[0041] In some embodiments, the method further comprises:

[0042] The trusted authorization center generates public parameters and master keys, selects a large prime number p, and sets two cyclic groups of order p to be G and G respectively. T , where G is an elliptic curve group, and select the generator g of G, and define a bilinear map e: G×G→G T , two hash functions H1: {0.1}*→G, H2:

[0043] G T →{0.1} k , k is the bit length of the message, any integer Represents Z p The multiplicative group of the elements in Z that are reversible for multiplication, p Represent {0,1,2,…,p-1}, calculate P pub =g s , then the public parameter GP and the master key MSK are: GP={G,G T ,e,g,P pub ,p,H1,H2},MSK=s;

[0044] When data providers and data accessors apply to register with the data sharing blockchain, the trusted authorization center authenticates the data providers and data accessors. If the authentication is successful, the trusted authorization center generates the identity IDs of the data providers and data accessors based on the public parameters and master key and the attributes of the data providers and data accessors. If the authentication fails, the registration application is rejected.

[0045] Verifying whether the attributes of the data accessor match the access control policy includes:

[0046] The access control policy is represented by a policy ID. When the identity ID generated based on the attributes of the data accessor matches the policy ID, the attributes of the data accessor match the access control policy; otherwise, they do not match.

[0047] Specifically, after receiving an access request, the data sharing blockchain will match the identity ID generated based on the data accessor's attributes with the policy ID stored on the blockchain. If the identity ID matches the policy ID, it means that the data accessor's attributes meet the preset access control policy, so access is allowed, and the data accessor can continue to obtain the second ciphertext data and perform subsequent decryption operations. If the identity ID does not match the policy ID, it means that the data accessor's attributes do not meet the requirements of the access control policy, so access is prohibited and the data accessor cannot obtain any data. This matching mechanism based on policy ID and identity ID simplifies the access control process, improves the efficiency and accuracy of access control, and ensures that only data accessors who meet specific attributes can access sensitive data, thereby further strengthening data security and privacy protection.

[0048] In some embodiments, the trusted authorization center generates a homomorphically encrypted public-private key pair for the data provider, including:

[0049] Randomly select two large prime numbers f and j with equal digits, and calculate the modulus n = f 2 j;

[0050] exist Randomly select a d in g p-1 modp 2 The order is f, and calculate h = d n modn;

[0051] Then the public key is pk = (n, d, h), and the private key sk = (f, j);

[0052] in, Represents Z n The multiplicative group of the elements in Z that are reversible for multiplication,n It represents {0,1,2,…,n-1}, and mod is the remainder operation.

[0053] In some embodiments, the data provider uses a homomorphic encryption public key to homomorphically encrypt the original plaintext data to obtain first ciphertext data, including:

[0054] For the original plaintext data m, 0≤m≤f-1, select a random number r∈Z n , calculate and output the first ciphertext data as c=OEncrypt(m)=d m h r modn; OEncrypt indicates the original data homomorphic encryption algorithm.

[0055] In some embodiments, the first ciphertext data is homomorphically decrypted according to the homomorphic encryption private key to obtain the original plaintext data, as shown in the following formula:

[0056] m=ODecrypt=(L(c f-1 modf 2 )) / (L(d f-1 modf 2 ))modf 2

[0057] Wherein, ODecrypt represents the original data homomorphic decryption algorithm, L(x) = (x-1) / f.

[0058] In some embodiments, encrypting the data fingerprint by attributes to obtain the second ciphertext data includes:

[0059] The user's identity ID is mapped to an element of the elliptic curve group G through the hash function H1, namely Q ID =H1(ID);

[0060] Randomly pick a number Calculate DF1 = g r , Then the second ciphertext data is CipherDF={DF1,DF2};

[0061] Among them, DF is the data fingerprint.

[0062] In some embodiments, the attribute private key is generated according to the following method:

[0063] according to Calculate the components of the private key, x i For the attribute element related to the identity, the generated attribute private key is SK ID ={D i}.

[0064] In some embodiments, performing attribute decryption on the second ciphertext data according to the attribute private key to obtain the data fingerprint includes:

[0065] Using component D in the private key i ,calculate And calculate H2(e(Q ID ,P pub ) r )=H2(e(H1(ID),g s ) r )=H2(e(g,g) rs ), then the data fingerprint is

[0066] Another embodiment of the present invention provides a data sharing system, including a trusted authorization center, a data provider, a data sharing blockchain, and a data accessor for executing the method described in the above embodiment.

[0067] It should be noted that the system provided in this embodiment can be used to execute the method described in the above embodiment. Therefore, the content not described in detail in this embodiment can be obtained by referring to the content of the method of the above embodiment, so it will not be repeated here.

[0068] Another embodiment of the present invention provides a computer program product, including computer program instructions, wherein the computer program instructions instruct a computer device to perform operations corresponding to the method described in the above embodiment.

[0069] Specifically, the computer program product includes a series of computer program instructions. These computer program instructions are codes written in a computer program that define how to perform specific operations. These computer program instructions are designed to be loaded onto a computer device and instruct the device to perform specific operations, which are the steps in the data sharing method described in the above embodiment. In this way, the computer program product of this embodiment provides a complete software solution that can be run on various computer devices to implement the data sharing method described in the above embodiment.

[0070] While various embodiments of the present invention have been described above, the above descriptions are intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A data sharing method, characterized in that: The method comprises: The trusted authorization center generates a homomorphic encryption public-private key pair for the data provider; The data provider uses the homomorphic encryption public key to homomorphically encrypt the original plaintext data to obtain the first ciphertext data, and uploads the first ciphertext data to the IPFS cluster; The IPFS cluster calculates a hash address of the first ciphertext data using a hash function, performs signature calculation on the hash address to obtain a signature, and generates a data fingerprint based on the hash address and the signature; The data provider sets an access control policy for the first ciphertext data, encrypts the data fingerprint by attributes to obtain second ciphertext data, and uploads the second ciphertext data and the access control policy to the data sharing blockchain; When a data accessor accesses the original plaintext data, the data accessor submits a data access request to the data sharing blockchain; The data sharing blockchain verifies whether the attributes of the data accessor match the access control policy based on the data access request. If not, access is prohibited. If so, the data accessor obtains the second ciphertext data from the data sharing blockchain, obtains the attribute private key and the homomorphic encryption private key from the trusted authorization center, performs attribute decryption on the second ciphertext data according to the attribute private key to obtain the data fingerprint, extracts the hash address from the data fingerprint, downloads the first ciphertext data from the IPFS cluster according to the hash address, and performs homomorphic decryption on the first ciphertext data according to the homomorphic encryption private key to obtain the original plaintext data.

2. The method according to claim 1, characterized in that The method further comprises: The trusted authorization center generates public parameters and master keys, selects a large prime number p, and sets two cyclic groups of order p to be G and G respectively. T , where G is an elliptic curve group, and select the generator g of G, and define a bilinear map e: G×G→G T , two hash functions H1: {0.1}*→G, H2: G T →{0.1} k , k is the bit length of the message, any integer Represents Z p The multiplicative group of the elements in Z that are reversible for multiplication, p Represent {0,1,2,…,p-1}, calculate P pub =g s , then the public parameter GP and the master key MSK are: GP={G,G T ,e,g,P pub ,p,H1,H2},MSK=s; The trusted authorization center generates identity IDs of the data provider and the data accessor based on the public parameters and the master key and according to the attributes of the data provider and the data accessor; Verifying whether the attributes of the data accessor match the access control policy includes: The access control policy is represented by a policy ID. When the identity ID generated based on the attributes of the data accessor matches the policy ID, the attributes of the data accessor match the access control policy; otherwise, they do not match.

3. The method according to claim 2, characterized in that The trusted authorization center generates a homomorphically encrypted public-private key pair for the data provider, including: Randomly select two large prime numbers f and j with equal digits, and calculate the modulus n = f 2 j; exist Randomly select a d in g p-1 modp 2 The order is f, and calculate h = d n modn; Then the public key is pk = (n, d, h), and the private key sk = (f, j); in, Represents Z n The multiplicative group of the elements in Z that are reversible for multiplication, n It represents {0,1,2,…,n-1}, and mod is the remainder operation.

4. The method according to claim 3, characterized in that The data provider uses the homomorphic encryption public key to homomorphically encrypt the original plaintext data to obtain first ciphertext data, including: For the original plaintext data m, 0≤m≤f-1, select a random number r∈Z n , calculate and output the first ciphertext data as c=OEncrypt(m)=d m h r modn; OEncrypt indicates the original data homomorphic encryption algorithm.

5. The method according to claim 4, characterized in that The first ciphertext data is homomorphically decrypted according to the homomorphic encryption private key to obtain the original plaintext data, as shown in the following formula: m=ODecrypt=(L(c f-1 modf 2 )) / (L(d f-1 modf 2 ))modf 2 Wherein, ODecrypt represents the original data homomorphic decryption algorithm, L(x) = (x-1) / f.

6. The method according to claim 5, characterized in that The step of encrypting the data fingerprint by attributes to obtain second ciphertext data includes: The user's identity ID is mapped to an element of the elliptic curve group G through the hash function H1, namely Q ID =H1(ID); Randomly pick a number Calculate DF1 = g r , DF2=DF⊕H2(e(Q ID ,P pub ) r ), then the second ciphertext data is CipherDF = {DF1, DF2}; Among them, DF is the data fingerprint.

7. The method according to claim 6, characterized in that The attribute private key is generated according to the following method: according to Calculate the components of the private key, x i For the attribute element related to the identity, the generated attribute private key is SK ID ={D i }.

8. The method according to claim 7, characterized in that The step of performing attribute decryption on the second ciphertext data according to the attribute private key to obtain the data fingerprint includes: Using component D in the private key i ,calculate And calculate H2(e(Q ID ,P pub ) r )=H2(e(H1(ID),g s ) r )=H2(e(g,g) rs ), then the data fingerprint is DF=DF2⊕H2(e(Q ID ,P pub ) r ).

9. A data sharing system, characterized in that: The invention comprises a trusted authorization center, a data provider, a data sharing blockchain and a data accessor for executing the method described in any one of claims 1 to 8.

10. A computer program product, characterized in that The method comprises computer program instructions, wherein the computer program instructions instruct a computer device to execute operations corresponding to the method according to any one of claims 1 to 8.