Electric quantity aggregation method based on homomorphic encryption
By using a power aggregation method based on homomorphic encryption in the smart grid, the power data is encrypted and aggregated, and two verifications are performed during the transmission process, the problems of low computing efficiency and insufficient data security in the existing technology are solved, and efficient and secure real-time data aggregation calculation is achieved.
Patent Information
- Application Number
- CN202311392727.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-04-25
AI Technical Summary
The existing homomorphic encryption scheme has low computing efficiency and cannot meet the efficient requirements for real-time data aggregation and calculation in smart grids. At the same time, it is difficult to ensure data privacy and security during data transmission.
The power aggregation method based on homomorphic encryption is adopted. The power data is encrypted by smart grid users, transmitted to the computing center for aggregation and calculation, and the plain text of the power aggregation result is obtained by decrypting the receiver. At the same time, two verifications are performed during the encrypted data transmission to prevent data tampering.
It realizes real-time aggregation and calculation of the power data of the smart grid without leaking plain text, significantly improving the encryption and decryption rate and ciphertext calculation rate, and improving the security of the algorithm and the credibility of the data.
Smart Images

Figure CN119892334A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of homomorphic encryption, and in particular relates to a method for aggregating electric quantity based on homomorphic encryption. Background Art
[0002] Homomorphic encryption is a cryptographic technology that can perform calculations directly on ciphertext. Homomorphic encryption can complete aggregate computing tasks on data without leaking plaintext. However, existing homomorphic encryption schemes have low computational efficiency and cannot adapt to scenarios with high real-time requirements.
[0003] Cloud computing has attracted more and more attention in academia and industry, and outsourced computing is one of the most important applications in cloud computing. A customer with limited computing power outsources tasks to one or more servers in the cloud. This is outsourced computing. Tasks can also be outsourced to supercomputing centers with sufficient computing power. Outsourced computing has high security requirements. It is necessary to ensure that the customer's information will not be leaked, and that correct calculations can be achieved. Customers need to be able to verify the calculation results.
[0004] During the operation of smart grids, data is frequently aggregated, and the timeliness of the aggregation results is highly required. Outsourced computing is needed to meet the requirements of real-time aggregation of large amounts of data. However, directly transmitting data to an external computing center will expose the privacy of power grid data, which is not conducive to data security and business confidentiality. Therefore, it is necessary to study an algorithm that can complete the real-time aggregation computing task of large amounts of data without leaking plaintext. Summary of the invention
[0005] In view of the above analysis, the present invention aims to provide a method for aggregating electric quantity based on homomorphic encryption, which is characterized by comprising the following steps:
[0006] The smart grid user uses the encryption parameters to encrypt each electric quantity data to be calculated to obtain the corresponding data ciphertext, encrypts the encryption parameters to obtain the parameter ciphertext, and calculates the first verification ciphertext based on the encryption parameters and the data ciphertext;
[0007] The computing center aggregates and calculates the data ciphertext to obtain an electric quantity aggregation result, and calculates and obtains a second verification ciphertext based on the electric quantity aggregation result and the first verification ciphertext;
[0008] The smart grid data receiver obtains encryption parameters based on the parameter ciphertext decryption; obtains a third verification ciphertext based on the encryption parameters and the data ciphertext; when the third verification ciphertext is consistent with the first verification ciphertext, obtains a fourth verification ciphertext based on the first verification ciphertext and the power aggregation result; when the fourth verification ciphertext is consistent with the second ciphertext, the power aggregation result is decrypted to obtain the power aggregation result plaintext.
[0009] Furthermore, an asymmetric encryption algorithm is used to encrypt the encryption parameter to obtain a parameter ciphertext, and the key generation of the asymmetric encryption algorithm includes:
[0010] Generate two large prime numbers p1 and q1 based on the security parameter λ;
[0011] Calculate n = p1q1;
[0012] Generate a and b that satisfy ab≡1(modφ(n)), use (n,b) as the public key and (p1,q1,a) as the private key; where φ(n) is the Euler function.
[0013] Further, the encryption parameter includes p||r; and the encrypting the encryption parameter to obtain the parameter ciphertext includes:
[0014] Randomly select r i , i∈[1,m] and calculate Generate two large prime numbers p and q based on the security parameter λ;
[0015] Calculate C1 = f pk (p||r);
[0016] Among them, m is the number of power data, i represents the serial number of power data; f is the RSA cryptographic system; the subscript pk represents the public key of the asymmetric encryption algorithm; C1 represents the parameter ciphertext.
[0017] Furthermore, the calculated power data x i The corresponding data ciphertext obtained by encryption includes:
[0018] Calculate x i,p =x i mod p;
[0019] x i,q =x i mod q;
[0020] q -1 q = 1 mod p;
[0021] p -1 p = 1 mod q;
[0022] C 2,i =q -1 qx i,p +p -1 px i,q +r i mod N;
[0023] Where, N = pq; C 2,i The data ciphertext corresponding to the power data.
[0024] Further, the calculating the first verification ciphertext based on the encryption parameter and the data ciphertext includes:
[0025]
[0026] Wherein, C3 represents the first verification ciphertext; H0 is the first hash function; Represents exclusive OR.
[0027] Furthermore, the aggregate calculation includes: Among them C T Indicates the result of power aggregation.
[0028] Furthermore, the calculation of the second verification ciphertext includes: C3'=H1(C T ||C3); where C3' is the second verification ciphertext; H1 is the second hash function.
[0029] Further, the receiver decrypts the received parameter ciphertext to obtain the encryption parameter p||r; and calculates the third verification ciphertext based on the encryption parameter and the data ciphertext, including: Among them, C r It is the third verification ciphertext.
[0030] Further, the calculating of the fourth verification ciphertext based on the first verification ciphertext and the power aggregation result includes:
[0031] Extract the first λ bits of the encryption parameter p||r as p and calculate C r '=H1(C T ||C3); where C r ' is the fourth verification ciphertext.
[0032] Furthermore, the decryption of the power aggregation data to obtain the power aggregation result plain text includes:
[0033] Calculate C = C T -r mod N;
[0034] q = N / p;
[0035] M add,p = C mod p;
[0036] M add,q = C mod q;
[0037] q -1 q = 1 mod p;
[0038] p -1 p = 1 mod q;
[0039] M T=q -1 Q add,p +p -1 pM add,q mod N;
[0040] Among them, C is the sum of m data; M add,p =C mod p represents the sum modulo p of m data; M add,q =C mod q represents the sum modulo q of m data; M T It is the plain text of the power aggregation result.
[0041] The present invention can achieve at least one of the following beneficial effects:
[0042] By using an improved fully homomorphic encryption algorithm, the power data of the smart grid is encrypted and transmitted to the computing center. The computing center aggregates and calculates the encrypted power data and transmits it to the data recipient of the smart grid for decryption, meeting the smart grid's real-time aggregate calculation needs for power data. In addition, two verifications are performed during the encrypted data transmission process to prevent data tampering, ensure the credibility of the data source, and improve the security of the algorithm.
[0043] By using an improved fully homomorphic encryption algorithm, the use of modular exponentiation operators in large integer operations is avoided during the calculation process, thereby significantly reducing the time complexity of basic calculations. Compared with the Paillier algorithm in the prior art, the encryption and decryption rate of the algorithm in this embodiment is increased by more than 20 times, and the ciphertext operation rate is increased by more than 10 times.
[0044] By comparing the third verification ciphertext C r and the first verification ciphertext C3, to determine whether the data ciphertext transmitted to the computing center is complete, that is, whether the computing center performs calculations based on the correct data ciphertext; by comparing the fourth verification ciphertext C r ' and the second verification ciphertext C3' are consistent, judging whether the calculation result data received by the recipient is complete and correct; the two verifications in this embodiment effectively prevent data tampering, ensure the credibility of the data source, and improve the security of the algorithm.
[0045] Other features and advantages of the present invention will be described in the following description, and some advantages may become apparent from the description, or may be understood by practicing the present invention. The purpose and other advantages of the present invention may be realized and obtained through the contents particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0047] Figure 1 This is a flow chart of the method for aggregating electricity based on homomorphic encryption of the present invention. DETAILED DESCRIPTION
[0048] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0049] Example
[0050] A specific embodiment of the present invention discloses a method for aggregating electric quantity based on homomorphic encryption, which specifically includes the following steps:
[0051] Step S01, the smart grid user uses encryption parameters to encrypt each electricity data to be calculated to obtain a corresponding data ciphertext, encrypts the encryption parameters to obtain a parameter ciphertext, and calculates a first verification ciphertext based on the encryption parameters and the data ciphertext; the smart grid user refers to an enterprise or department in the smart grid that needs to calculate the electricity aggregation result; each electricity data includes the electricity consumption data of each electricity user in the jurisdiction of the enterprise or department.
[0052] Step S02: The computing center aggregates and calculates the data ciphertext to obtain an aggregated power result, and calculates a second verification ciphertext based on the aggregated power result and the first verification ciphertext; specifically, the computing center is an outsourced computing center or a cloud server, and exemplarily, the computing center is a supercomputing center. The aggregate calculation refers to the summation of the power data.
[0053] Step S03, the smart grid data receiver obtains encryption parameters based on the parameter ciphertext decryption; obtains the third verification ciphertext based on the encryption parameters and the data ciphertext calculation; when the third verification ciphertext is consistent with the first verification ciphertext, the fourth verification ciphertext is calculated based on the first verification ciphertext and the power aggregation result; when the fourth verification ciphertext is consistent with the second ciphertext verification, the power aggregation result is decrypted to obtain the power aggregation result plaintext. It should be noted that the smart grid data receiver can be the smart grid user in step S01, or other data receiving users in the smart grid who need to obtain the power data aggregation result.
[0054] In this embodiment, the power data is encrypted in step S01, so as to avoid leaking data privacy. In step S02, the data ciphertext is aggregated and calculated by an outsourced computing center, and then the data receiver decrypts the data in step S03 to obtain the plain text of the power aggregation result. This ensures that user information is not leaked and can achieve correct real-time calculation.
[0055] In this embodiment, by using an improved fully homomorphic encryption algorithm, the power data of the smart grid is encrypted and transmitted to the computing center. The computing center aggregates and calculates the encrypted power data and transmits it to the data recipient of the smart grid for decryption, thereby meeting the smart grid's real-time aggregate calculation requirements for power data. In addition, two verifications are performed during the encrypted data transmission process to prevent data tampering, ensure the credibility of the data source, and improve the security of the algorithm.
[0056] Specifically, in step S01, the encryption parameter is encrypted using an asymmetric encryption algorithm to obtain a parameter ciphertext, and the key generation of the asymmetric encryption algorithm includes:
[0057] Generate two large prime numbers p1 and q1 based on the security parameter λ;
[0058] Calculate n = p1q1;
[0059] Generate a and b that satisfy ab≡1(modφ(n)), publish (n,b) as the public key, and distribute and store (p1,q1,a) as the private key; where φ(n) is the Euler function.
[0060] Specifically, the security parameter is used to determine the bit length of n; the security parameter is a preset value, and preferably, the security parameter is set to 2048, corresponding to 112-bit security in cryptography.
[0061] Specifically, generating two large prime numbers p1 and q1 based on the security parameter λ includes: first generating two prime numbers p1' and q1' of λ / 2 bits, then calculating the product n, and verifying whether the number of bits of n is equal to λ. If not, regenerating it; if equal, completing the generation, and p1' and q1' are p1 and q1.
[0062] Furthermore, the encryption parameters include p||r, wherein || represents string concatenation.
[0063] The step of encrypting the encryption parameter to obtain the parameter ciphertext comprises:
[0064] Randomly select r i , i∈[1,m] and calculate Generate two large prime numbers p and q based on the security parameter λ;
[0065] Calculate C1 = f pk (p||r);
[0066] Among them, m is the number of power data, i represents the serial number of power data; f is the RSA cryptographic system; the subscript pk represents the public key of the asymmetric encryption algorithm; C1 represents the parameter ciphertext.
[0067] Specifically, the process of generating p and q is the same as the process of generating p1 and q1, and p≠p1, q≠q1.
[0068] Furthermore, the calculated power data x i The corresponding data ciphertext obtained by encryption includes:
[0069] Calculate x i,p =x i mod p;
[0070] x i,q =x i mod q;
[0071] q -1 q = 1 mod p;
[0072] p -1 p = 1 mod q;
[0073] C 2,i =q -1 qx i,p +p -1 px i,q +r i mod N;
[0074] Among them, x i represents the i-th power data to be calculated, i is 1, 2, 3, ..., m; x i,p Represents x i modulo p; x i,q Represents x i Find the modulus of q; N = pq is the public data; C 2,i The data ciphertext corresponding to the power data.
[0075] Further, the first verification ciphertext calculated based on the encryption parameter and the data ciphertext includes:
[0076]
[0077] Wherein, C3 represents the first verification ciphertext; H0 is the first hash function; Represents exclusive OR.
[0078] Furthermore, the smart grid user sends the data ciphertext, parameter ciphertext and the first verification ciphertext to the computing center, which is represented by C = (C1, C 2,1 ,...C 2,m ,C3).
[0079] Specifically, in step S02, the computing center aggregates and calculates the data ciphertext to obtain the power aggregation result: Among them C TIndicates the result of power aggregation.
[0080] Furthermore, based on the power aggregation result and the first verification ciphertext, the second verification ciphertext is calculated: C3'=H1(C T ||C3); C3' is the second verification ciphertext; H1 is the second hash function. C3' is used by the data receiver to verify the data C T integrity.
[0081] The first Hash function and the second Hash function are two different Hash functions selected randomly.
[0082] Furthermore, the computing center sends the power aggregation result, the second verification ciphertext, the data ciphertext, the parameter ciphertext and the first verification ciphertext to the data receiver of the smart grid, which is represented by C A =(C1,C 2,1 ,…C 2,m ,C3,C T ,C3').
[0083] Specifically, in step S03, the receiving party decrypts the received parameter ciphertext to obtain the encryption parameter p||r; and calculates the third verification ciphertext based on the encryption parameter and the data ciphertext, including: Among them, C r It is the third verification ciphertext.
[0084] Specifically, the recipient uses the user private key generated in step S01 to decrypt The subscript sk represents the user's private key.
[0085] Further, the receiver compares the third verification ciphertext C r Is it consistent with the first verification ciphertext C3? If not, it means that the received data is damaged and unusable, and the calculation is terminated; if yes, it means that the received data is complete and you can proceed to the next step.
[0086] Furthermore, a fourth verification ciphertext is calculated based on the first verification ciphertext and the power aggregation result, including:
[0087] Extract the first λ bits of the encryption parameter p||r as p and calculate C r '=H1(C T ||C3); where C r ' is the fourth verification ciphertext.
[0088] Further, the receiver compares the fourth verification ciphertext C r ' and the second verification ciphertext C3' are consistent: if not, it means that the received data is damaged and unusable, and the calculation is terminated; if yes, it means that the received data is complete and you can proceed to the next step.
[0089] Furthermore, the receiver decrypts the power aggregation data to obtain the power aggregation result in plain text, including:
[0090] Calculate C = C T -r mod N;
[0091] q = N / p;
[0092] M add,p = C mod p;
[0093] M add,q = C mod q;
[0094] q -1 q = 1 mod p;
[0095] p -1 p = 1 mod q;
[0096] M T =q -1 Q add,p +p -1 pM add,q mod N;
[0097] Among them, C is the sum of m data; M add,p =C mod p represents the sum modulo p of m data; M add,q =C mod q represents the sum modulo q of m data; M T It is the plain text of the power aggregation result.
[0098] This embodiment uses an improved fully homomorphic encryption algorithm to avoid using modular exponentiation operators in large integer operations during the calculation process, thereby significantly reducing the time complexity of basic calculations. Compared with the Paillier algorithm in the prior art, the encryption and decryption rate of the algorithm in this embodiment is increased by more than 20 times, and the ciphertext operation rate is increased by more than 10 times.
[0099] In this embodiment, by comparing the third verification ciphertext C r and the first verification ciphertext C3, to determine whether the data ciphertext transmitted to the computing center is complete, that is, whether the computing center performs calculations based on the correct data ciphertext; by comparing the fourth verification ciphertext C r ' and the second verification ciphertext C3' are consistent, and it is judged whether the calculation result data received by the recipient is complete and correct; the two verifications in this embodiment effectively prevent data tampering. The two verification processes use different hash functions to ensure sufficient data security and integrity verification, ensure the credibility of the data source, and improve the security of the algorithm.
[0100] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for aggregating electricity based on homomorphic encryption, characterized in that: The steps include: The smart grid user uses the encryption parameters to encrypt each electric quantity data to be calculated to obtain the corresponding data ciphertext, encrypts the encryption parameters to obtain the parameter ciphertext, and calculates the first verification ciphertext based on the encryption parameters and the data ciphertext; The computing center aggregates and calculates the data ciphertext to obtain an electric quantity aggregation result, and calculates and obtains a second verification ciphertext based on the electric quantity aggregation result and the first verification ciphertext; The smart grid data receiver obtains the encryption parameters based on the parameter ciphertext decryption; obtains the third verification ciphertext based on the encryption parameters and the data ciphertext calculation; When the third verification ciphertext is consistent with the first verification ciphertext, a fourth verification ciphertext is calculated based on the first verification ciphertext and the power aggregation result; When the fourth verification ciphertext is consistent with the second ciphertext, the power aggregation result is decrypted to obtain the power aggregation result plaintext.
2. The method for electrical charge aggregation according to claim 1, characterized in that: The encryption parameter is encrypted using an asymmetric encryption algorithm to obtain a parameter ciphertext, and the key generation of the asymmetric encryption algorithm includes: Generate two large prime numbers p1 and q1 based on the security parameter λ; Calculate n = p1q1; Generate a and b that satisfy ab≡1(modφ(n)), use (n,b) as the public key and (p1,q1,a) as the private key; where φ(n) is the Euler function.
3. The method for aggregating electrical charge according to claim 2, characterized in that: The encryption parameters include p||r; the encryption of the encryption parameters to obtain parameter ciphertext includes: Randomly select r i , i∈[1,m] and calculate Generate two large prime numbers p and q based on the security parameter λ; Calculate C1 = f pk (p||r); Among them, m is the number of power data, i represents the serial number of power data; f is the RSA cryptographic system; the subscript pk represents the public key of the asymmetric encryption algorithm; C1 represents the parameter ciphertext.
4. The method for electrical charge aggregation according to claim 3, characterized in that: The power data x to be calculated i The corresponding data ciphertext obtained by encryption includes: Calculate x i,p =x i modp; x i,q =x i modq; q -1 q=1modp; p -1 p=1modq; C 2,i =q -1 qx i,p +p -1 px i,q +r i modN; Where, N = pq; C 2,i The data ciphertext corresponding to the power data.
5. The method for electrical charge aggregation according to claim 4, characterized in that: The first verification ciphertext is calculated based on the encryption parameter and the data ciphertext, comprising: Wherein, C3 represents the first verification ciphertext; H0 is the first hash function; Represents exclusive OR.
6. The method for aggregating electrical quantities according to claim 5, characterized in that: The aggregate calculation includes: Among them C T Indicates the result of power aggregation.
7. The method for aggregating electrical quantities according to claim 6, characterized in that: The calculation of the second verification ciphertext includes: C′3=H1(C T ||C3); where C′3 is the second verification ciphertext; H1 is the second hash function.
8. The method for aggregating electrical quantities according to claim 7, characterized in that: The receiver decrypts the received parameter ciphertext to obtain the encrypted parameter p||r; The third verification ciphertext calculated based on the encryption parameters and the data ciphertext includes: Among them, C r It is the third verification ciphertext.
9. The method for aggregating electrical quantities according to claim 8, characterized in that: The calculating of the fourth verification ciphertext based on the first verification ciphertext and the power aggregation result includes: Extract the first λ bits of the encryption parameter p||r as p and calculate C′ r =H1(C T ||C3); where C′ r This is the fourth verification ciphertext.
10. The method for aggregating electrical quantity according to any one of claims 7 to 9, characterized in that: The decryption of the power aggregation data to obtain the power aggregation result plain text includes: Calculate C = C T -r mod N; q = N / p; M add,p =C mod p; M add,q =C mod q; q -1 q=1modp; p -1 p=1modq; M T =q -1 qM add,p +p -1 pM add,q mod N; Among them, C is the sum of m data; M add,p =C mod p represents the sum modulo p of m data; M add,q =C mod q represents the sum modulo q of m data; M T It is the plain text of the power aggregation result.