Power data sharing method, system and equipment based on attribute encryption and medium
By storing user attributes on the blockchain and calculating semi-decrypted ciphertexts at edge nodes, the problem of low computing burden and encryption efficiency in the existing power data sharing scheme is solved, and the safe and efficient sharing of power data is achieved.
Patent Information
- Application Number
- CN202411219364.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-27
AI Technical Summary
The existing blockchain-based power data sharing scheme does not take into account the computing burden of the data owner, and has limitations when applied in resource-constrained data acquisition devices, and user attributes are prone to tampering and low encryption efficiency.
By storing user attributes to the blockchain, the hash function is used to verify the correctness of the decrypted data, and the semi-decrypted ciphertext is calculated at the edge node, the computing burden of data sharing is reduced, and the encryption and decryption efficiency and data integrity are improved.
It enhances the security of attributes, ensures the correctness and efficiency of power data sharing, reduces the computing burden of data sharing, improves the encryption and decryption efficiency, and ensures the integrity of data.
Smart Images

Figure CN119210680A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data sharing, and in particular to a method, system, device and medium for sharing power data based on attribute encryption. Background Art
[0002] Attribute encryption technology has a flexible access control strategy. Because it can effectively solve the access control problem of many-to-many communication, it has been widely used in blockchain access control. At present, the power data sharing solution mainly uses attribute-based encryption technology to achieve one-to-many power data access control, but there are problems such as low encryption efficiency and easy tampering of user attributes.
[0003] Ciphertext-policy attribute-based encryption (CP-ABE) is a public key encryption technology suitable for power data sharing. The data ciphertext can only be decrypted when the attribute set of the access user meets the access control policy adopted by the power data encryption. As blockchain technology becomes more mature, its application scenarios are becoming more extensive and suitable for data sharing in power systems. However, the existing blockchain-based sharing scheme only considers the computing performance of the access user, and does not consider the computing burden of the data owner. There are certain limitations when it is applied in resource-constrained data acquisition equipment. Summary of the invention
[0004] In view of the problem that the existing blockchain-based sharing method only considers the computing performance of the accessing user but does not consider the computing burden of the data owner, and has certain limitations when applied in resource-constrained data acquisition equipment, the present invention proposes a power data sharing method, system, device and medium based on attribute encryption; by storing user attributes in the blockchain, the security of the attributes is enhanced, and the correctness of the decrypted data is verified by using a hash function to ensure the correctness of power data sharing; and by calculating the semi-decrypted ciphertext at the edge node, the computing burden of data sharing is reduced, the encryption and decryption efficiency is improved, and the integrity of the data is ensured.
[0005] The specific implementation contents of the present invention are as follows: A power data sharing method based on attribute encryption specifically includes the following steps: Step S1: Perform initialization operation according to the set initialization parameters, obtain public parameters and master key, and upload them to the blockchain; Step S2: Obtain a global identity ID from an attribute authority, and generate a user key and a conversion key based on the attribute set obtained from the user; Step S3: According to the set access policy, the uploaded power data is converted into ciphertext data and sent to the edge node; Step S4: Generate semi-decrypted ciphertext according to the access request of the ciphertext data; Step S5: Restore the ciphertext data based on the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
[0006] In order to better implement the present invention, further, the step S1 specifically includes the following steps: Step S11: Generate a bilinear group according to the set initialization parameter α; Step S12: Select a random number As from the integer cyclic group Zp according to the attribute set S obtained from the user; Step S13: randomly select z from the integer cyclic group Zp as the master key MSK, and randomly select an element y and a hash function h; Step S14: Generate public parameters PP based on the bilinear group, random number As, element y, hash function h and the set symmetric encryption mechanism, and upload them to the blockchain.
[0007] In order to better implement the present invention, further, the step S2 specifically includes the following steps: Step S21: Generate a secret conversion key UK based on a random number z selected from the integer cyclic group Zp; Step S22: Obtain the global identity ID from the attribute authority according to the hash function h and generate the identity ciphertext β; Step S23: Generate user ciphertext according to the attribute s and identity ciphertext β obtained from the attribute set S; Step S24: Generate a user key SK according to the user ciphertext; Step S25: Calculate the conversion ciphertext according to the random number z and the user key SK, and generate the conversion key TK according to the conversion ciphertext; Step S26: Upload the identity ciphertext β and conversion key TK to the blockchain.
[0008] In order to better implement the present invention, further, the step S3 specifically includes the following steps: Step S31: calling the symmetric key of AES to calculate the data ciphertext of the power data; Step S32: Select a random number z1 from the integer cyclic group Zp as a shared secret value; Step S33: construct an access matrix according to the attribute s and the set rows and columns, and construct an access strategy according to the access matrix; Step S34: Calculate the secret sharing share of the shared secret value according to the access policy; Step S35: According to the secret sharing share and the data ciphertext, the power data is converted into ciphertext data and sent to the edge node.
[0009] In order to better implement the present invention, further, the step S4 specifically includes the following steps: Step S41: Obtain the corresponding conversion key TK according to the public parameter PP and global identity ID obtained from the blockchain; Step S42: Generate a symmetric key ciphertext DK according to the conversion key TK, and determine whether the attribute set S satisfies the access policy. If not, terminate the process; if so, calculate the semi-decrypted ciphertext of the symmetric key ciphertext.
[0010] In order to better implement the present invention, further, step S5 specifically includes the following steps: Step S51: Calculate the AES symmetric key based on the semi-decrypted ciphertext; Step S52: Calling Dec() function according to the symmetric key to obtain the restored power data; Step S53: Call the hash function h to verify whether the recovered power data is consistent with the power data in the blockchain. If they are consistent, the decryption is correct and the power data sharing is completed.
[0011] Based on the above-mentioned power data sharing method based on attribute encryption, in order to better realize the present invention, further, a power data sharing system based on attribute encryption is proposed, which is used to execute the above-mentioned power data sharing method based on attribute encryption; it includes an initialization unit, an identity authentication unit, a data uploading unit, and a decryption verification unit; The initialization unit is used to perform an initialization operation according to the set initialization parameters, obtain public parameters and a master key, and upload them to the blockchain; The identity authentication unit is used to obtain a global identity ID from an attribute authority and generate a user key and a conversion key based on the attribute set obtained from the user; The data uploading unit is used to convert the uploaded power data into ciphertext data according to the set access policy, and send it to the edge node; The decryption verification unit is used to generate a semi-decrypted ciphertext according to an access request for the ciphertext data; restore the ciphertext data according to the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
[0012] Based on the above-proposed power data sharing method based on attribute encryption, in order to better realize the present invention, further, an electronic device is proposed, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-proposed power data sharing method based on attribute encryption is implemented.
[0013] Based on the above-proposed power data sharing method based on attribute encryption, in order to better realize the present invention, a computer-readable storage medium is further proposed, characterized in that computer instructions are stored on the computer-readable storage medium; when the computer instructions are executed on the above-mentioned electronic device, the above-proposed power data sharing method based on attribute encryption is implemented.
[0014] The present invention has the following beneficial effects: The present invention enhances the security of attributes by storing user attributes in the blockchain, and uses hash functions to verify the correctness of decrypted data, thereby ensuring the correctness of power data sharing; and by calculating semi-decrypted ciphertext at the edge node, it reduces the computational burden of data sharing, improves encryption and decryption efficiency, and ensures data integrity. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic block diagram of the process of the power data sharing method based on attribute encryption provided by the present invention. DETAILED DESCRIPTION
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be understood that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, and therefore should not be regarded as limiting the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technical personnel in this field without making creative work are within the scope of protection of the present invention.
[0017] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "disposed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0018] Embodiment 1: This embodiment proposes a power data sharing method based on attribute encryption. The specific steps include: Step S1: Perform initialization operation according to the set initialization parameters, obtain public parameters and master key, and upload them to the blockchain.
[0019] The step S1 specifically includes the following steps: Step S11: Generate a bilinear group according to the set initialization parameter α; Step S12: Select a random number As from the integer cyclic group Zp according to the attribute set S obtained from the user; Step S13: randomly select z from the integer cyclic group Zp as the master key MSK, and randomly select an element y and a hash function h; Step S14: Generate public parameters PP based on the bilinear group, random number As, element y, hash function h and the set symmetric encryption mechanism, and upload them to the blockchain.
[0020] Step S2: Obtain a global identity ID from an attribute authority, and generate a user key and a conversion key based on the attribute set obtained from the user.
[0021] The step S2 specifically includes the following steps: Step S21: Generate a secret conversion key UK based on a random number z selected from the integer cyclic group Zp; Step S22: Obtain the global identity ID from the attribute authority according to the hash function h and generate the identity ciphertext β; Step S23: Generate user ciphertext according to the attribute s and identity ciphertext β obtained from the attribute set S; Step S24: Generate a user key SK according to the user ciphertext; Step S25: Calculate the conversion ciphertext according to the random number z and the user key SK, and generate the conversion key TK according to the conversion ciphertext; Step S26: Upload the identity ciphertext β and conversion key TK to the blockchain.
[0022] Step S3: According to the set access policy, the uploaded power data is converted into ciphertext data and sent to the edge node.
[0023] The step S3 specifically comprises the following steps: Step S31: calling the symmetric key of AES to calculate the data ciphertext of the power data; Step S32: Select a random number z1 from the integer cyclic group Zp as a shared secret value; Step S33: construct an access matrix according to the attribute s and the set rows and columns, and construct an access strategy according to the access matrix; Step S34: Calculate the secret sharing share of the shared secret value according to the access policy; Step S35: According to the secret sharing share and the data ciphertext, the power data is converted into ciphertext data and sent to the edge node.
[0024] Step S4: Generate semi-decrypted ciphertext according to the access request of the ciphertext data.
[0025] The step S4 specifically comprises the following steps: Step S41: Obtain the corresponding conversion key TK according to the public parameter PP and global identity ID obtained from the blockchain; Step S42: Generate a symmetric key ciphertext DK according to the conversion key TK, and determine whether the attribute set S satisfies the access policy. If not, terminate the process; if so, calculate the semi-decrypted ciphertext of the symmetric key ciphertext.
[0026] Step S5: Restore the ciphertext data based on the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
[0027] The step S5 specifically comprises the following steps: Step S51: Calculate the AES symmetric key based on the semi-decrypted ciphertext; Step S52: Calling Dec() function according to the symmetric key to obtain the restored power data; Step S53: Call the hash function h to verify whether the recovered power data is consistent with the power data in the blockchain. If they are consistent, the decryption is correct and the power data sharing is completed.
[0028] Working principle: This embodiment first performs an initialization operation according to the set initialization parameters to obtain public parameters and a master key, and uploads them to the blockchain; secondly, obtains a global identity ID from an attribute authority, and generates a user key and a conversion key based on the attribute set obtained from the user; then, according to the set access policy, the uploaded power data is converted into ciphertext data and sent to the edge node; and based on the access request of the ciphertext data, a semi-decrypted ciphertext is generated; finally, based on the semi-decrypted ciphertext, the ciphertext data is restored, and the hash function h is called to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed; by storing user attributes in the blockchain, the security of the attributes is enhanced, and the hash function is used to verify the correctness of the decrypted data, thereby ensuring the correctness of the power data sharing; and by calculating the semi-decrypted ciphertext at the edge node, the computational burden of data sharing is reduced, the encryption and decryption efficiency is improved, and the integrity of the data is ensured.
[0029] Embodiment 2: This embodiment is based on the above embodiment 1. Figure 1 As shown, a specific embodiment is described in detail, which specifically includes the following steps.
[0030] Step S1: Perform initialization operation according to the set initialization parameters, obtain public parameters and master key, and upload them to the blockchain.
[0031] Step S11: Generate a bilinear group (G, G T , p, g, e); Among them, G and G T represents the multiplicative cyclic group, p represents the order of the multiplicative cyclic group, g is the generator of the multiplicative cyclic group G, and e represents a bilinear map.
[0032] Step S12: According to the attribute set S obtained from the user, from the integer cyclic group Z p Select a random number A s ; Among them, s∈S,A s ∈G; Step S13: From the integer cyclic group Z p Randomly select z as the master key MSK, and randomly select an element y and a hash function h to calculate P k =e(g,g) z ; Among them, z∈Z p ,MSK=z,y∈G; Step S14: Generate public parameters PP based on the bilinear group, random number As, element y, hash function h and the set symmetric encryption mechanism, and upload them to the blockchain.
[0033] PP={G,G T ,p,g,e,A s , P k ,y,h,Enc,Dec}.
[0034] Step S2: Obtain a global identity ID from an attribute authority, and generate a user key and a conversion key based on the attribute set obtained from the user.
[0035] The step S2 specifically includes the following steps: Step S21: According to the integer cyclic group Z p The selected random number z generates the secret conversion key UK; Step S22: Obtain the global identity ID from the attribute authority according to the hash function h and generate the identity ciphertext β; Where, β = h (ID); Step S23: Generate user ciphertext according to the attribute s and identity ciphertext β obtained from the attribute set S; Step S24: Generate a user key SK according to the user ciphertext; Step S25: Calculate the conversion ciphertext according to the random number z and the user key SK, and generate the conversion key TK according to the conversion ciphertext; Step S26: Upload the identity ciphertext β and conversion key TK to the blockchain.
[0036] Step S3: According to the set access policy, the uploaded power data is converted into ciphertext data and sent to the edge node.
[0037] The step S3 specifically comprises the following steps: Step S31: calling the symmetric key of AES to calculate the data ciphertext of the power data; Step S32: From the integer cyclic group Z p Select a random number z1 as the shared secret value; Step S33: construct an access matrix according to the attribute s and the set rows and columns, and construct an access strategy according to the access matrix; The access strategy constructed in this embodiment is (F, γ), where F is an access matrix with m rows and n columns, and γ is an injective function that maps the row number i of the matrix F to the attribute s; Step S34: Calculate the secret sharing share of the shared secret value according to the access policy; Step S35: According to the secret sharing share and the data ciphertext, the power data is converted into ciphertext data and sent to the edge node.
[0038] Step S4: Generate semi-decrypted ciphertext according to the access request of the ciphertext data.
[0039] The step S4 specifically comprises the following steps: Step S41: Obtain the corresponding conversion key TK according to the public parameter PP and global identity ID obtained from the blockchain; Step S42: Generate a symmetric key ciphertext DK according to the conversion key TK, and determine whether the attribute set S satisfies the access policy. If not, terminate the process; if so, calculate the semi-decrypted ciphertext of the symmetric key ciphertext.
[0040] Step S5: Restore the ciphertext data based on the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
[0041] The step S5 specifically comprises the following steps: Step S51: Calculate the AES symmetric key based on the semi-decrypted ciphertext; Step S52: Calling Dec() function according to the symmetric key to obtain the restored power data; Step S53: Call the hash function h to verify whether the recovered power data is consistent with the power data in the blockchain. If they are consistent, the decryption is correct and the power data sharing is completed.
[0042] Working principle: This embodiment prevents user attributes from being tampered with by uploading them to the blockchain, and associates user attributes with the global identity ID to prevent attacks between users. By placing encryption and decryption calculations on edge nodes, the computational burden of data sharing is greatly reduced. Finally, the hash function is called for verification to ensure the integrity and correctness of power data sharing.
[0043] The other parts of this embodiment are the same as those of the above-mentioned embodiment 1, and thus will not be described in detail.
[0044] Embodiment 3: Based on any one of the above-mentioned embodiments 1 to 2, this embodiment proposes a power data sharing system based on attribute encryption based on the above-mentioned power data sharing method based on attribute encryption, which is used to execute the above-mentioned power data sharing method based on attribute encryption; it includes an initialization unit, an identity authentication unit, a data uploading unit, and a decryption verification unit; The initialization unit is used to perform an initialization operation according to the set initialization parameters, obtain public parameters and a master key, and upload them to the blockchain; The identity authentication unit is used to obtain a global identity ID from an attribute authority and generate a user key and a conversion key based on the attribute set obtained from the user; The data uploading unit is used to convert the uploaded power data into ciphertext data according to the set access policy, and send it to the edge node; The decryption verification unit is used to generate a semi-decrypted ciphertext according to an access request for the ciphertext data; restore the ciphertext data according to the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
[0045] This embodiment also proposes an electronic device, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-mentioned power data sharing method based on attribute encryption is implemented.
[0046] This embodiment also proposes a computer-readable storage medium, characterized in that computer instructions are stored on the computer-readable storage medium; when the computer instructions are executed on the above-mentioned electronic device, the above-mentioned attribute encryption-based power data sharing method is implemented.
[0047] The other parts of this embodiment are the same as any one of the above-mentioned embodiments 1-2, so they will not be repeated here.
[0048] The processor involved in the embodiments of the present application may be a chip. For example, it may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0049] The memory involved in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0050] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0051] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0052] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0053] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0054] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one device or distributed on multiple devices. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0055] In addition, each functional module in each embodiment of the present application may be integrated into one device, or each module may exist physically separately, or two or more modules may be integrated into one device.
[0056] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or may include one or more servers, data centers and other data storage devices that can be integrated with the medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0057] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A power data sharing method based on attribute encryption, characterized in that: The specific steps include: Step S1: Perform initialization operation according to the set initialization parameters, obtain public parameters and master key, and upload them to the blockchain; Step S2: Obtain a global identity ID from an attribute authority, and generate a user key and a conversion key based on the attribute set obtained from the user; Step S3: According to the set access policy, the uploaded power data is converted into ciphertext data and sent to the edge node; Step S4: Generate semi-decrypted ciphertext according to the access request of the ciphertext data; Step S5: Restore the ciphertext data based on the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
2. The power data sharing method based on attribute encryption according to claim 1 is characterized in that: The step S1 specifically includes the following steps: Step S11: Generate a bilinear group according to the set initialization parameter α; Step S12: According to the attribute set S obtained from the user, from the integer cyclic group Z p Select a random number A s ; Step S13: From the integer cyclic group Z p Randomly select z as the master key MSK, and randomly select an element y and a hash function h; Step S14: According to the bilinear group and the random number A s , element y, hash function h and the set symmetric encryption mechanism, generate the public parameter PP and upload it to the blockchain.
3. The power data sharing method based on attribute encryption according to claim 2 is characterized in that: The step S2 specifically includes the following steps: Step S21: According to the integer cyclic group Z p The selected random number z generates the secret conversion key UK; Step S22: Obtain the global identity ID from the attribute authority according to the hash function h and generate the identity ciphertext β; Step S23: Generate user ciphertext according to the attribute s and identity ciphertext β obtained from the attribute set S; Step S24: Generate a user key SK according to the user ciphertext; Step S25: Calculate the conversion ciphertext according to the random number z and the user key SK, and generate the conversion key TK according to the conversion ciphertext; Step S26: Upload the identity ciphertext β and conversion key TK to the blockchain.
4. The power data sharing method based on attribute encryption according to claim 3 is characterized in that: The step S3 specifically comprises the following steps: Step S31: calling the symmetric key of AES to calculate the data ciphertext of the power data; Step S32: From the integer cyclic group Z p Select a random number z1 as the shared secret value; Step S33: construct an access matrix according to the attribute s and the set rows and columns, and construct an access strategy according to the access matrix; Step S34: Calculate the secret sharing share of the shared secret value according to the access policy; Step S35: According to the secret sharing share and the data ciphertext, the power data is converted into ciphertext data and sent to the edge node.
5. The power data sharing method based on attribute encryption according to claim 4 is characterized in that: The step S4 specifically comprises the following steps: Step S41: Obtain the corresponding conversion key TK according to the public parameter PP and global identity ID obtained from the blockchain; Step S42: Generate a symmetric key ciphertext DK according to the conversion key TK, and determine whether the attribute set S satisfies the access policy. If not, terminate the process; if so, calculate the semi-decrypted ciphertext of the symmetric key ciphertext.
6. The power data sharing method based on attribute encryption according to claim 5 is characterized in that: The step S5 specifically comprises the following steps: Step S51: Calculate the AES symmetric key based on the semi-decrypted ciphertext; Step S52: Calling Dec() function according to the symmetric key to obtain the restored power data; Step S53: Call the hash function h to verify whether the recovered power data is consistent with the power data in the blockchain. If they are consistent, the decryption is correct and the power data sharing is completed.
7. A power data sharing system based on attribute encryption, used to execute the power data sharing method based on attribute encryption as claimed in claim 1; characterized in that: It includes an initialization unit, an identity authentication unit, a data upload unit, and a decryption verification unit; The initialization unit is used to perform an initialization operation according to the set initialization parameters, obtain public parameters and a master key, and upload them to the blockchain; The identity authentication unit is used to obtain a global identity ID from an attribute authority and generate a user key and a conversion key based on the attribute set obtained from the user; The data uploading unit is used to convert the uploaded power data into ciphertext data according to the set access policy, and send it to the edge node; The decryption verification unit is used to generate a semi-decrypted ciphertext according to an access request for the ciphertext data; restore the ciphertext data according to the semi-decrypted ciphertext, and call the hash function h to verify whether the restored ciphertext data is decrypted correctly. If the decryption is correct, the power data sharing is completed.
8. An electronic device, characterized in that: It comprises a memory and a processor; a computer program is stored in the memory; when the computer program is executed on the processor, the power data sharing method based on attribute encryption as described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions; when the computer instructions are executed on the electronic device as described in claim 8, the power data sharing method based on attribute encryption as described in any one of claims 1-6 is implemented.
