A secure communication method, device, electronic device and storage medium
By performing dual encryption processing and message authentication code verification on the power data collected by the smart meter, the data transmission security problem between the smart meter and the server in the distributed energy system is solved, and the data is safely reported and retransmitted, ensuring that System security and reliability.
Patent Information
- Application Number
- CN202010948250.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-10
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In distributed energy systems, smart meters cannot use the existing TLS protocol for secure communication due to weak computing and storage capabilities, resulting in difficult to ensure data transmission security.
By double encryption processing of the power data, identification code and timestamp collected by the smart meter, the ciphertext and message authentication code are generated, the security of the data during transmission is ensured, and the success of data reception is verified through the feedback information of the server, and the successful implementation of the data is realized. Security reporting and retransmission of data.
It ensures secure communication between smart meter and server, ensures that the power data is not tampered with or lost during the transmission process, and realizes data security and reliability in distributed energy systems.
Smart Images

Figure CN114257385B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of information security technology, and in particular, to a secure communication method, device, electronic device, and storage medium. Background Art
[0002] Distributed energy system refers to an energy comprehensive utilization system distributed at the user end. Compared with the traditional centralized energy supply system, the distributed energy system is directly oriented to the user, produces and supplies energy on-site according to the user's needs, and minimizes the loss in the transmission link, thereby maximizing the efficiency of energy utilization. In recent years, the introduction of decentralized technologies such as blockchain has promoted the development and implementation of distributed energy systems, and many distributed energy systems based on blockchain and distributed energy trading systems based on blockchain have emerged.
[0003] In distributed energy systems, the collection and transmission of electricity data is the most basic link. Only when the electricity data collected by smart meters is reported to the server in a timely and secure manner can data analysis and energy trading be carried out. On the other hand, since smart meters are devices with relatively weak computing and storage capabilities, they cannot use the most popular Transport Layer Security (TLS) protocol for secure communication. Therefore, how to ensure the secure transmission of data between smart meters and servers has become an important issue in distributed energy systems. Summary of the invention
[0004] The embodiments of the present application provide a secure communication method, device, smart meter, server and storage medium for a distributed energy system, so as to achieve the purpose of secure communication between the smart meter and the server in the distributed energy system.
[0005] In a first aspect, an embodiment of the present application provides a secure communication method, which is applied to a smart meter in a distributed energy system, and the method includes:
[0006] Acquire current power data, an identification code of the smart meter, and a first timestamp, wherein the first timestamp is the current system time of the smart meter;
[0007] Performing a first encryption process and a second encryption process on the electricity data, the identification code of the smart meter, and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively;
[0008] Uploading the first ciphertext and the first message authentication code to a server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code;
[0009] receiving feedback information sent by the server, and judging whether the server has successfully stored the power data based on the feedback information;
[0010] If not, return to execute the operation of uploading the first ciphertext and the first message authentication code to the server.
[0011] In a second aspect, an embodiment of the present application provides a secure communication method, which is applied to a server in a distributed energy system, and the method includes:
[0012] Receiving a first ciphertext and a first message authentication code uploaded by the smart meter, wherein the first ciphertext and the first message authentication code are obtained by the smart meter performing a first encryption process and a second encryption process on the acquired current electricity data, the identification code of the smart meter, and the first timestamp, respectively;
[0013] Decrypting the first ciphertext to obtain power data, and authenticating the power data using a first message authentication code;
[0014] Feedback information is generated according to the authentication result, and the feedback information is sent to the smart meter.
[0015] In a third aspect, an embodiment of the present application further provides a secure communication device configured in a smart meter in a distributed energy system, the device comprising:
[0016] A collection module, used to obtain current power data, an identification code of the smart meter and a first timestamp, wherein the first timestamp is the current system time of the smart meter;
[0017] A first encryption calculation module is used to perform a first encryption process and a second encryption process on the electricity data, the identification code of the smart meter and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively;
[0018] a first sending module, configured to upload the first ciphertext and the first message authentication code to a server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code;
[0019] A first receiving module receives feedback information sent by the server, and determines whether the server has successfully stored the power data based on the feedback information;
[0020] The return module is used to return to the operation of uploading the first ciphertext and the first message authentication code to the server when the judgment result is no.
[0021] In a fourth aspect, an embodiment of the present application further provides a secure communication device, which is configured in a server in a distributed energy system, and the device includes:
[0022] A second receiving module is used to receive a first ciphertext and a first message authentication code uploaded by the smart meter, wherein the first ciphertext and the first message authentication code are obtained by the smart meter performing a first encryption process and a second encryption process on the acquired current electricity data, the identification code of the smart meter and the first timestamp respectively;
[0023] a decryption and authentication module, configured to decrypt the first ciphertext to obtain power data, and authenticate the power data using a first message authentication code;
[0024] The feedback information generation and sending module is used to generate feedback information according to the authentication result and send the feedback information to the smart meter.
[0025] In a fifth aspect, an embodiment of the present application further provides an electronic device, including:
[0026] one or more processors;
[0027] a storage device for storing one or more programs,
[0028] When the one or more programs are executed by the one or more processors, the one or more processors implement the secure communication method as described in any embodiment of the present application.
[0029] In a sixth aspect, an embodiment of the present application further provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the secure communication method as described in any embodiment of the present application is implemented.
[0030] In an embodiment of the present application, the collected current electricity data is encrypted so that the electricity data collected by the smart meter can be securely reported to the server. At the same time, based on the feedback information sent by the server, it is verified whether the server has successfully received the electricity data, and the electricity data is resent when the server fails to receive the electricity data, thereby ensuring the secure communication between the smart meter and the server in the distributed energy system. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flowchart of a secure communication method according to the first embodiment of the present application;
[0032] Figure 2 is a flowchart of a secure communication method according to a second embodiment of the present application;
[0033] Figure 3 is a schematic structural diagram of a secure communication device according to a third embodiment of the present application;
[0034] Figure 4 is a schematic structural diagram of a security communication device according to a fourth embodiment of the present application;
[0035] Figure 5 It is a structural schematic diagram of an electronic device for implementing a secure communication method according to the present application. DETAILED DESCRIPTION
[0036] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0037] Figure 1 It is a flow chart of the secure communication method according to the first embodiment of the present application. This embodiment can be applicable to the situation where a smart meter in a distributed energy system sends electricity data to a server. The method can be executed by a secure communication device, which can be implemented in software and / or hardware and can be integrated in an electronic device, such as a smart meter in a distributed energy system.
[0038] In the embodiment of the present application, in order to ensure that the smart meter in the distributed energy system can communicate securely with the server, first, the smart meter establishes a communication connection with the server through the network interface. For example, the smart meter can establish a user datagram protocol (UDP) connection with the server through a preset communication module, wherein the preset communication module can be optionally a 4G communication module, or other communication modules, which are not specifically limited here. After the smart meter establishes a connection with the server, the smart meter needs to be registered with the server before communication can be carried out. The process of registering the meter with the server is as follows: the smart meter sends a registration request to the server, and obtains and stores the smart meter associated parameters according to the registration result. For example, after the meter is successfully registered, the smart meter will store the corresponding associated parameters, wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a period for uploading power data. The preset key is used for encryption and decryption during the communication process between the smart meter and the server. The period for uploading power data refers to the time interval for the smart meter to send power data to the server.
[0039] In another optional registration method, when registering a smart meter with a server, the smart meter can be connected to a computer device via a Universal Serial Bus (USB), and the registration task can be performed through a user interface. The computer device can be connected to the server via a secure transport layer protocol (TLS), thereby ensuring the confidentiality and consistency of the registration information transmitted during the registration stage. Figure 1 As shown, the secure communication method specifically includes the following process:
[0040] S101, obtaining current electricity data, an identification code of a smart meter and a first timestamp.
[0041] Among them, the first timestamp is the current system time of the smart meter, and the identification code of the smart meter refers to the number that can uniquely identify the smart meter, which is determined when the smart meter initiates registration with the server and is stored in the smart meter. Since the smart meter can measure the effective values of power, current, voltage, etc. in real time through internal detection components, when obtaining the current power data, it is optional to read it from the detection components through a preset protocol (such as RS485 data protocol).
[0042] S102: Perform a first encryption process and a second encryption process on the electricity data, the identification code of the smart meter, and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively.
[0043] In an embodiment of the present application, in order to ensure the security of data communication, it is necessary to encrypt the electric quantity data to be transmitted. Optionally, the current electric quantity data, the identification code of the smart meter and the first timestamp are first encrypted to obtain a first ciphertext. Exemplarily, based on a preset key, a first encryption algorithm (such as the Advanced Encryption Standard (AES) encryption algorithm) is used to perform a first encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp to obtain a first ciphertext. In a specific implementation, the encryption function provided by the AES encryption algorithm can be used to calculate the preset key, the electric quantity data, the identification code of the smart meter and the first timestamp, and the first ciphertext is obtained according to the output of the encryption function.
[0044] Furthermore, in order to prevent the encrypted power data from being tampered with during transmission, the power data, the identification code of the smart meter and the first timestamp may be subjected to a second encryption process to obtain a first message authentication code, so that the subsequent server can confirm whether the power data has been tampered with during transmission based on the first message authentication code. In an optional implementation, based on a preset key, a second encryption algorithm is used to perform a second encryption process on the power data, the identification code of the smart meter and the first timestamp to obtain a first message authentication code, wherein the second encryption algorithm may be a secure hash algorithm (SHA).
[0045] S103: Upload the first ciphertext and the first message authentication code to the server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code.
[0046] Optionally, the smart meter can upload the first ciphertext and the first message authentication code to the server based on the user datagram protocol (UDP), so that the server decrypts the first ciphertext through a preset key to obtain the power data, and authenticates the obtained power data through the first message authentication code. The purpose of the authentication is to determine whether the power data in the first ciphertext has been tampered with during the transmission process. The process of authenticating the obtained power data through the first message authentication code includes: based on the preset key, using the second encryption algorithm to encrypt the decrypted power data, the identification code of the smart meter, and the first timestamp to obtain a new second message authentication code, and comparing the new second message authentication code with the original second message authentication code uploaded by the smart meter. If they are the same, it indicates that the power data has not been tampered with during the transmission process, and after the authentication is passed, the server will save the power data.
[0047] S104: Receive feedback information sent by the server, and determine whether the server has successfully stored the power data based on the feedback information.
[0048] The feedback information at least includes whether the server has authenticated the received power data and stored it in the server. In order to prevent the feedback information from being tampered with during transmission, the feedback information sent by the server is encrypted information. Specifically, the feedback information includes the second ciphertext and the second message authentication code generated by the server after encryption processing; accordingly, judging whether the server has successfully stored the power data based on the feedback information includes S1-S2:
[0049] S1. Decrypt the second ciphertext using a preset key to obtain a power data storage result identifier and a second timestamp.
[0050] Among them, the power data storage result identifier includes the numbers "0" and "1", "0" indicates that the first message authentication code verification fails, the power data is not stored, and the smart meter is requested to resend the data; "1" indicates that the first message authentication code verification passes, and the power data has been successfully stored; the second timestamp refers to the system time of the server when the server encrypts the power data storage result identifier.
[0051] S2. Determine whether the power data storage result identifier and the second timestamp meet the preset conditions. If so, authenticate the power data storage result identifier through the second message authentication code, and determine whether the server has successfully stored the power data based on the authentication result.
[0052] Among them, judging whether the electric quantity data storage result identifier and the second timestamp meet the preset conditions includes: judging whether the difference between the second timestamp and the first timestamp is within the preset interval [0, t], wherein the value of t can be preset according to the actual situation, and judging whether the electric quantity data storage result identifier is "0", if the results of both judgments are "yes", then authenticating the electric quantity data storage result identifier through the second message authentication code to judge whether the electric quantity data storage result identifier has been tampered with. The specific authentication process includes: based on the preset key, encrypting the electric quantity data storage result identifier and the second timestamp using the second encryption algorithm to obtain a new second message authentication code, and comparing the new second message authentication code with the original second message authentication code, if the two are equal, the verification is passed, and it can be known that the server has not successfully stored the electric quantity data, and it is necessary to execute step S105.
[0053] It should be noted here that if it is determined whether the difference between the second timestamp and the first timestamp is within the preset interval [0, t], and whether the power data storage result flag is "1", and after the authentication is passed, it indicates that the server has successfully stored the power data. At this time, the smart meter waits for a period of time and continues to execute steps S101-S104.
[0054] S105: If not, return to execute the operation of uploading the first ciphertext and the first message authentication code to the server.
[0055] In an embodiment of the present application, the collected current electricity data is encrypted so that the electricity data collected by the smart meter can be securely reported to the server. At the same time, based on the feedback information sent by the server, it is verified whether the server has successfully received the electricity data, and the electricity data is resent when the server fails to receive the electricity data, thereby ensuring the secure communication between the smart meter and the server in the distributed energy system.
[0056] Figure 2 It is a flow chart of the secure communication method according to the second embodiment of the present application. This embodiment is applicable to the situation where a smart meter sends electricity data to a server in a distributed energy system. The method can be executed by a secure communication device, which can be implemented in software and / or hardware and can be integrated in an electronic device, such as a server in a distributed energy system.
[0057] In the embodiment of the present application, the server must register the smart meter on the server in order to achieve communication with the smart meter. Specifically, the server generates smart meter-related parameters in response to the registration request sent by the smart meter, wherein the smart meter-related parameters at least include a preset key, an identification code of the smart meter, and a period for uploading power data. In an optional implementation, the server can generate a unique identification code for the meter through a preset coding rule or a random number generator, generate a random number as a key through a random number generator, and the period can be determined according to specific application requirements; the server enters the identification code, key, and period into a database.
[0058] On the basis of the above, see Figure 2 , the method comprising:
[0059] S201. Receive a first ciphertext and a first message authentication code uploaded by a smart meter.
[0060] The first ciphertext and the first message authentication code are obtained by performing a first encryption process and a second encryption process on the current power data, the identification code of the smart meter and the first timestamp obtained by the smart meter. For details, please refer to the description of the above embodiment, which will not be repeated here.
[0061] S202: Decrypt the first ciphertext to obtain power data, and authenticate the power data using a first message authentication code.
[0062] Optionally, the first ciphertext is decrypted using a preset key to obtain the power data, the first timestamp and the identification code of the smart meter. In order to determine whether the power data in the first ciphertext has been tampered with during the data transmission process, first determine whether the identification code of the smart meter exists in the server. If it exists, further determine whether the difference between the current system time of the server and the first timestamp is within the preset time interval [0, p], where p is a preset value based on actual conditions. If it exists within the interval, the power data is authenticated using the first message authentication code. Optionally, based on the preset key, the power data, the first timestamp and the identification code of the smart meter are encrypted using the SHA encryption algorithm to obtain a new first authentication code, and the new first message authentication code is compared with the original first message authentication code. If they are the same, the authentication is passed and the power data has not been modified. At this time, the power data can be stored in the server; on the contrary, if they are different, it indicates that the power data has been tampered with, then the authentication fails, and the server will not store the power data received this time.
[0063] S203: Generate feedback information according to the authentication result, and send the feedback information to the smart meter.
[0064] Optionally, feedback information is generated based on the authentication result, including: generating a power data storage result identifier based on the authentication result; wherein the power data storage result identifier is used to indicate whether the power data has passed the authentication and has been stored in the server, for example, the power data storage result identifier includes the numbers "0" and "1", "0" indicates that the first message authentication code verification failed, the power data is not stored, and the smart meter is requested to resend the data; "1" indicates that the first message authentication code verification passed, and the power data has been successfully stored; based on the preset key, the power data storage result identifier and the second timestamp are subjected to a third encryption process and a fourth encryption process to obtain feedback information including a second ciphertext and a second message authentication code; wherein the second timestamp is the system time when the server encrypts the data.
[0065] Feedback information is sent to the smart meter, so that after the power data is tampered with, the meter is notified to re-upload the power data.
[0066] In an embodiment of the present application, the server can verify whether the received electricity data comes from the smart meter with the corresponding identity number, whether it is lost or tampered with during the transmission process, and require the smart meter to resend the data when data reception fails, thereby ensuring the communication security between the smart meter and the server in the distributed energy system.
[0067] Figure 3 is a schematic diagram of the structure of a secure communication device according to the third embodiment of the present application, wherein the device is used in a distributed energy system where a smart meter sends power data to a server, and the device is configured on a smart meter in the distributed energy system, see Figure 3 , the device comprises:
[0068] The acquisition module 301 is used to obtain the current power data, the identification code of the smart meter and the first timestamp, wherein the first timestamp is the current system time of the smart meter;
[0069] A first encryption calculation module 302 is used to perform a first encryption process and a second encryption process on the electricity data, the identification code of the smart meter and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively;
[0070] A first sending module 303 is used to upload the first ciphertext and the first message authentication code to a server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code;
[0071] The first receiving module 304 receives feedback information sent by the server, and determines whether the server has successfully stored the power data based on the feedback information;
[0072] The return module 305 is used to return to the operation of uploading the first ciphertext and the first message authentication code to the server when the judgment result is no.
[0073] Based on the above embodiment, optionally, the device further includes:
[0074] A first registration module is used to send a registration request to the server before obtaining the power data, and obtain and store smart meter associated parameters according to the registration result; wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a cycle for uploading power data;
[0075] Accordingly, the first encryption calculation module is specifically used for:
[0076] Based on the preset key, the first encryption algorithm and the second encryption algorithm are used to perform the first encryption processing and the second encryption processing on the electric quantity data, the identification code of the smart meter and the first timestamp respectively.
[0077] Based on the above embodiment, optionally, the feedback information includes a second ciphertext and a second message authentication code generated by the server after encryption processing;
[0078] Correspondingly, the first receiving module is also used for:
[0079] Decrypting the second ciphertext using the preset key to obtain a power data storage result identifier and a second timestamp;
[0080] Determine whether the power data storage result identifier and the second timestamp meet the preset conditions. If so, authenticate the power data storage result identifier through the second message authentication code, and determine whether the server has successfully stored the power data based on the authentication result.
[0081] Based on the above embodiment, optionally, the smart meter establishes a communication connection with the server through a network interface.
[0082] The secure communication device provided in the embodiments of the present application can execute the secure communication method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
[0083] Figure 4 is a schematic diagram of the structure of a secure communication device according to the fourth embodiment of the present application, wherein the device is used in a distributed energy system where a smart meter sends power data to a server, and the device is configured on a server in the distributed energy system, see Figure 4 , the device comprises:
[0084] The second receiving module 401 is used to receive the first ciphertext and the first message authentication code uploaded by the smart meter, wherein the first ciphertext and the first message authentication code are obtained by the smart meter after performing a first encryption process and a second encryption process on the acquired current power data, the identification code of the smart meter and the first timestamp respectively;
[0085] A decryption and authentication module 402 is used to decrypt the first ciphertext to obtain power data, and authenticate the power data through a first message authentication code;
[0086] The feedback information generating and sending module 403 is used to generate feedback information according to the authentication result and send the feedback information to the smart meter.
[0087] Based on the above embodiment, optionally, the feedback information generating and sending module includes:
[0088] An identification generating unit, used to generate an electric quantity data storage result identification according to the authentication result; wherein the electric quantity data storage result identification is used to indicate whether the electric quantity data has passed the authentication and has been stored in the server;
[0089] The encryption unit is used to perform a third encryption process and a fourth encryption process on the power data storage result identifier and the second timestamp to obtain feedback information including a second ciphertext and a second message authentication code; wherein the second timestamp is the current system time of the server.
[0090] Based on the above embodiment, optionally, the device further includes:
[0091] The second registration module is used to generate smart meter associated parameters in response to a registration request sent by the smart meter; wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a period for uploading power data.
[0092] The secure communication device provided in the embodiments of the present application can execute the secure communication method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
[0093] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 The electronic device (e.g., smart meter) provided in the embodiment of the present application includes: one or more processors 502 and a memory 501; the processor 502 in the electronic device may be one or more, Figure 5A processor 502 is taken as an example; the memory 501 is used to store one or more programs; the one or more programs are executed by the one or more processors 502, so that the one or more processors 502 implement the secure communication method as described in any one of the embodiments of the present application.
[0094] The electronic device may further include: an input device 503 and an output device 504 .
[0095] The processor 502, memory 501, input device 503 and output device 504 in the electronic device may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0096] The storage device 501 in the electronic device is a computer-readable storage medium that can be used to store one or more programs, which can be software programs, computer executable programs, and modules, such as program instructions / modules corresponding to the application control method provided in the embodiment of the present application. The processor 502 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the storage device 501, that is, implementing the secure communication method in the above method embodiment.
[0097] The storage device 501 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 501 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 501 may further include a memory remotely arranged relative to the processor 602, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The input device 503 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 504 may include a display device such as a display screen.
[0099] Furthermore, when one or more programs included in the electronic device are executed by the one or more processors 602, the program performs the following operations:
[0100] Acquire current power data, an identification code of the smart meter, and a first timestamp, wherein the first timestamp is the current system time of the smart meter;
[0101] Performing a first encryption process and a second encryption process on the electricity data, the identification code of the smart meter, and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively;
[0102] Uploading the first ciphertext and the first message authentication code to a server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code;
[0103] receiving feedback information sent by the server, and judging whether the server has successfully stored the power data based on the feedback information;
[0104] If not, return to execute the operation of uploading the first ciphertext and the first message authentication code to the server.
[0105] This embodiment also provides an electronic device, namely, a server in a distributed energy system, whose structure is similar to the above structure and is used to perform the following operations:
[0106] Receiving a first ciphertext and a first message authentication code uploaded by the smart meter, wherein the first ciphertext and the first message authentication code are obtained by the smart meter performing a first encryption process and a second encryption process on the acquired current electricity data, the identification code of the smart meter, and the first timestamp, respectively;
[0107] Decrypting the first ciphertext to obtain power data, and authenticating the power data using a first message authentication code;
[0108] Feedback information is generated according to the authentication result, and the feedback information is sent to the smart meter.
[0109] Of course, those skilled in the art can understand that when one or more programs included in the above-mentioned electronic device are executed by the one or more processors 502, the program can also perform related operations in the application control method provided in any embodiment of the present application.
[0110] In one embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, it is used to perform a secure communication method. The method includes:
[0111] Obtain current electricity data, an identification code of a smart meter, and a first timestamp, wherein the first timestamp is the current system time of the smart meter; perform a first encryption process and a second encryption process on the electricity data, the identification code of the smart meter, and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively; upload the first ciphertext and the first message authentication code to a server, so that the server obtains the electricity data by decrypting the first ciphertext, and authenticates the obtained electricity data through the first message authentication code; receive feedback information sent by the server, and determine whether the server has successfully stored the electricity data based on the feedback information; if not, return to the operation of uploading the first ciphertext and the first message authentication code to the server.
[0112] Optionally, when the program is executed by a processor, it can also be used to execute the method provided in any embodiment of the present application.
[0113] The computer storage medium of the embodiment of the present application can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, - but not limited to - electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive lists) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (Random Access Memory, RAM), read-only memories (Read Only Memory, ROM), erasable programmable read-only memories (Erasable Programmable Read Only Memory, EPROM), flash memory, optical fibers, portable CD-ROMs, optical storage devices, magnetic storage devices, or any suitable combination of the above. Computer-readable storage media can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0114] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to: electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0115] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
[0116] The computer program code for performing the operation of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages (such as "C" language or similar programming languages). The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network (for example, including a local area network (LAN) or a wide area network (WAN)), or, it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0117] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0118] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A secure communication method, characterized in that: A smart electric meter applied to a distributed energy system, the method comprising: Acquire current power data, an identification code of the smart meter, and a first timestamp, wherein the first timestamp is the current system time of the smart meter; The electric quantity data, the identification code of the smart meter and the first timestamp are respectively subjected to a first encryption process and a second encryption process to obtain a first ciphertext and a first message authentication code, respectively; wherein the first message authentication code is obtained by performing a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp based on a preset key and using a second encryption algorithm; Uploading the first ciphertext and the first message authentication code to a server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code; receiving feedback information sent by the server, and judging whether the server has successfully stored the power data based on the feedback information; If not, returning to perform the operation of uploading the first ciphertext and the first message authentication code to the server; Before obtaining the current power data, the method further includes: Sending a registration request to the server, and acquiring and storing smart meter associated parameters according to the registration result; wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a cycle for uploading power data; Accordingly, the electric quantity data, the identification code of the smart meter and the first timestamp are subjected to a first encryption process and a second encryption process, including: Based on the preset key, the first encryption algorithm and the second encryption algorithm are used to perform a first encryption process and a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp, respectively; wherein the second encryption algorithm is a secure hash algorithm; The feedback information includes a second ciphertext and a second message authentication code generated by the server after encryption processing; Correspondingly, judging whether the server has successfully stored the power data based on the feedback information includes: Decrypting the second ciphertext using the preset key to obtain a power data storage result identifier and a second timestamp; Determine whether the power data storage result identifier and the second timestamp meet the preset conditions. If so, authenticate the power data storage result identifier through the second message authentication code, and determine whether the server has successfully stored the power data based on the authentication result.
2. The method according to claim 1, characterized in that The smart electric meter establishes a communication connection with the server through a network interface.
3. A secure communication method, characterized in that: Applied to a server in a distributed energy system, the method comprises: Receiving a first ciphertext and a first message authentication code uploaded by a smart meter, wherein the first ciphertext and the first message authentication code are obtained by performing a first encryption process on the current electric quantity data, the identification code of the smart meter and the first timestamp acquired by the smart meter; wherein the first message authentication code is obtained by performing a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp based on a preset key and using a second encryption algorithm; Decrypting the first ciphertext to obtain power data, and authenticating the power data using a first message authentication code; Generate feedback information according to the authentication result, and send the feedback information to the smart meter; The method further comprises: In response to a registration request sent by the smart meter, generating smart meter associated parameters; wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a period for uploading power data; Correspondingly, the smart meter performs a first encryption process and a second encryption process on the acquired current electricity data, the identification code of the smart meter and the first timestamp, respectively, including: Based on the preset key, the first encryption algorithm and the second encryption algorithm are used to perform a first encryption process and a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp, respectively; wherein the second encryption algorithm is a secure hash algorithm; The feedback information includes a second ciphertext and a second message authentication code generated by the server after encryption processing; the smart meter uses the preset key to decrypt the second ciphertext to obtain an electric quantity data storage result identifier and a second timestamp; Determine whether the power data storage result identifier and the second timestamp meet the preset conditions, and if so, authenticate the power data storage result identifier through the second message authentication code, and determine whether the server has successfully stored the power data according to the authentication result; The generating feedback information according to the authentication result includes: Generate a power data storage result identifier according to the authentication result; wherein the power data storage result identifier is used to indicate whether the power data has passed the authentication and has been stored in the server; The electric quantity data storage result identifier and the second timestamp are subjected to a third encryption process and a fourth encryption process to obtain feedback information including a second ciphertext and a second message authentication code; wherein the second timestamp is the current system time of the server.
4. A secure communication device, characterized in that: A smart meter configured in a distributed energy system, the device comprising: A collection module, used to obtain current power data, an identification code of the smart meter and a first timestamp, wherein the first timestamp is the current system time of the smart meter; A first encryption calculation module is used to perform a first encryption process and a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp, respectively, to obtain a first ciphertext and a first message authentication code, respectively; wherein the first message authentication code is obtained by performing a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp based on a preset key using a second encryption algorithm; a first sending module, configured to upload the first ciphertext and the first message authentication code to a server, so that the server obtains the power data by decrypting the first ciphertext, and authenticates the obtained power data by using the first message authentication code; A first receiving module receives feedback information sent by the server, and determines whether the server has successfully stored the power data based on the feedback information; A return module, configured to return to the operation of uploading the first ciphertext and the first message authentication code to the server when the judgment result is no; The device also includes: A first registration module is used to send a registration request to the server before obtaining the power data, and obtain and store smart meter associated parameters according to the registration result; wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a cycle for uploading power data; Correspondingly, the first encryption calculation module is specifically used to perform first encryption processing and second encryption processing on the power data, the identification code of the smart meter and the first timestamp respectively based on the preset key using the first encryption algorithm and the second encryption algorithm; wherein the second encryption algorithm is a secure hash algorithm; The feedback information includes a second ciphertext and a second message authentication code generated by the server after encryption processing; Accordingly, the first receiving module is further used for: Decrypting the second ciphertext using the preset key to obtain a power data storage result identifier and a second timestamp; Determine whether the power data storage result identifier and the second timestamp meet the preset conditions. If so, authenticate the power data storage result identifier through the second message authentication code, and determine whether the server has successfully stored the power data based on the authentication result.
5. A secure communication device, characterized in that: A server applied to a distributed energy system, the device comprising: A second receiving module is used to receive a first ciphertext and a first message authentication code uploaded by a smart meter, wherein the first ciphertext is obtained by performing a first encryption process on the current electric quantity data, the identification code of the smart meter and the first timestamp acquired by the smart meter; wherein the first message authentication code is obtained by performing a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp based on a preset key and using a second encryption algorithm; a decryption and authentication module, configured to decrypt the first ciphertext to obtain power data, and authenticate the power data using a first message authentication code; A feedback information generation and sending module, used to generate feedback information according to the authentication result, and send the feedback information to the smart meter; The device also includes: In response to a registration request sent by the smart meter, generating smart meter associated parameters; wherein the smart meter associated parameters at least include a preset key, an identification code of the smart meter, and a period for uploading power data; Correspondingly, the smart meter performs a first encryption process and a second encryption process on the acquired current electricity data, the identification code of the smart meter and the first timestamp, respectively, including: Based on the preset key, the first encryption algorithm and the second encryption algorithm are used to perform a first encryption process and a second encryption process on the electric quantity data, the identification code of the smart meter and the first timestamp, respectively; wherein the second encryption algorithm is a secure hash algorithm; The feedback information includes a second ciphertext and a second message authentication code generated by the server after encryption processing; Accordingly, the feedback information generated according to the authentication result is specifically used for: The smart electric meter uses the preset key to decrypt the second ciphertext to obtain an electric quantity data storage result identifier and a second timestamp; Determine whether the power data storage result identifier and the second timestamp meet the preset conditions, and if so, authenticate the power data storage result identifier through the second message authentication code, and determine whether the server has successfully stored the power data according to the authentication result; The feedback information generation and sending module includes: An identification generating unit, used to generate an electric quantity data storage result identification according to the authentication result; wherein the electric quantity data storage result identification is used to indicate whether the electric quantity data has passed the authentication and has been stored in the server; The encryption unit is used to perform a third encryption process and a fourth encryption process on the power data storage result identifier and the second timestamp to obtain feedback information including a second ciphertext and a second message authentication code; wherein the second timestamp is the current system time of the server.
6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the secure communication method as described in any one of claims 1-2 or claim 3.
7. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the secure communication method as described in any one of claims 1 to 2 or claim 3 is implemented.
Citation Information
Patent Citations
Method, device and equipment for transmitting data
CN108667601A
Vehicle electronic control unit (ECU) authentication method, device and equipment
CN109286500A
OTA method, system and device, SE module, program server and medium
CN110650478A
Data reading method, data reading device, metering equipment and server
CN111131156A
Statistical analysis method for secret key leakage resisting encrypted data aggregation in smart power grid
CN111294366A
