Command message response method, power terminal and communication system
By adopting the multicast method of command messages and the dual verification of time verification and MAC verification in the power system, the problem of low communication efficiency between the power terminal and the main station is solved, and more efficient and secure communication is achieved.
Patent Information
- Application Number
- CN202411448351.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-11
AI Technical Summary
The communication efficiency between the power terminal and the main station is low, especially when the number of power terminals increases, point-to-point communication method leads to a decrease in communication efficiency.
Communication is carried out by multicasting the command message. The power terminal receives the command message multicast by the main station and performs time checksum MAC verification. It only responds to the operation command in the command message after passing the verification.
The multicast method reduces the number of times the master sends command messages, improves communication efficiency, and ensures the integrity, timeliness and security of command messages through dual verification of time check and MAC verification.
Smart Images

Figure CN119420512A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a command message response method, a power terminal and a communication system. Background Art
[0002] The communication between the power terminal and the main station in the power system is the key to ensure the stable operation of the power system. At present, the power terminal and the main station communicate through point-to-point communication.
[0003] However, as the number of power terminals increases, the use of point-to-point communication will lead to a decrease in the communication efficiency between the power terminals and the master station. Summary of the invention
[0004] The present application provides a command message response method, a power terminal and a communication system, which can solve the problem of low communication efficiency between the power terminal and the master station in the related art. The technical solution is as follows:
[0005] On the one hand, a method for responding to a command message is provided, the method comprising:
[0006] Receive the command message multicast by the master station;
[0007] Performing time verification and message authentication code (MAC) verification on the command message;
[0008] If the command message passes the time check and the MAC check, respond to the operation command in the command message.
[0009] Optionally, performing time verification and data message authentication code MAC verification on the command message includes:
[0010] Performing time verification on the command message;
[0011] After the command message passes the time check, a MAC check is performed on the command message.
[0012] Optionally, the command message includes: a command header and a command data field, the command data field includes: a dispersion factor, a first index, a second index and a first MAC; performing MAC check on the command message includes:
[0013] Determine an initial value and a target key, wherein the initial value is determined based on the dispersion factor and the first index, and the target key is determined based on the dispersion factor and the second index;
[0014] Encrypting a target string based on the initial value and the target key to obtain a second MAC, the target string including: field values of each field included in the command header, the dispersion factor, the first index, and the second index;
[0015] Perform a MAC check on the command message based on the first MAC and the second MAC.
[0016] Optionally, encrypting the target string based on the initial value and the target key to obtain a second MAC includes:
[0017] Based on the initial value and the target key, the target character string is encrypted in the cipher block chaining mode of the national secret SM1 algorithm to obtain a second MAC.
[0018] Optionally, performing MAC verification on the command message based on the first MAC and the second MAC includes:
[0019] If the second MAC is the same as the first MAC, determining that the command message passes the MAC check;
[0020] If the second MAC is different from the first MAC, it is determined that the command message fails the MAC check.
[0021] Optionally, determine the initial value and target key, including:
[0022] The dispersion factor is dispersed based on the initial key indicated by the target index to obtain a target value;
[0023] Among them, the target index is the first index or the second index. When the target index is the first index, the target value is the initial value; when the target index is the second index, the target value is the target key.
[0024] Optionally, the dispersion factor is dispersed based on the initial key indicated by the target index to obtain a target value, including:
[0025] Based on the initial key indicated by the target index, the dispersion factor is dispersed in the ECB mode of the national encryption SM1 algorithm to obtain the target value.
[0026] Optionally, the command message includes: terminal time and master station time; performing time verification on the command message includes:
[0027] Determining the absolute value of the difference between the terminal time and the master station time;
[0028] If the absolute value is greater than the time interval, it is determined that the command message fails the time check;
[0029] If the absolute value is less than or equal to the time interval, it is determined that the command message passes the time check.
[0030] Optionally, after responding to the operation command in the command message, the method further includes:
[0031] Sending the execution result of the operation command to the master station.
[0032] In another aspect, a power terminal is provided, the power terminal comprising: a processor; the processor is configured to:
[0033] Receive the command message multicast by the master station;
[0034] Performing time verification and data message authentication code MAC verification on the command message;
[0035] If the command message passes the time check and the MAC check, respond to the operation command in the command message.
[0036] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for responding to the command message as described in the above aspects is implemented.
[0037] On the other hand, a communication system is provided, comprising: a master station, and a plurality of power terminals as described in the above aspects.
[0038] The beneficial effects brought about by the technical solution provided by this application include at least:
[0039] The present application provides a command message response method, a power terminal and a communication system, wherein the power terminal can receive the command message multicasted by the master station, and perform time check and MAC check on the command message, and respond to the operation command in the command message only after the command message passes the time check and MAC check. Since the command message is multicast, that is, the master station and the power terminal can communicate through multicast, compared with the point-to-point communication method, the master station can send the command message once, and it can achieve the effect of sending it to the power terminal at the same time, thereby effectively reducing the number of times the master station sends the command message and improving the communication efficiency. In addition, since the power terminal can perform double check of time check and MAC check on the command message, the integrity, timeliness and security of the command message can be effectively ensured.
[0040] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a structural diagram of a communication system provided in an embodiment of the present application;
[0042] Figure 2 It is a flowchart of a command message response method provided in an embodiment of the present application;
[0043] Figure 3 It is a flowchart of another command message response method provided in an embodiment of the present application;
[0044] Figure 4 is a schematic diagram of a command message provided in an embodiment of the present application;
[0045] Figure 5 This is a flow chart of a method for performing MAC verification on a command message provided by an embodiment of the present application;
[0046] Figure 6 It is a structural schematic diagram of a power terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0048] The present application embodiment provides a communication system, see Figure 1 The communication system includes: a plurality of power terminals 100 and a master station 200. Each power terminal 100 establishes a communication connection with the master station 200. Each power terminal 100 and the master station 200 has a security chip.
[0049] Optionally, each power terminal 100 may be a smart meter, a photovoltaic inverter, a power distribution terminal or a smart switch, etc.
[0050] The embodiment of the present application provides a method for responding to a command message, which is applied to a power terminal in a communication system, such as Figure 1 The power terminal 100 shown. Figure 2 , the method comprising:
[0051] Step 101: Receive a command message multicast by a master station.
[0052] The master station can obtain the multicast address (referred to as the group address) of the power terminal that joins the same multicast group, and send a command message to the group address, thereby realizing the multicast of the command message.
[0053] Step 102: Perform time verification and MAC verification on the command message.
[0054] After receiving the command message, the power terminal can perform time verification and MAC verification on the command message to verify the integrity and authenticity of the command message.
[0055] In an embodiment of the present application, the power terminal may first perform a time check on the command message, and after the command message passes the time check, perform a MAC check on the command message. In this way, the computing resources of the power terminal can be saved to a certain extent. Alternatively, the power terminal may perform both a time check and a MAC check on the command message.
[0056] Step 103: If the command message passes the time check and the MAC check, respond to the operation command in the command message.
[0057] If the power terminal determines that the command message passes the time check and MAC check, it can be determined that the command message is authenticated, that is, the command message is complete and legal. Then, the power terminal can parse the command message to obtain the operation command and respond to the operation command.
[0058] In summary, the embodiment of the present application provides a method for responding to command messages, and the power terminal can receive the command messages multicast by the master station, and perform time check and MAC check on the command messages, and respond to the operation commands in the command messages only after the command messages pass the time check and MAC check. Since the command messages are multicast, that is, the master station and the power terminal can communicate through multicast, compared with the point-to-point communication method, the master station can send the command message once to achieve the effect of sending it to the power terminal at the same time, thereby effectively reducing the number of times the master station sends the command message and improving the communication efficiency. In addition, since the power terminal can not only perform MAC check on the command message, but also perform time check on the command message, that is, perform double check of time check and MAC check, the integrity, timeliness and security of the command message can be effectively ensured.
[0059] The embodiment of the present application provides an example of the power terminal first performing time verification on the command message and then performing MAC verification to exemplarily illustrate the command message response method provided in the embodiment of the present application. The method can be applied to a communication system, for example Figure 1 The communication system shown. Figure 3 , the method may include:
[0060] Step 201: The master station multicasts a command message.
[0061] Among them, multicast is a data transmission method that realizes point-to-point transmission between a sender and multiple receivers. The sender is called a multicast source, and the set of receivers is called a multicast group. The multicast source sends a command message once, and the command message can be sent to multiple senders.
[0062] In the embodiment of the present application, the master station is the multicast source, and the multicast group includes multiple power terminals requesting the same data, that is, the multicast group is a terminal group including multiple power terminals. The multicast group is identified by a group address. Accordingly, the master station can send a command message to the group address, thereby realizing the multicast of the command message.
[0063] Among them, see Figure 4 The command message may include: a command header and a command data field. The command header may include: a CLA field, an INS field, a Pl field, a P2 field, and an Lc field. The field values of each field in the command header may be as shown in Table 1.
[0064] Table 1
[0065] Fields Field Value CLA 80 INS 26 P1 00 P2 00 Lc xxxx
[0066] As can be seen from Table 1, the field value of the CLA field can be 80, the field value of the INS field can be 26, the field value of the Pl field and the field value of the P2 field can both be 00, and the field value of the Lc field is xxxx. The length of the field value of the Lc field is 2 bytes. It can be understood that Table 1 only shows an optional example of the field value of each field, and does not limit the field value of each field.
[0067] Referring to Table 2, the command data field includes: a dispersion factor, a first index KID1, a second index KID2, command data (data), terminal time and time interval (time interval).
[0068] Table 2
[0069]
[0070]
[0071] Among them, the length of the dispersion factor is 8 bytes, including a 2-byte group address and a 6-byte master station time. The master station time refers to: the time of the master station when the master station sends a command message. The length of the first index and the length of the second index are 1 byte. The length of the command data is variable, and the command data includes a ciphertext and a first MAC. The ciphertext is obtained by the master station using the initial value and the target key to encrypt the plaintext. The first MAC can be obtained by the master station using the initial value and the target key to encrypt the target string.
[0072] The length of the terminal time is 7 bytes. The terminal time refers to the time of the power terminal, which can be obtained by the master station. The format of the terminal time can be year-month-day format, such as year-month-day-hour-minute-second. For example, assuming that the terminal time is 16:49:55 on June 5, 2024, the terminal time is 20240605164955, and the record format in the master station can be 0x20, 0x24, 0x06, 0x05, 0x16, 0x49, 0x55. Among them, 0x represents hexadecimal. The length of the time interval is 1 byte, and the unit of the time interval can be minutes (min).
[0073] It is understandable that the group addresses of different terminal groups are different. The master station can select the corresponding terminal group according to the actual situation, and then multicast the command message based on the group address of the terminal group. The group address of the power terminal can be shown in Table 3.
[0074] Table 3
[0075]
[0076]
[0077] As can be seen from Table 3, each group address is in binary format (binary, BIN). Group address 1 is 0002, group address 2 is 0004, group address 3 is 0006, and group address 8 is 0000. Table 3 only shows optional implementations of group addresses 1 to 8, and does not limit the values of the group addresses.
[0078] Step 202: The power terminal receives a command message.
[0079] After the master station multicasts the command message, each power terminal in the terminal group can receive the command message.
[0080] Step 203: The power terminal performs time verification on the received command message.
[0081] After each power terminal in the terminal group receives the command message, it can obtain the master station time, terminal time and time interval from the command message, and then perform time verification on the command message based on the master station time, terminal time and time interval to verify the legitimacy of the command message.
[0082] Specifically, the power terminal can determine the absolute value of the difference between the master station time and the terminal time, and compare the absolute value with the time interval. If the power terminal determines that the absolute value is less than or equal to the time interval, it can be determined that the command message has passed the time check, and then it can be determined that the command message is legal and has not been intercepted and tampered with by a third party. If the power terminal determines that the absolute value is greater than the time interval, it can be determined that the command message has not passed the time check, and then it can be determined that the command message is illegal, and the operation can be terminated.
[0083] Step 204: After determining that the command message passes the time check, the power terminal performs MAC check on the command message.
[0084] In the examples of this application, see Figure 5 The process of the power terminal performing MAC verification on the command message may include:
[0085] Step 2041, determine the initial value and target key.
[0086] The initial value can be determined based on the dispersion factor and the first index. The target key can be determined based on the dispersion factor and the second index.
[0087] In an embodiment of the present application, the power terminal can perform a dispersion process on the dispersion factor based on the initial key indicated by the target index to obtain a target value. The target index is the first index or the second index. The target value is the initial value or the target key. When the target index is the first index, the target value is the initial value. When the target index is the second index, the target value is the target key.
[0088] It can be understood that, based on the initial key indicated by the first index, the dispersion factor is dispersed to obtain the initial value, so that the initial values calculated by the master station and the power terminal can be unified to facilitate subsequent accurate MAC verification.
[0089] Optionally, the power terminal can perform a decentralized processing of the decentralized factor in the electronic codebook (ECB) mode of the national secret SM1 algorithm based on the initial key indicated by the target index to obtain the target value. In this way, the security of the communication between the master station and the power terminal can be effectively ensured to be high.
[0090] In an embodiment of the present application, the power terminal can obtain the first index and the second index from the command message. Then, the power terminal can obtain the initial value key indicated by the first index based on the first index, and obtain the initial value key indicated by the second index based on the second index.
[0091] It is understandable that the value of the first index and the value of the second index are different for different operation commands. That is, different indexes can be set according to different operation commands. In this way, security management of different services (such as reset, parameter setting, control and data forwarding) can be achieved, thereby increasing the security of service operations.
[0092] Table 4 shows the values of the first index KID1 and the second index KID2 under each operation command. Referring to Table 4, if the operation command is a reset command, that is, AFN = 01H, KID1 is 0x01 and KID2 is 0x11. If the operation command is a parameter setting (referred to as parameter setting) command, that is, AFN = 01H, KID1 is 0x01 and KID2 is 0x11. If the operation command is, that is, AFN = 02H, KID1 is 0x03 and KID2 is 0x13. If the operation command is a data forwarding command, that is, AFN = 01H, KID1 is 0x04 and KID2 is 0x14.
[0093] Table 4
[0094] Order KID1 KID2 Reset (AFN = 01H) 0x01 0x11 Set parameter (AFN=04H) 0x02 0x12 Control (AFN = 05H) 0x03 0x13 Data forwarding (AFN = 10H) 0x04 0x14
[0095] Step 2042: Encrypt the target string based on the initial value and the target key to obtain a second MAC.
[0096] The target string is determined based on the field values of the fields included in the command header, the dispersion factor, the first index, and the second index. For example, the target string may be composed of the field value of the CLA field, the field value of the INS field, the field value of the Pl field, the field value of the P2 field, the field value of the Lc field, the dispersion factor, the inverted dispersion factor, KID1, and KID2. It can be seen that in the process of calculating the second MAC, the dispersion factor and the inverted dispersion factor are used.
[0097] Optionally, the power terminal may encrypt the target character string in a cipher block chaining (CBC) mode of the national encryption SM1 algorithm based on the initial value and the target key to obtain a second MAC.
[0098] Step 2043: Perform MAC check on the command message based on the first MAC and the second MAC.
[0099] In the embodiment of the present application, after the power terminal calculates the second MAC, it can detect the difference between the second MAC and the first MAC to perform MAC verification on the command message. Specifically, if the power terminal determines that the second MAC is the same as the first MAC, it can be determined that the command message passes the MAC verification. If the power terminal determines that the second MAC is different from the first MAC, it can be determined that the command message does not pass the MAC verification.
[0100] According to the description of steps 201 to 204 above, the communication data between the master station and the power terminal is protected by ciphertext, time check and MAC check, and the target key, ciphertext and MAC check are all calculated by the national secret SM1 algorithm. Thus, the security and integrity of the communication data are effectively ensured.
[0101] Step 205: After the command message passes the MAC check, the power terminal responds to the operation command in the command message.
[0102] After the power terminal determines that the command message passes the MAC check, it can determine that the command message passes the authentication, and then the ciphertext in the command data field of the command message can be decrypted to obtain the plaintext. After that, the power terminal can respond to the operation command in the plaintext.
[0103] The operation command may be a reset command, a parameter setting command, a control command or a data forwarding command.
[0104] Step 206: The power terminal sends the execution result of the operation command to the master station.
[0105] After the power terminal responds to the operation command, it can send the execution result of the operation command to the master station, wherein the execution result can be a confirmation frame or a negative frame.
[0106] For example, assume that the command message multicast by the master station is "802600000026+0004+240531113451+0111+35E24FED569F8CAB78321C5B128DC79B3EA72563+20240531114051+04", where the master station time is 240531113451, the terminal time is 20240531114051, and the time interval is 04. Since the absolute value of the difference between the master station time and the terminal time is 6, which is greater than the time interval 04, the power terminal can determine that the command message is illegal and then terminate the operation.
[0107] Assume that the command message multicast by the master station is "802600000026+0004+240531113451+0111+35E24FED569F8CAB78321C5B128DC79B3EA72563+20240531113451+04", where the command header is 802600000026 and the dispersion factor is 0004+ 240531113451, the master station time is 240531113451, the first index KID1 is 01, the second index KID2 is 02, the ciphertext in the command data is 35E24FED569F8CAB78321C5B128DC79B, the first MAC is 3EA72563, the terminal time is 20240531113451, and the time interval is 04.
[0108] Since the absolute value of the difference between the master station time and the terminal time is 0, which is less than the time interval 04, the power terminal can determine that the command message is legal. Then, the power terminal can perform a dispersion process on the dispersion factor based on the initial key indicated by the first index to obtain an initial value, and can perform a dispersion process on the dispersion factor based on the initial key indicated by the second index to obtain a target key. Then, the power terminal can perform SM1-CBC mode encryption on the target string based on the initial value and the target key to obtain a second MAC. Among them, the target string is obtained based on "802600000026+0004+240531113451+0111".
[0109] Assuming that the second MAC obtained by the power terminal is 546E2F3C, since the second MAC is different from the first MAC in the command message, the power terminal can determine that the command message has not passed the MAC check, and then the operation can be terminated. Assuming that the second MAC obtained by the power terminal is 3EA72563, since the second MAC is the same as the first MAC in the command message, the power terminal can determine that the command message has passed the MAC check.
[0110] After the power terminal determines that the command message passes the MAC check, it can decrypt the ciphertext "35E24FED569F8CAB78321C5B128DC79B" in the command data field based on the initial value and the target key to obtain the plain text. The plain text is 05 6B 00 0040 03 59 13 10 16 44 13. The first byte in the plain text is AFN. Since the first byte is 05, that is, AFN = 05H, it is a control command, so the power terminal can respond to the control command and then feedback the execution result of the control command to the master station.
[0111] It is understandable that the response method of the above command message can be executed by the security chip in the power terminal and the security chip in the master station.
[0112] The power system includes a power terminal and a master station, and the power terminal can communicate with the master station. For example, the power terminal can transmit data to the master station so that the master station can monitor the operating status of the power terminal in real time, detect and handle abnormal situations in time, and ensure the stable operation of the power grid. In addition, the master station can remotely control the power terminal to perform operations such as remote power on and off and parameter setting on the power terminal, thereby improving the management efficiency of the power terminal.
[0113] In the related art, the power terminal and the master station mainly communicate through point-to-point communication. The point-to-point communication method establishes an independent communication link between the master station and each power terminal. Therefore, on the one hand, when multiple power terminals request the same data, the master station will need to send a certain data repeatedly, resulting in low communication efficiency between the master station and the power terminal; on the other hand, as the number of power terminals increases, the number of communication links will also increase dramatically, and each communication link will occupy a certain amount of network resources, resulting in low utilization of network resources, and increasing the complexity of the network, and then increasing the difficulty of network management and maintenance.
[0114] In the embodiment of the present application, the power terminal can communicate with the master station through multicast, so there is no need for the master station to repeatedly send data, thereby effectively improving the communication efficiency between the power terminal and the master station. And because there is no need to establish an independent communication link between each power terminal and the master station, compared with the point-to-point communication method, when the number of power terminals increases, it can avoid to a certain extent the reduction in the utilization rate of network resources and the increase in the difficulty of network management and maintenance.
[0115] It is understandable that the order of the steps of the command message response method provided in the embodiment of the present application can be appropriately adjusted, and the steps can be increased or decreased accordingly according to the situation. For example, step 203 and step 204 can be executed at the same time; or, step 206 can be deleted according to the situation. Any technician familiar with the technical field can easily think of a method of change within the technical scope disclosed in this application, which should be covered within the scope of protection of this application, so it will not be repeated.
[0116] In summary, the embodiment of the present application provides a method for responding to command messages, and the power terminal can receive the command messages multicast by the master station, and perform time check and MAC check on the command messages, and respond to the operation commands in the command messages only after the command messages pass the time check and MAC check. Since the command messages are multicast, that is, the master station and the power terminal can communicate through multicast, compared with the point-to-point communication method, the master station can send the command message once to achieve the effect of sending it to the power terminal at the same time, thereby effectively reducing the number of times the master station sends the command message and improving the communication efficiency. In addition, since the power terminal can not only perform MAC check on the command message, but also perform time check on the command message, that is, perform double check of time check and MAC check, the integrity, timeliness and security of the command message can be effectively ensured.
[0117] The present application embodiment provides a power terminal, see Figure 6 The power terminal 100 includes: a processor 110. The processor 110 is used for:
[0118] Receive the command message multicast by the master station;
[0119] Perform time check on command messages and MAC check on data message authentication code;
[0120] If the command message passes the time check and MAC check, the operation command in the command message is responded to.
[0121] Optionally, the command message is time-checked and the data message authentication code MAC is checked, including:
[0122] Perform time verification on command messages;
[0123] After the command message passes the time check, the command message is subjected to MAC check.
[0124] Optionally, the command message includes: a command header and a command data field, and the command data field includes: a dispersion factor, a first index, a second index and a first MAC. The processor 110 may be configured to:
[0125] Determine an initial value and a target key, wherein the initial value is determined based on a dispersion factor and a first index, and the target key is determined based on the dispersion factor and a second index;
[0126] Encrypting a target string based on the initial value and the target key to obtain a second MAC, the target string including: field values of each field included in the command header, a dispersion factor, a first index, and a second index;
[0127] Based on the first MAC and the second MAC, a MAC check is performed on the command message.
[0128] Optionally, the processor 110 may be configured to:
[0129] Based on the initial value and the target key, the target string is encrypted in the cipher block chaining mode of the national secret SM1 algorithm to obtain the second MAC.
[0130] Optionally, the processor 110 may be configured to:
[0131] If the second MAC is the same as the first MAC, it is determined that the command message passes the MAC check;
[0132] If the second MAC is different from the first MAC, it is determined that the command message fails the MAC check.
[0133] Optionally, the processor 110 may be configured to:
[0134] The dispersion factor is dispersed based on the initial key indicated by the target index to obtain a target value;
[0135] Among them, the target index is the first index or the second index. When the target index is the first index, the target value is the initial value; when the target index is the second index, the target value is the target key.
[0136] Optionally, the processor 110 may be configured to:
[0137] Based on the initial key indicated by the target index, the dispersion factor is dispersed in the ECB mode of the national encryption SM1 algorithm to obtain the target value.
[0138] Optionally, the command message includes: terminal time and master station time. The processor 110 may be configured to:
[0139] Determine the absolute value of the difference between the terminal time and the master station time;
[0140] If the absolute value is greater than the time interval, it is determined that the command message fails the time check;
[0141] If the absolute value is less than or equal to the time interval, it is determined that the command message passes the time check.
[0142] Optionally, the processor 110 may also be configured to:
[0143] Send the execution result of the operation command to the master station.
[0144] In summary, the embodiment of the present application provides a power terminal, which can receive the command message multicast by the master station, and perform time check and MAC check on the command message, and respond to the operation command in the command message only after the command message passes the time check and MAC check. Since the command message is multicast, that is, the master station and the power terminal can communicate through multicast, compared with the point-to-point communication method, the master station can send the command message once to achieve the effect of sending it to the power terminal at the same time, thereby effectively reducing the number of times the master station sends the command message and improving the communication efficiency. In addition, since the power terminal can not only perform MAC check on the command message, but also perform time check on the command message, that is, perform double check of time check and MAC check, it can effectively ensure the integrity, timeliness and security of the command message.
[0145] Please continue to see Figure 6 , the power terminal 100 also includes: a memory 130. The processor 110 and the memory 130 are connected, such as through a bus 120. Optionally, the power terminal 100 may also include a transceiver 140. It should be noted that in actual applications, the transceiver 140 is not limited to one, and the structure of the power terminal 100 does not constitute a limitation on the embodiments of the present application.
[0146] The processor 110 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 110 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0147] The bus 120 may include a path to transmit information between the above components. The bus 120 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 120 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0148] The memory 130 is used to store a computer program corresponding to the command message response method of the above embodiment of the present application, and the computer program is controlled and executed by the processor 110. The processor 110 is used to execute the computer program stored in the memory 130 to implement the content shown in the above method embodiment.
[0149] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, a method for responding to a command message provided in the above method embodiment is implemented.
[0150] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0151] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0152] 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.
[0153] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0154] In this application, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like 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 an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0155] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for responding to a command message, characterized in that: The method comprises: Receive the command message multicast by the master station; Performing time verification and data message authentication code MAC verification on the command message; If the command message passes the time check and the MAC check, respond to the operation command in the command message.
2. The method according to claim 1, characterized in that Performing time verification and data message authentication code MAC verification on the command message includes: Performing time verification on the command message; After the command message passes the time check, a MAC check is performed on the command message.
3. The method according to claim 2, characterized in that The command message includes: a command header and a command data field, wherein the command data field includes: a dispersion factor, a first index, a second index and a first MAC; performing MAC check on the command message includes: Determine an initial value and a target key, wherein the initial value is determined based on the dispersion factor and the first index, and the target key is determined based on the dispersion factor and the second index; Encrypting a target string based on the initial value and the target key to obtain a second MAC, the target string including: field values of each field included in the command header, the dispersion factor, the first index, and the second index; Perform a MAC check on the command message based on the first MAC and the second MAC.
4. The method according to claim 3, characterized in that Encrypting the target string based on the initial value and the target key to obtain a second MAC includes: Based on the initial value and the target key, the target character string is encrypted in the cipher block chaining mode of the national secret SM1 algorithm to obtain a second MAC.
5. The method according to claim 3, characterized in that: Performing MAC verification on the command message based on the first MAC and the second MAC includes: If the second MAC is the same as the first MAC, determining that the command message passes the MAC check; If the second MAC is different from the first MAC, it is determined that the command message fails the MAC check.
6. The method according to claim 3, characterized in that Determine the initial and target keys, including: The dispersion factor is dispersed based on the initial key indicated by the target index to obtain a target value; Among them, the target index is the first index or the second index. When the target index is the first index, the target value is the initial value; when the target index is the second index, the target value is the target key.
7. The method according to claim 5, characterized in that The dispersion factor is dispersed based on the initial key indicated by the target index to obtain a target value, including: Based on the initial key indicated by the target index, the dispersion factor is dispersed in the ECB mode of the national encryption SM1 algorithm to obtain the target value.
8. The method according to any one of claims 1 to 7, characterized in that: The command message includes: terminal time and master station time; performing time verification on the command message includes: Determining the absolute value of the difference between the terminal time and the master station time; If the absolute value is greater than the time interval, it is determined that the command message fails the time check; If the absolute value is less than or equal to the time interval, it is determined that the command message passes the time check.
9. The method according to any one of claims 1 to 7, characterized in that: After responding to the operation command in the command message, the method further includes: Sending the execution result of the operation command to the master station.
10. A power terminal, characterized in that: The power terminal comprises: a processor; the processor is used for: Receive the command message multicast by the master station; Performing time verification and data message authentication code MAC verification on the command message; If the command message passes the time check and the MAC check, respond to the operation command in the command message.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
12. A communication system, characterized in that: The communication system comprises: a master station, and a plurality of power terminals as claimed in claim 10.
Citation Information
Cited By
Secure computing method, device and system, electronic equipment and readable storage medium
CN121333574A