Secure communication methods, devices, air conditioning and storage media
By employing multi-channel dynamic switching and a chaotic sequence number verification mechanism, the vulnerability of a single communication interface to attacks is resolved, thereby improving communication security and reliability. This technology is suitable for the Internet of Things (IoT) and industrial control.
Patent Information
- Application Number
- CN202610135679.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-26
AI Technical Summary
Existing encrypted communication technologies mostly use a single communication interface, which makes them vulnerable to man-in-the-middle attacks such as ARP spoofing and SSL stripping, leading to the failure of communication security and reliability.
A multi-channel dynamic switching mechanism and a dynamic sequence number verification mechanism based on chaotic mapping are adopted. The communication interface is determined by frame counting and a pseudo-random jumping communication channel is generated. Combined with timestamp window verification, the communication security is enhanced.
It effectively resists man-in-the-middle attacks and replay attacks, enhances the security and anti-interference capabilities of communication systems, has good compatibility, and is suitable for high-real-time scenarios such as the Internet of Things and industrial control.
Smart Images

Figure CN122093100A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a secure communication method, device, air conditioner, and storage medium. Background Technology
[0002] Encrypted communication technology is a core support for ensuring the security of digital information transmission. It is widely used in key areas such as financial transactions, industrial control, and instant messaging. Its core objective is to defend against attacks such as data theft, tampering, and identity forgery through a combination of encryption algorithms and security protocols. With the popularization of technologies such as 5G and the Internet of Things, the demand for real-time and confidential data transmission continues to rise, placing higher requirements on the reliability of encrypted communication.
[0003] Existing encrypted communication technologies mostly employ a single communication interface for data transmission, meaning that encrypted data is sent and received via a fixed physical link or logical channel. While this approach is simple to deploy and highly compatible with protocols, it suffers from a significant single point of failure risk: when the communication interface is attacked by man-in-the-middle attacks such as ARP spoofing or SSL stripping, or when it is eavesdropped on by unauthorized devices, attackers can directly intercept the transmitted ciphertext and even crack the key through protocol vulnerabilities, leading to a complete failure of communication security and reliability. Summary of the Invention
[0004] To address the problem that existing encrypted communication technologies often rely on a single communication interface for data transmission, which is vulnerable to man-in-the-middle attacks such as ARP spoofing and SSL stripping, or can be monitored by unauthorized devices, allowing attackers to directly intercept ciphertext and even crack keys through protocol vulnerabilities, thus completely compromising communication security and reliability, this application provides a secure communication method, apparatus, air conditioner, and storage medium. The specific technical solution is as follows: In a first aspect, this application provides a secure communication method applied at a sending end, the method comprising: Obtain the data frames to be sent, and count the data frames that have been sent to get the number of frames sent; Based on the number of frames sent, a sending communication interface is determined from multiple candidate communication interfaces; The data frame to be sent is sent to the receiving end through the sending communication interface.
[0005] In an optional implementation, after acquiring the data frame to be sent, the method further includes: Detect whether the data frame to be sent is the first data frame; If the data frame to be sent is the first data frame, determine the communication interface agreed upon by the sending end and the receiving end. The data frame to be sent is sent to the receiving end through the communication interface agreed upon by both the sending and receiving ends; If the data frame to be sent is not the first data frame, it is determined that the step of counting the sent data frames to obtain the number of sent frames will be performed.
[0006] In an optional implementation, determining the sending communication interface from a plurality of candidate communication interfaces based on the number of frames sent includes: Obtain the communication interface switching parameters, and perform a modulo operation on the number of sent frames using the communication interface switching parameters as the divisor to obtain the remainder; From multiple candidate communication interfaces, find the candidate communication interface corresponding to the remainder, and determine the candidate communication interface corresponding to the remainder as the sending communication interface.
[0007] In an optional implementation, acquiring the data frame to be sent includes: Obtain the chaotic state and generate a sequence number based on the chaotic state; Obtain the data to be sent, and encapsulate the data to be sent and the sequence number into a data frame to be sent.
[0008] In an optional implementation, encapsulating the data to be sent and the sequence number into a data frame to be sent includes: Obtain the timestamp, and encapsulate the data to be sent, the sequence number, and the timestamp into a data frame to be sent.
[0009] In an optional implementation, generating a sequence number from the chaotic state includes: The chaotic state is amplified according to a preset scaling factor; The amplified chaotic state is rounded down to obtain the corresponding sequence number.
[0010] In an optional implementation, after sending the data frame to be sent to the receiving end through the sending communication interface, the method further includes: Obtain the chaos parameters agreed upon by both the sender and receiver, and update the chaos state according to the chaos parameters.
[0011] In an optional implementation, updating the chaotic state based on the chaotic parameters includes: Obtain the difference between the preset value and the chaotic state; Obtain the product of the chaotic parameters, the chaotic state, and the difference; The chaotic state is updated to the product.
[0012] Secondly, this application provides a secure communication method applied at a receiving end, the method comprising: Count the received data frames to obtain the number of received frames; Based on the number of received frames, a receiving communication interface is determined from multiple candidate communication interfaces; The receiving communication interface receives the data frames to be received sent by the sending end.
[0013] In an optional implementation, the method further includes, before execution: Detect whether the data frame to be received is being received for the first time; Upon receiving the first data frame to be received, determine the communication interface agreed upon by both the sending and receiving ends; The receiver receives the data frame to be received from the sender through the communication interface agreed upon by both the sender and receiver. If it is not the first time a data frame to be received is received, it is determined that the step of counting the received data frames to obtain the number of received frames will be performed.
[0014] In an optional implementation, determining the receiving communication interface from a plurality of candidate communication interfaces based on the number of received frames includes: Obtain the communication interface switching parameters, and perform a modulo operation on the number of received frames using the communication interface switching parameters as the divisor to obtain the remainder; From multiple candidate communication interfaces, find the candidate communication interface corresponding to the remainder, and determine the candidate communication interface corresponding to the remainder as the receiving communication interface.
[0015] In an optional implementation, the method further includes: Obtain the chaotic state and generate the expected sequence number based on the chaotic state; After receiving the data frame to be received from the sending end through the receiving communication interface, the method further includes: Based on the field length, the sequence number and the data to be received are parsed from the data frame to be received, and the sequence number is compared with the expected sequence number; Based on the comparison results, the data to be received is processed.
[0016] In an optional implementation, generating the expected sequence number through the chaotic state includes: The chaotic state is amplified according to a preset scaling factor; The amplified chaotic state is rounded down to obtain the corresponding expected sequence number.
[0017] In an optional implementation, parsing the sequence number and the data to be received from the data frame to be received according to the field length includes: Based on the field length, the sequence number, timestamp, and data to be received are parsed from the data frame to be received. The step of processing the data to be received based on the comparison result includes: Check if the timestamp is within the window range; If the sequence number matches the expected sequence number and the timestamp is within the window range, the data to be received is processed.
[0018] In an optional implementation, if the serial number matches the expected serial number and the timestamp is within a window range, the method further includes: Obtain the chaos parameters agreed upon by both the sender and receiver, and update the chaos state according to the chaos parameters.
[0019] In an optional implementation, updating the chaotic state based on the chaotic parameters includes: Obtain the difference between the chaotic state and the preset value; Obtain the product of the chaotic parameters, the chaotic state, and the difference; The chaotic state is updated to the product.
[0020] Thirdly, this application provides a secure communication device applied at a transmitting end, the device comprising: The module for counting sent frames is used to acquire data frames to be sent and count the data frames that have been sent to obtain the number of sent frames. The interface determination module is used to determine the sending communication interface from multiple candidate communication interfaces based on the number of frames sent; The data frame sending module is used to send the data frame to be sent to the receiving end through the sending communication interface.
[0021] Fourthly, this application provides a secure communication device applied at a receiving end, the device comprising: The received frame count module is used to count the received data frames and obtain the number of received frames; The interface determination module is used to determine the receiving communication interface from multiple candidate communication interfaces based on the number of received frames. The data frame receiving module is used to receive the data frames to be received sent by the sending end through the receiving communication interface.
[0022] Fifthly, an air conditioner is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the secure communication method described in either the first or second aspect above.
[0023] In a sixth aspect, a storage medium is also provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the secure communication method described in either the first or second aspect above.
[0024] In a seventh aspect, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the aforementioned secure communication methods.
[0025] Compared with the prior art, the technical solution provided in this application has the following advantages: The secure communication method provided in this application is applied to the sending end. By acquiring the data frame to be sent and counting the data frames that have been sent, the number of sent frames is obtained. Based on the number of sent frames, the sending communication interface is determined from multiple candidate communication interfaces, and the data frame to be sent is sent to the receiving end through the sending communication interface. In this way, by counting the sent data frames, the sending communication interface corresponding to the data frame to be sent can be determined. This can solve the technical problem that existing encrypted communication technologies mostly use a single communication interface to realize data transmission. When this communication interface is attacked by man-in-the-middle attacks such as ARP spoofing and SSL stripping, or is eavesdropped by illegal devices, attackers can directly intercept the transmitted ciphertext, or even crack the key through protocol vulnerabilities, resulting in the complete failure of communication security and reliability. Attached Figure Description
[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0027] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0029] Figure 1 A schematic diagram illustrating the implementation process of a secure communication method provided in this application embodiment; Figure 2A schematic diagram illustrating the implementation process of another secure communication method provided in this application embodiment; Figure 3 A schematic diagram illustrating the implementation process of a chaotic state update method provided in this application embodiment; Figure 4 A schematic diagram illustrating the implementation process of another secure communication method provided in this application embodiment; Figure 5 A schematic diagram illustrating the implementation process of another secure communication method provided in this application embodiment; Figure 6 This is a schematic diagram of the structure of a secure communication system provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a secure communication device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of another secure communication device provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of an air conditioner provided in an embodiment of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0031] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0032] like Figure 1 The diagram shown is a schematic representation of an implementation flow of a secure communication method provided in this application. This method is applied at the sending end and may specifically include the following steps: S101: Obtain the data frame to be sent and count the data frames that have been sent to obtain the number of sent frames.
[0033] In this embodiment, a data frame to be sent is acquired, and the number of sent data frames is counted to obtain the number of sent frames. A data frame to be sent refers to a data unit that will be sent through the communication interface, and may include payload data, sequence number, and timestamp, etc. A sent data frame refers to a data frame successfully sent by the sending end since the start of this communication session. The number of sent frames refers to the total number of data frames successfully transmitted by the sending end since the start of this communication session, such as 10 frames. The sending end refers to the device or functional module that initiates data transmission in the communication system.
[0034] Specifically, the sending end can count the data frames that have been sent using a frame counter. Specifically, the counter can be automatically incremented every time the sending end successfully sends a data frame. By reading the current value of this counter, the number of frames sent can be obtained.
[0035] S102, determine the sending communication interface from multiple candidate communication interfaces based on the number of frames sent.
[0036] In this embodiment, a sending communication interface is determined from multiple candidate communication interfaces based on the number of frames sent. A candidate communication interface refers to multiple physical or logical communication channels, such as Ethernet, provided by the sending end. These candidate communication interfaces can be used in parallel or alternately, thereby improving communication reliability and anti-interference capabilities. The sending communication interface refers to the communication interface selected for the data frame to be sent and actually used.
[0037] It should be noted that the sending end can select one of multiple candidate interfaces as the sending channel for this communication based on the number of frames already sent. This makes it difficult for attackers to predict the physical channel used in the next communication, thereby enhancing the anti-eavesdropping and anti-interference capabilities.
[0038] S103, the data frame to be sent is sent to the receiving end through the transmission communication interface.
[0039] In this embodiment, the data frame to be sent can be sent to the receiving end through the sending communication interface determined in the above steps. The receiving end refers to the device or functional module in the communication system that receives and processes data from the sending end, and has pre-agreed a communication protocol and synchronization mechanism with the sending end.
[0040] Based on the above description of the technical solution provided in the embodiments of this application, when applied to the sending end, the system obtains the data frame to be sent and counts the data frames that have been sent to obtain the number of sent frames. Based on the number of sent frames, the system determines the sending communication interface from multiple candidate communication interfaces and sends the data frame to be sent to the receiving end through the sending communication interface.
[0041] By counting the data frames that have been sent, the corresponding communication interface for the data frame to be sent can be determined. This can solve the technical problem that existing encrypted communication technologies often use a single communication interface to transmit data. When this communication interface is attacked by man-in-the-middle attacks such as ARP spoofing or SSL stripping, or is eavesdropped by illegal devices, attackers can directly intercept the transmitted ciphertext and even crack the key through protocol vulnerabilities, resulting in the complete failure of communication security and reliability.
[0042] This application combines a multi-channel dynamic switching mechanism with a dynamic sequence number verification mechanism based on chaotic mapping to construct dual security protection at both the physical and logical layers. Specifically, the deterministic interface switching based on frame counting causes pseudo-random jumps in the communication channel, making it difficult for attackers to continuously capture the complete data stream. Sequence numbers are generated using the initial value sensitivity and long-term unpredictability of chaotic systems, and combined with timestamp window verification, effectively resisting replay attacks and pattern analysis. Security enhancement is achieved through the synchronization rules between sequence numbers and interfaces without modifying existing communication protocols or introducing complex encryption algorithms, offering good compatibility and making it particularly suitable for scenarios with high real-time requirements, such as the Internet of Things and industrial control. This fundamentally solves the technical problem of reliance on a single communication interface, which makes communication security and reliability vulnerable to man-in-the-middle attacks.
[0043] Based on this, such as Figure 2 The diagram shown illustrates the implementation flow of another secure communication method provided in this application. This method may specifically include the following steps: S201, obtain the chaotic state, and generate a sequence number based on the chaotic state.
[0044] In this embodiment, a chaotic state is obtained, and a sequence number is generated based on the chaotic state. The chaotic state refers to a value generated iteratively according to a chaotic dynamic equation (such as a Logistic mapping). The sequence number can be generated by a sequence number generator mapping the chaotic state according to the chaotic dynamic equation.
[0045] Specifically, during communication initialization, the sending and receiving ends can pre-agree on the same chaotic system parameters (such as the control parameter r in the Logistic mapping) and initial chaotic state, thereby ensuring that both parties can independently generate consistent sequence numbers.
[0046] Generating sequence numbers from chaotic states can include the following steps: Step 11: Perform an amplification operation on the chaotic state according to the preset scaling factor.
[0047] In this embodiment, the chaotic state is amplified according to a preset scaling factor. The preset scaling factor is a pre-set value used to convert the chaotic state into a larger range of values. The preset scaling factor can be configured according to the sequence number length requirements of the communication system, and this embodiment does not limit it.
[0048] For example, if the preset scaling factor is 10 6 This can amplify chaotic states to the order of millions; if the preset scaling factor is 10... 2 This allows the chaotic state to be amplified to the range of hundreds of digits.
[0049] Step 12: Perform a rounding operation on the amplified chaotic state to obtain the corresponding sequence number.
[0050] In this embodiment of the application, a rounding operation (e.g., rounding down or rounding to the nearest whole number) is performed on the amplified chaotic state to obtain the corresponding sequence number.
[0051] For example, if the chaotic state is 0.6231, the preset scaling factor is 10. 6 Then, after magnification, it becomes 0.6231 × 10⁶ = 6231000.6231 × 10⁶. 6 =623100, after rounding, the sequence number is 623100. If the chaotic state is 0.6231, the preset scaling factor is 10. 2 Then, after magnification, it becomes 0.6231 × 10 2 =62.31, after performing the rounding operation, the serial number is 62.
[0052] S202, Obtain the data to be sent, and encapsulate the data to be sent and the sequence number into a data frame to be sent.
[0053] In this embodiment of the application, the data to be sent is obtained, and the data to be sent and the sequence number are encapsulated into a data frame to be sent.
[0054] Specifically, the data to be sent, the sequence number, and the timestamp can be encapsulated into a data frame to be sent by obtaining the timestamp. The timestamp is used to identify the time when the data frame was generated, which can provide the receiving end with a time verification basis to prevent replay attacks.
[0055] It should be noted that after sending the data frame to be sent to the receiving end through the sending communication interface, it may also include: obtaining the chaotic parameters agreed upon by both the sending end and the receiving end, and updating the chaotic state according to the chaotic parameters.
[0056] Specifically, updating the chaotic state based on chaotic parameters can be found in [reference needed]. Figure 3 The method shown. (As shown) Figure 3The diagram shown is a schematic representation of the implementation flow of a chaotic state update method provided in this application embodiment. The method specifically includes the following steps: S301, obtain the difference between the preset value and the chaotic state.
[0057] In this embodiment, the difference between a preset value and the chaotic state is obtained. The preset value can be a pre-defined value (such as 1).
[0058] For example, if the preset value is 1 and the chaotic state is 0.5, then the difference between the preset value and the chaotic state is 1 - 0.5 = 0.5.
[0059] S302, obtain the chaotic parameters, chaotic state, and the product of the differences.
[0060] In this embodiment, the chaotic parameters, chaotic state, and the product of the difference are obtained. The chaotic parameters are pre-set shared parameters (such as the growth rate parameter r in a Logistic mapping) between the sending and receiving ends, used to control the dynamic behavior of the chaotic system.
[0061] For example, the chaotic parameter r = 3.9, the chaotic state x = 0.5, and the difference 1. If x = 0.5, then the product is 3.9 × 0.5 × 0.5 = 0.975.
[0062] S303 updates the chaotic state to a product.
[0063] In this embodiment, the chaotic state is updated as a product. That is, the product of the chaotic parameters, the chaotic state, and the difference is used as the updated chaotic state. The updated chaotic state will be used to generate the sequence number of the next data frame, thereby ensuring that the sending end and the receiving end independently evolve the chaotic sequence based on the same rules and maintain the synchronization of the sequence numbers.
[0064] It should be noted that after acquiring the data frame to be sent, the following steps may also be included: Step 21: Detect whether the data frame to be sent is the first data frame.
[0065] In this embodiment, it is detected whether the data frame to be sent is the first data frame. The first data frame refers to the first frame of data in this communication session, which is used to establish initial communication synchronization and parameter confirmation.
[0066] Step 22: If the data frame to be sent is the first data frame, determine the communication interface agreed upon by the sending end and the receiving end.
[0067] In this embodiment of the application, when the data frame to be sent is the first data frame, the communication interface agreed upon by the sending end and the receiving end is determined.
[0068] For example, when the data frame to be sent is the first data frame, the communication interface can use the communication interface agreed upon by both the sending and receiving ends (such as UART1) to ensure the reliable establishment of the initial connection.
[0069] Step 23: Send the data frame to be sent to the receiving end through the communication interface agreed upon by both the sending and receiving ends.
[0070] In this embodiment of the application, the data frame to be sent can be sent to the receiving end through a communication interface agreed upon by both the sending end and the receiving end.
[0071] Step 24: If the data frame to be sent is not the first data frame, determine that the step of counting the data frames that have been sent will be performed to obtain the number of sent frames.
[0072] In this embodiment of the application, if the data frame to be sent is not the first data frame, it is determined that the step of counting the sent data frames to obtain the number of sent frames will be executed. That is, step S203 is executed.
[0073] S203, count the data frames that have been sent to obtain the number of frames sent.
[0074] In this embodiment of the application, this step is similar to step S101 above, and will not be described in detail here.
[0075] S204: Obtain the communication interface switching parameters, and perform a modulo operation on the number of frames sent, using the communication interface switching parameters as the divisor, to obtain the remainder.
[0076] In this embodiment, communication interface switching parameters are obtained. Using these parameters as divisors, a modulo operation is performed on the number of transmitted frames to obtain the remainder. The communication interface switching parameters refer to integer values pre-agreed upon and stored by the sending and receiving ends, used to control the dynamic switching of communication interfaces. The communication interface switching parameters can be the total number of candidate communication interfaces to ensure that the sending and receiving ends can synchronously switch to the same communication interface.
[0077] Specifically, the sending end reads the pre-stored communication interface switching parameter N (N is a positive integer and equal to the number of candidate communication interfaces), and then performs a modulo operation on the number of frames M sent, with N as the divisor, to obtain the remainder R = M mod N. For example, if N is 4 and the number of frames M sent is 9, then performing a modulo operation on the number of frames sent yields a remainder R = 9 mod 4 = 1.
[0078] S205: From multiple candidate communication interfaces, find the candidate communication interface corresponding to the remainder, and determine the candidate communication interface corresponding to the remainder as the sending communication interface.
[0079] In this embodiment of the application, the candidate communication interface corresponding to the remainder is searched from multiple candidate communication interfaces, and the candidate communication interface corresponding to the remainder is determined as the sending communication interface.
[0080] For example, there are four candidate communication interfaces, numbered sequentially from 0 to 3, corresponding to UART1, I2C1, SPI1, and CAN1 respectively. If the calculated remainder R = 2, then the communication interface numbered 2, i.e., SPI1, is selected as the transmission communication interface for this purpose.
[0081] By using a dynamic interface selection mechanism based on frame counting, the data frame transmission channel can switch between different physical interfaces according to a predetermined pattern, which can effectively increase the difficulty for attackers to continuously monitor or interfere, thereby significantly improving the security and anti-interference capability of the communication system.
[0082] S206, the data frame to be sent is sent to the receiving end through the transmission communication interface.
[0083] In this embodiment of the application, this step is similar to step S103 above, and will not be described in detail here.
[0084] Based on this, such as Figure 4 The diagram shown illustrates the implementation flow of another secure communication method provided in this application. This method is applied to the receiving end and may specifically include the following steps: S401, count the received data frames to obtain the number of received frames.
[0085] In this embodiment, the received data frames are counted to obtain the number of received frames. A received data frame refers to a data frame successfully received by the receiving end and passing preliminary verification such as frame format and checksum. For the receiving end, it refers to a data unit received through the communication interface. The number of received frames refers to the total number of data frames successfully received by the receiving end in the current session. Ideally, the number of received frames should match the number of frames sent by the sending end under the condition of no packet loss and no out-of-order delivery.
[0086] Specifically, the receiving end can continuously maintain an internal counter during the communication session to count the data frames successfully received from the sending end and preliminarily verified (such as frame format and checksum). Specifically, the receiving end automatically increments the counter each time it successfully receives a data frame, and the number of received frames can be obtained by reading the current value of this counter.
[0087] S402, determine the receiving communication interface from multiple candidate communication interfaces based on the number of received frames.
[0088] In this embodiment, a receiving communication interface is determined from multiple candidate communication interfaces based on the number of received frames. A candidate communication interface refers to a set of multiple physical or logical communication interfaces (e.g., UART, I2C, SPI, CAN, etc.) available to the receiving end, whose number, type, and arrangement order are consistent with a pre-agreed agreement from the sending end. The communication interface is used to receive the received data frames.
[0089] Specifically, the receiving end can adopt the same interface selection logic as the sending end, that is, based on the same communication interface switching parameters and frame count value, dynamically determine the interface that should be listened to or received by the current data through modulo operation, thereby ensuring that the sending and receiving parties use the same physical or logical channel at the same time and achieve communication synchronization.
[0090] S403 receives the data frame to be received sent by the sending end through the receiving communication interface.
[0091] In this embodiment of the application, a data frame to be received is received from the sending end via a receiving communication interface.
[0092] The secure communication method provided in this application is applied to the receiving end. It counts the received data frames to obtain the number of received frames, and determines the receiving communication interface from multiple candidate communication interfaces based on the number of received frames. The receiving communication interface then receives the data frames to be received from the sending end. By counting the received data frames to determine the corresponding receiving communication interface, this method solves the technical problem that existing encrypted communication technologies often use a single communication interface for data transmission. When this communication interface is attacked by man-in-the-middle attacks such as ARP spoofing or SSL stripping, or is eavesdropped by unauthorized devices, attackers can directly intercept the transmitted ciphertext and even crack the key through protocol vulnerabilities, leading to a complete failure of communication security and reliability.
[0093] Based on this, such as Figure 5 The diagram shown illustrates the implementation flow of another secure communication method provided in this application. This method is applied to the receiving end and may specifically include the following steps: S501, detect whether it is the first time to receive the data frame to be received.
[0094] In this embodiment, it is detected whether a data frame to be received is being received for the first time. Here, "receiving a data frame for the first time" means that in the current communication session, the receiving end has not yet successfully received any valid data frames, and the data frame to be received is the first frame of data after the session was established.
[0095] S502, upon first receiving a data frame to be received, determines the communication interface agreed upon by both the sending and receiving ends.
[0096] In this embodiment of the application, when a data frame to be received is received for the first time, the communication interface agreed upon by both the sending end and the receiving end is determined. Specifically, the receiving end can obtain the fixed communication interface (e.g., UART1) agreed upon by both parties (i.e., the receiving end and the sending end) during the session initialization phase from the pre-stored configuration information (such as pre-stored device parameters) to establish the initial connection.
[0097] S503 receives the data frames to be received from the sender through the communication interface agreed upon by both the sender and receiver.
[0098] In this embodiment of the application, the data frame to be received sent by the sending end can be received through the communication interface agreed upon by both the sending end and the receiving end.
[0099] S504, if it is not the first time to receive a data frame to be received, determine that the step of counting the received data frames to obtain the number of received frames will be performed.
[0100] In this embodiment of the application, if it is not the first time a data frame to be received is received, it is determined that the step of counting the received data frames to obtain the number of received frames will be performed. That is, step S505 is executed.
[0101] S505 counts the received data frames to obtain the number of received frames.
[0102] In this embodiment of the application, this step is similar to step S401 above, and will not be described in detail here.
[0103] S506 determines the receiving communication interface from multiple candidate communication interfaces based on the number of received frames.
[0104] In this embodiment of the application, the receiving communication interface can be determined from multiple candidate communication interfaces based on the number of received frames.
[0105] Specifically, the receiving communication interface can be determined by obtaining the communication interface switching parameters, performing a modulo operation on the number of received frames using the communication interface switching parameters as the divisor, obtaining the remainder, searching for the candidate communication interface corresponding to the remainder from multiple candidate communication interfaces, and then identifying the candidate communication interface corresponding to the remainder as the receiving communication interface. The communication interface switching parameters are the same as those for the sending end.
[0106] For example, if the communication interface switching parameter (which is the same as the total number of candidate communication interfaces) is 4, and the number of frames received is 7, then a modulo operation is performed on the number of received frames, and the remainder is 3. The remainder 3 corresponds to the 4th interface in the candidate interface list (such as CAN1), so CAN1 is determined as the receiving communication interface for this time.
[0107] S507 receives data frames to be received from the sending end through the receiving communication interface.
[0108] In this embodiment of the application, this step is similar to step S403 above, and will not be described in detail here.
[0109] S508: Obtain the chaotic state and generate the expected sequence number based on the chaotic state.
[0110] In this embodiment, a chaotic state is obtained, and a predicted sequence number is generated based on the chaotic state. The chaotic state refers to the current state value independently and iteratively calculated by the receiving end based on the chaotic system parameters and initial state pre-shared with the sending end. The predicted sequence number is used for comparison and verification with the actual sequence number in the received data frame.
[0111] Specifically, generating a desired sequence number from a chaotic state can include the following steps: Step 81: Perform an amplification operation on the chaotic state according to the preset scaling factor.
[0112] In this embodiment, the chaotic state is amplified according to a preset scaling factor. Specifically, refer to step 11 above.
[0113] Step 82: Perform a rounding operation on the amplified chaotic state to obtain the corresponding expected sequence number.
[0114] In this embodiment, the amplified chaotic state is rounded down to obtain the corresponding expected sequence number. Specifically, refer to step 12 above.
[0115] S509: Parse the sequence number and the data to be received from the data frame to be received according to the field length, and compare the sequence number with the expected sequence number.
[0116] In this embodiment, the sequence number and the data to be received can be parsed from the data frame to be received according to the field length, and the sequence number can be compared with the expected sequence number. Here, the field length refers to the fixed number of bytes predefined in the communication protocol for each component within the data frame (such as frame header, sequence number, timestamp, data payload, checksum, etc.). The sequence number refers to the sequence number value generated by the sending end, parsed from the received data frame according to the field length. The data to be received refers to the payload portion parsed from the data frame to be received.
[0117] To parse the sequence number and the data to be received from the data frame to be received according to the field length, it can be done by parsing the sequence number, timestamp, and the data to be received from the data frame to be received according to the field length.
[0118] For example, the data frame format is: 4-byte sequence number + 8-byte timestamp + N-byte payload data. The receiving end, according to this field length definition, reads 4 bytes from the beginning of the received data frame buffer to obtain the sequence number, then reads 8 bytes to obtain the timestamp; the remaining portion is the data to be received. Then, the parsed sequence number is compared with the expected sequence number generated in step S508.
[0119] S510 processes the received data based on the comparison results.
[0120] In this embodiment of the application, the data to be received can be processed based on the comparison results.
[0121] Specifically, processing the received data based on the comparison results may include the following steps: Step 1: Check if the timestamp is within the window range.
[0122] In this embodiment, it is verified whether the timestamp is within the window range. The window range refers to a valid time interval set locally by the receiving end, which can be based on the current system time of the receiving end, and extended forward and backward by a preset tolerance value (e.g., ±50 milliseconds).
[0123] Step 2: If the sequence number matches the expected sequence number and the timestamp is within the window range, process the data to be received. For example, execute the corresponding control commands or store the data.
[0124] In this embodiment of the application, the data to be received is processed when the sequence number is consistent with the expected sequence number and the timestamp is within the window range.
[0125] Step 3: If the sequence number matches the expected sequence number and the timestamp is within the window range, obtain the chaos parameters agreed upon by both the sender and receiver, and update the chaos state according to the chaos parameters.
[0126] In this embodiment of the application, when the sequence number is consistent with the expected sequence number and the timestamp is within the window range, the chaotic parameters agreed upon by both the sender and receiver are obtained, and the chaotic state is updated according to the chaotic parameters.
[0127] Specifically, updating the chaotic state based on the chaotic parameters may include: obtaining the difference between the chaotic state and a preset value; obtaining the product of the chaotic parameters, the chaotic state, and the difference; and updating the chaotic state to the product.
[0128] If the chaotic parameter r = 3.9 and the current chaotic state x = 0.6, then calculate the difference 1. 0.6 = 0.41, the product is 3.9 × 0.6 × 0.4 = 0.9363, update the chaotic state to 0.936.
[0129] Furthermore, the secure communication method provided in this application is illustrated with specific examples in the embodiments of this application: like Figure 6 The diagram shown is a structural schematic of a secure communication system provided in an embodiment of this application. Specifically, it may include: a chaotic state maintenance module, a sequence number generation module, a timestamp binding module, a data frame encapsulation module, a data frame parsing module, a timestamp verification module, a sequence number verification module, a chaotic state update module, a data sending module, and a data receiving module.
[0130] In the initial stage, chaotic parameters are pre-stored in the memories of the sender and receiver during communication. The memories contain independently stored parameters that do not change with the transmission of data frames. After each transmission or reception, the chaotic state is updated according to the preset parameters to maintain synchronization between the sender and receiver's chaotic states.
[0131] Specifically, the sender and receiver pre-store the same chaotic parameter r (e.g., r=3.9) and initial state x0 (e.g., x0=0.5). After each data frame is sent or received, the chaotic state is updated by calculating x_next using the formula x_next=r×current_state×(1-current_state). In the next calculation, the value of current_state becomes x_next. This dynamic change of the x_next value ensures that the sequence numbers of both parties are dynamically synchronized.
[0132] The transmitting and receiving ends are connected through multiple communication interfaces. Device table parameters are pre-stored in the memory of both communicating ends, and the two ends switch synchronously based on counters or timestamps. The device table parameters include the device name (such as UART, I2C, SPI, etc.), channel number (such as 1, 2, 3, 4, corresponding to the hardware interface numbers between the transmitting and receiving ends), and the device switching parameter switch_interval. Among them, the device table parameters are used to describe the logical mapping of the communication interface (device name + channel number) and the switching rule (switch_interval), dynamically switching the hardware communication channel.
[0133] The sender processes the data. A sequence number generator uses a chaotic mapping to generate sequence numbers in real time, for example, `seq_num = func(x_next × 10⁶)`. The sequence number and timestamp are bound to the data and encapsulated into the final transmission frame. After sending data, the chaotic state is updated. Both the sender and receiver use the same logic to update the chaotic state, for example, `x_next = r × current_state × (1 - current_state)`. Here, `r` is the chaotic parameter, `current_state` is the current chaotic state, and `x_next` is the chaotic state of the next data frame.
[0134] For transmission management, the sender selects a specific device from the device table to send a data frame (the first frame). Alternatively, the sender counts the data frames already sent, and based on a counter or timestamp, combined with device switching parameters (such as the data frame format), calculates the channel number of the selected device, and selects this channel to send a data frame (not the first frame). The calculation method can be: device channel number = frame_counter % switch_interval, where frame_counter is the total number of data frames sent so far, and switch_interval is the device switching parameter agreed upon by both parties and pre-stored in the device parameter table.
[0135] The receiver verifies the data, parsing the sequence number and timestamp from the received data frame according to its length. A timestamp verifier checks if the timestamp is within a window range; for example, a window time of ±50ms can be set to determine if it is a valid frame. A sequence number verifier matches a chaotic orbit to verify the validity and continuity of the sequence number. The chaotic orbit is consistent with the sender's, for example, seq_num=func(x_next×10). 6 ).
[0136] For receiving management, the receiver selects a specific device to receive the first data frame according to the pre-stored device table parameters. Alternatively, the receiver counts the received data frames and, based on a counter or timestamp and combined with device switching parameters, calculates the selected device channel number and selects this channel to send a data frame (not the first frame). The calculation method can be frame_counter %switch_interval, where frame_counter is the total number of data frames received so far, and switch_interval is the device switching parameter agreed upon by both parties and pre-stored in the device parameter table.
[0137] Meanwhile, the aforementioned secure communication system enhances communication security. The dual uncertainty of dynamic (chaotic) serial numbers and dynamic channel switching (device table strategy) results in higher security. The combination of serial numbers and timestamps effectively defends against attacks.
[0138] Corresponding to the above method embodiments, this application also provides a secure communication device, such as... Figure 7 As shown, the device is applied to the transmitting end and may include: a transmitted frame count statistics module 701, an interface determination module 702, and a data frame transmission module 703.
[0139] The sent frame count module 701 is used to acquire the data frames to be sent and count the data frames that have been sent to obtain the number of sent frames; The interface determination module 702 is used to determine the sending communication interface from multiple candidate communication interfaces based on the number of frames sent; The data frame sending module 703 is used to send the data frame to be sent to the receiving end through the sending communication interface.
[0140] Corresponding to the above method embodiments, this application also provides another secure communication device, such as... Figure 8 As shown, the device is applied to the receiving end and may include: a received frame count statistics module 801, an interface determination module 802, and a data frame receiving module 803.
[0141] The received frame count module 801 is used to count the received data frames and obtain the number of received frames; The interface determination module 802 is used to determine the receiving communication interface from multiple candidate communication interfaces based on the number of received frames. The data frame receiving module 803 is used to receive the data frame to be received sent by the sending end through the receiving communication interface.
[0142] This application also provides an air conditioner, such as... Figure 9 As shown, it includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904. Memory 903 is used to store computer programs; The processor 901, when executing a program stored in the memory 903, implements any of the secure communication methods described in the embodiments.
[0143] The communication bus mentioned above for air conditioning can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0144] The communication interface is used for communication between the air conditioner and other devices.
[0145] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0146] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0147] In another embodiment provided in this application, a storage medium is also provided, which stores instructions that, when run on a computer, cause the computer to execute any of the secure communication methods described in the above embodiments.
[0148] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the secure communication methods described in the above embodiments.
[0149] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a storage medium or transmitted from one storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0150] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0151] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0152] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A secure communication method, characterized in that, Applied to the sending end, the method includes: Obtain the data frames to be sent, and count the data frames that have been sent to get the number of frames sent; Based on the number of frames sent, a sending communication interface is determined from multiple candidate communication interfaces; The data frame to be sent is sent to the receiving end through the sending communication interface.
2. The method according to claim 1, characterized in that, After acquiring the data frame to be sent, the process further includes: Detect whether the data frame to be sent is the first data frame; If the data frame to be sent is the first data frame, determine the communication interface agreed upon by the sending end and the receiving end. The data frame to be sent is sent to the receiving end through the communication interface agreed upon by both the sending and receiving ends; If the data frame to be sent is not the first data frame, it is determined that the step of counting the sent data frames to obtain the number of sent frames will be performed.
3. The method according to claim 1, characterized in that, The step of determining the sending communication interface from multiple candidate communication interfaces based on the number of frames sent includes: Obtain the communication interface switching parameters, and perform a modulo operation on the number of sent frames using the communication interface switching parameters as the divisor to obtain the remainder; From multiple candidate communication interfaces, find the candidate communication interface corresponding to the remainder, and determine the candidate communication interface corresponding to the remainder as the sending communication interface.
4. The method according to claim 1, characterized in that, The step of acquiring the data frame to be sent includes: Obtain the chaotic state and generate a sequence number based on the chaotic state; Obtain the data to be sent, and encapsulate the data to be sent and the sequence number into a data frame to be sent.
5. The method according to claim 4, characterized in that, The step of encapsulating the data to be sent and the sequence number into a data frame to be sent includes: Obtain the timestamp, and encapsulate the data to be sent, the sequence number, and the timestamp into a data frame to be sent.
6. The method according to claim 4, characterized in that, The step of generating a sequence number through the chaotic state includes: The chaotic state is amplified according to a preset scaling factor; The amplified chaotic state is rounded down to obtain the corresponding sequence number.
7. The method according to any one of claims 4 to 6, characterized in that, After sending the data frame to be sent to the receiving end through the sending communication interface, the method further includes: Obtain the chaos parameters agreed upon by both the sender and receiver, and update the chaos state according to the chaos parameters.
8. The method according to claim 7, characterized in that, The step of updating the chaotic state according to the chaotic parameters includes: Obtain the difference between the preset value and the chaotic state; Obtain the product of the chaotic parameters, the chaotic state, and the difference; The chaotic state is updated to the product.
9. A secure communication method, characterized in that, Applied to the receiving end, the method includes: Count the received data frames to obtain the number of received frames; Based on the number of received frames, a receiving communication interface is determined from multiple candidate communication interfaces; The receiving communication interface receives the data frames to be received sent by the sending end.
10. The method according to claim 9, characterized in that, Before executing the method, the following is also included: Detect whether the data frame to be received is being received for the first time; Upon receiving the first data frame to be received, determine the communication interface agreed upon by both the sending and receiving ends; The receiver receives the data frame to be received from the sender through the communication interface agreed upon by both the sender and receiver. If it is not the first time a data frame to be received is received, it is determined that the step of counting the received data frames to obtain the number of received frames will be performed.
11. The method according to claim 9, characterized in that, The step of determining the receiving communication interface from multiple candidate communication interfaces based on the number of received frames includes: Obtain the communication interface switching parameters, and perform a modulo operation on the number of received frames using the communication interface switching parameters as the divisor to obtain the remainder; From multiple candidate communication interfaces, find the candidate communication interface corresponding to the remainder, and determine the candidate communication interface corresponding to the remainder as the receiving communication interface.
12. The method according to claim 9, characterized in that, The method further includes: Obtain the chaotic state and generate the expected sequence number based on the chaotic state; After receiving the data frame to be received from the sending end through the receiving communication interface, the method further includes: Based on the field length, the sequence number and the data to be received are parsed from the data frame to be received, and the sequence number is compared with the expected sequence number; Based on the comparison results, the data to be received is processed.
13. The method according to claim 12, characterized in that, The step of generating the expected sequence number through the chaotic state includes: The chaotic state is amplified according to a preset scaling factor; The amplified chaotic state is rounded down to obtain the corresponding expected sequence number.
14. The method according to claim 12, characterized in that, The step of parsing the sequence number and the data to be received from the data frame to be received according to the field length includes: Based on the field length, the sequence number, timestamp, and data to be received are parsed from the data frame to be received. The step of processing the data to be received based on the comparison result includes: Check if the timestamp is within the window range; If the sequence number matches the expected sequence number and the timestamp is within the window range, the data to be received is processed.
15. The method according to claim 14, characterized in that, If the serial number matches the expected serial number and the timestamp is within a window range, the method further includes: Obtain the chaos parameters agreed upon by both the sender and receiver, and update the chaos state according to the chaos parameters.
16. The method according to claim 15, characterized in that, The step of updating the chaotic state according to the chaotic parameters includes: Obtain the difference between the chaotic state and the preset value; Obtain the product of the chaotic parameters, the chaotic state, and the difference; The chaotic state is updated to the product.
17. A secure communication device, characterized in that, Applied to the transmitting end, the device includes: The module for counting sent frames is used to acquire data frames to be sent and count the data frames that have been sent to obtain the number of sent frames. The interface determination module is used to determine the sending communication interface from multiple candidate communication interfaces based on the number of frames sent; The data frame sending module is used to send the data frame to be sent to the receiving end through the sending communication interface.
18. A secure communication device, characterized in that, Applied to the receiving end, the device includes: The received frame count module is used to count the received data frames and obtain the number of received frames; The interface determination module is used to determine the receiving communication interface from multiple candidate communication interfaces based on the number of received frames. The data frame receiving module is used to receive the data frames to be received sent by the sending end through the receiving communication interface.
19. An air conditioner, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-16.
20. A storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-16.
