A terminal device-oriented off-line end-to-end secure data communication method and system
Patent Information
- Application Number
- CN202610844436.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-11
- Publication Date
- 2026-10-30
AI Technical Summary
[0008]本发明旨在解决离线场景下终端近场通信的身份核验不可靠、密钥易破解、数据易被窃听篡改、传输抗干扰能力弱等问题,依托硬件安全模块与物理熵增强密钥协商,结合认证加密与自适应抗扰传输,实现纯离线端到端安全数据通信,保障终端交互的安全性与可靠性
1.本发明的面向终端设备的离线端对端安全数据通信方法,通过在终端设备离线临近状态下借助低功耗无线模块建立连接,开展双向身份认证并使用预置硬件安全模块验证身份标识,同时结合环境物理熵值与椭圆曲线密钥交换方法协商生成唯一会话对称密钥,能够在无网络支持的场景下完成设备间的身份合法性核验,依托硬件安全模块实现本地安全验签,杜绝非法设备接入通信链路。环境物理熵值与椭圆曲线运算相结合的方式,可生成不可重复的会话对称密钥,密钥仅在本地运算生成无需在空中传输,有效降低密钥被窃取的风险,提升密钥的抗破解性能,为后续数据加密与解密提供安全的密钥基础,满足离线场景下自主密钥协商的技术要求。
Smart Images

Figure CN123021144A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of device communication technology, and more specifically, relates to an offline end-to-end secure data communication method and system for terminal devices. Background Technology
[0002] With the widespread adoption of mobile smart terminals and IoT devices, near-field data interaction between terminal devices has become a core communication method in various digital scenarios. In offline scenarios such as industrial inspection, emergency rescue, and field operations where there is no network coverage or network interruption, terminal devices need to rely on near-field channels to complete autonomous data transmission, leading to a continuous and rapid increase in the practical application demand for offline proximity communication.
[0003] Current mainstream near-field communication (NFC) technologies for terminals heavily rely on cloud servers for identity authentication and key management, making it impossible to achieve autonomous and secure interaction without a network. Traditional low-power NFC protocols lack native security mechanisms, making the communication process highly vulnerable to illegal eavesdropping, data tampering, and malicious replay attacks, and the legitimacy of device identities is difficult to verify effectively.
[0004] Existing key negotiation schemes mostly employ pure mathematical cryptographic algorithms, failing to incorporate the physical environment characteristics of the device when generating key materials. This results in significant shortcomings in key uniqueness and resistance to cracking. Some schemes only implement security protection at the software level, neglecting to utilize hardware security modules for identity verification and key calculation. This leads to a low level of security protection, making them vulnerable to malicious breaches.
[0005] Near-field communication channels are susceptible to environmental noise and narrowband interference, often resulting in out-of-order data transmission, packet loss, and bit errors. Traditional transmission modes with fixed coding redundancy and fixed frequencies cannot adapt to complex channel environments, and their communication stability fails to meet practical application requirements.
[0006] In addition, most existing secure communication solutions do not integrate data encryption, integrity verification and anti-replay mechanisms into a single design. The data processing flow is complex and the power consumption is high, making it difficult to meet the battery life requirements of low-power terminal devices.
[0007] Secure authentication, reliable key negotiation, interference-resistant data transmission, and integrated data protection for terminal devices in offline scenarios have become pressing technical challenges for the industry. Developing a fully offline, hardware-secured end-to-end secure data communication solution that integrates physical entropy-enhanced keys and adaptive interference-resistant transmission is of significant practical importance for improving the security and reliability of offline near-field communication and supporting secure terminal interaction in various scenarios such as industry, emergency response, and consumer applications. Summary of the Invention
[0008] This invention aims to solve the problems of unreliable identity verification, easy key cracking, easy data eavesdropping and tampering, and weak anti-interference capability in offline terminal near-field communication. By relying on hardware security modules and physical entropy-enhanced key negotiation, combined with authentication encryption and adaptive anti-interference transmission, it realizes pure offline end-to-end secure data communication, ensuring the security and reliability of terminal interaction.
[0009] To address the aforementioned deficiencies or improvement needs of existing technologies, as a first aspect of this invention, the present invention provides an offline end-to-end secure data communication method for terminal devices, comprising: S1. In the offline proximity state, the first terminal device and the second terminal device establish a connection and perform two-way authentication through the low-power wireless module; both parties use the pre-set hardware security module to verify the identity identifier, and negotiate to generate a unique session symmetric key by combining the environmental physical entropy value and the elliptic curve key exchange method. S2. The first terminal device uses the session symmetric key to perform encryption operations on the plaintext data to be transmitted in the authentication encryption mode to generate ciphertext data blocks, and calculates and generates a data integrity verification tag; then, the ciphertext data blocks, verification tags and anti-replay header information are encapsulated into an offline secure data packet; S3. The first terminal device sends the offline security data packet through the near-field communication channel, and dynamically adjusts the forward error correction coding redundancy and performs pseudo-random frequency jumps according to the channel noise environment during transmission; the second terminal device demodulates and decodes the received signal, performs out-of-order rearrangement and deduplication processing, and reassembles it to obtain a complete offline security data packet. S4. The second terminal device uses the session symmetric key to decrypt the reassembled data packet and recalculates the verification tag on the decrypted plaintext data; if the verification tag is consistent with the integrity verification tag carried in the data packet, the data is confirmed to have not been tampered with and the service processing is performed; otherwise, the data is discarded and an error signal is sent.
[0010] Furthermore, the two-way authentication in S1 specifically includes: The first terminal device and the second terminal device establish an initial handshake connection through Bluetooth Low Energy or Ultra Wideband communication modules and exchange their respective security certificates. The verification of identity using a pre-built hardware security module refers to performing local verification of the digital signature of the security certificate by calling the security element or trusted execution environment embedded in the terminal device.
[0011] Furthermore, in step S1, a unique session symmetric key is negotiated and generated by combining the environmental physical entropy value with the elliptic curve key exchange method, specifically including: Both devices collect acceleration noise data from built-in sensors or ambient noise data from microphones at the current moment, or collect the instantaneous voltage fluctuation curve characteristics of the battery under load changes. The collected analog signals are converted from analog to digital and low-order random bits are extracted. After debiasing, their respective local physical entropy values are generated. Both devices generate temporary private keys based on elliptic curves and calculate corresponding temporary public keys based on the temporary private keys, and exchange the temporary public keys through the wireless module; Both devices use their own temporary private key and the received temporary public key of the other party to perform elliptic curve point multiplication to generate a shared elliptic curve point, and extract the x-coordinate value of the shared elliptic curve point as the basic shared key. The basic shared key, the exchanged temporary public key, and the local physical entropy value are concatenated and combined to generate a mixed entropy input string; A one-way hash operation is performed on the mixed entropy input string using a preset hash algorithm, and the hash value output by the operation is truncated to a preset length to generate the final session symmetric key.
[0012] Furthermore, step S2 employs an authentication encryption mode to perform encryption operations on the plaintext data to be transmitted, specifically including: A unique initialization vector is generated, and based on the session symmetric key and the initialization vector, a Galois hash key and an initial counter block are generated using a block cipher algorithm; Using a counter mode, the initial counter block is incremented using the session symmetric key to obtain the counter block corresponding to each plaintext block. The encrypted value of each counter block is then XORed with the corresponding plaintext block to obtain the ciphertext data. Using the Galois hash key, a polynomial accumulation operation is performed on the additional authentication data, the ciphertext data, and the length information of the additional authentication data and the ciphertext data within the Galois field. The result of the operation is then XORed with the encrypted value of the initial counter block to generate an authentication tag.
[0013] Furthermore, the anti-replay header information in S2 includes a monotonically increasing sequence number or the current timestamp; Meanwhile, in S3, after the second terminal device reassembles the complete offline security data packet, it extracts the anti-replay header information and queries the locally maintained received data packet record. If the anti-replay header information already exists in the record, the offline security data packet is directly discarded.
[0014] Furthermore, in step S3, the process of dynamically adjusting the forward error correction coding redundancy based on the channel noise environment specifically includes: The pre-construction of an adaptive signal-to-noise ratio (SNR)-coding rate (CRR) mapping table includes the following steps: based on Shannon's formula... Calculate the current channel bandwidth Theoretical channel capacity , The signal-to-noise ratio is represented, and combined with the coding gain curve at the target bit error rate, the optimal coding rates are determined to ensure that the bit error rate of the communication link remains below the preset decoding threshold. Minimum signal-to-noise ratio threshold required The minimum signal-to-noise ratio threshold With the corresponding coding rate Establish a one-to-one mapping relationship and store it in memory; During the communication process, the current signal-to-noise ratio value of the near-field communication channel is collected in real time. ; The current signal-to-noise ratio value minimum signal-to-noise ratio threshold in the adaptive mapping table Perform a traversal and comparison to filter out those that meet the requirements. All candidate coding rates; Select the candidate coding rate with the largest value as the target coding rate. And adjust the parameters of the forward error correction coding to the target coding rate. This is to maximize the effective data transmission rate while ensuring link stability.
[0015] Furthermore, the process of pseudo-random frequency jump in S3 specifically includes: The negotiated session symmetric key K is used as the initial seed for the frequency hopping sequence generator, and a linear congruential algorithm is used. Iterative generation of pseudo-random number sequences The multiplier Increment and module These are the system parameters agreed upon in advance by both the sender and receiver; The pseudo-random number sequence The numerical mapping is used to select the set of frequency points for the RF module. The specific frequency index is used to generate a frequency hopping pattern; The current communication clock is divided into multiple time slots of fixed duration. At the beginning of each time slot, the transmitting and receiving parties synchronously switch to the target frequency point according to the frequency hopping pattern to transmit and receive data, so as to combat narrowband interference and prevent the frequency point from being intercepted through frequency diversity.
[0016] Furthermore, in step S4, if the verification tag is inconsistent with the integrity verification tag carried in the data packet, the second terminal device discards the data and generates a transmission error signal containing an error type identifier. The second terminal device feeds back the transmission error signal to the first terminal device through the near-field communication channel. After receiving the transmission error signal, the first terminal device triggers a retransmission mechanism for the offline security data packet.
[0017] As a second aspect of the present invention, an offline end-to-end secure data communication system for terminal devices is also provided, comprising: The two-way authentication unit is used for the first terminal device and the second terminal device to establish a connection and perform two-way identity authentication through a low-power wireless module in the offline proximity state; both parties use a pre-built hardware security module to verify the identity identifier, and negotiate to generate a unique session symmetric key by combining the environmental physical entropy value and the elliptic curve key exchange method. The data encryption and encapsulation unit is used by the first terminal device to perform encryption operations on the plaintext data to be transmitted using the session symmetric key and an authentication encryption mode to generate ciphertext data blocks, and to calculate and generate a data integrity verification tag; then, the ciphertext data blocks, the verification tag, and the anti-replay header information are encapsulated into an offline secure data packet. The anti-interference transmission and reassembly unit is used for the first terminal device to send the offline security data packet through the near-field communication channel, and dynamically adjust the redundancy of the forward error correction coding and perform pseudo-random frequency jumps according to the channel noise environment during transmission; the second terminal device demodulates and decodes the received signal, performs out-of-order rearrangement and deduplication processing, and reassembles it to obtain a complete offline security data packet. The decryption verification and processing unit is used by the second terminal device to decrypt the reassembled data packet using the session symmetric key, and to recalculate the verification tag for the decrypted plaintext data; if the verification tag is consistent with the integrity verification tag carried in the data packet, the data is confirmed to have not been tampered with and the business processing is performed; otherwise, the data is discarded and an error signal is sent.
[0018] As a third aspect of the invention, a computer-readable storage medium is also provided, on which a computer program is stored, which is executed by a processor as described in any one of the claims, an offline end-to-end secure data communication method for a terminal device.
[0019] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: 1. The present invention provides an offline end-to-end secure data communication method for terminal devices. This method establishes a connection using a low-power wireless module while the terminal device is offline and in proximity. It performs two-way authentication and verifies the identity using a pre-built hardware security module. Simultaneously, it negotiates and generates a unique session symmetric key using environmental physical entropy and elliptic curve key exchange. This enables device-to-device identity verification even in scenarios without network support. The hardware security module provides local secure signature verification, preventing unauthorized devices from accessing the communication link. The combination of environmental physical entropy and elliptic curve operations generates a non-repeatable session symmetric key. This key is generated locally without over-the-air transmission, effectively reducing the risk of key theft, improving key resistance to cracking, and providing a secure key foundation for subsequent data encryption and decryption. This meets the technical requirements for autonomous key negotiation in offline scenarios.
[0020] 2. The offline end-to-end secure data communication method for terminal devices of the present invention uses a negotiated session symmetric key to process plaintext data to be transmitted in an authenticated encryption mode, generating ciphertext data blocks and data integrity verification tags. The ciphertext data blocks, integrity verification tags, and anti-replay header information are then encapsulated into an offline secure data packet. This method can simultaneously complete data encryption and integrity verification in a single operation, simplifying the data processing steps of the terminal device and reducing its power consumption. The integrity verification tag can be used to verify whether the data has been tampered with, and the anti-replay header information can identify repeatedly transmitted data packets, resisting replay attacks. The well-structured offline secure data packet is compatible with the transmission format of near-field communication for terminals, ensuring the security and standardization of data during the processing stage.
[0021] 3. The offline end-to-end secure data communication method for terminal devices of the present invention transmits offline secure data packets through a near-field communication channel. During transmission, the redundancy of forward error correction coding is dynamically adjusted according to the channel noise environment, and pseudo-random frequency jumps are performed. After the receiving end completes demodulation, decoding, out-of-order reordering, and deduplication processing of the signal, it uses the session symmetric key to decrypt and verify the integrity tag. Based on the verification result, the data is processed or an error signal is fed back. This method can enhance the anti-interference capability and transmission stability of near-field communication. The dynamic error correction mechanism adapts to the transmission conditions of different channels, and the pseudo-random frequency jumps reduce the possibility of signal interception. The data reassembly operation at the receiving end ensures the integrity of the data packet, the integrity verification confirms that the data has not been tampered with, and the error signal can trigger a retransmission mechanism, comprehensively improving the reliability and security of offline end-to-end data communication. Attached Figure Description
[0022] Figure 1 This is a flowchart of an offline end-to-end secure data communication method for terminal devices according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the system units in an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0024] Example 1 Please refer to Figure 1 This embodiment 1 provides an offline end-to-end secure data communication method for terminal devices, including: S1. In the offline proximity state, the first terminal device and the second terminal device establish a connection and perform two-way authentication through the low-power wireless module; both parties use the pre-set hardware security module to verify the identity identifier, and negotiate to generate a unique session symmetric key by combining the environmental physical entropy value and the elliptic curve key exchange method. S2. The first terminal device uses the session symmetric key to perform encryption operations on the plaintext data to be transmitted in the authentication encryption mode to generate ciphertext data blocks, and calculates and generates a data integrity verification tag; then, the ciphertext data blocks, verification tags and anti-replay header information are encapsulated into an offline secure data packet; S3. The first terminal device sends the offline security data packet through the near-field communication channel, and dynamically adjusts the forward error correction coding redundancy and performs pseudo-random frequency jumps according to the channel noise environment during transmission; the second terminal device demodulates and decodes the received signal, performs out-of-order rearrangement and deduplication processing, and reassembles it to obtain a complete offline security data packet. S4. The second terminal device uses the session symmetric key to decrypt the reassembled data packet and recalculates the verification tag on the decrypted plaintext data; if the verification tag is consistent with the integrity verification tag carried in the data packet, the data is confirmed to have not been tampered with and the service processing is performed; otherwise, the data is discarded and an error signal is sent.
[0025] This embodiment 1 further elaborates on the above steps.
[0026] (1) Two-way authentication In offline scenarios, when terminal devices interact closely, establishing a secure connection, verifying trusted identities, and negotiating secure keys are crucial for ensuring the legitimacy and confidentiality of the entire communication process. First, when the first and second terminal devices are in close proximity offline, they establish an initial communication link using low-power wireless communication modules such as Bluetooth Low Energy or Ultra Wideband. After the handshake connection is complete, both devices exchange their security certificates, providing legitimate credentials for identity verification. Subsequently, the terminal devices invoke their internally pre-built secure elements or trusted execution environments, relying on hardware security modules to locally verify the digital signatures of the security certificates. This confirms the legitimacy and validity of the identities of both communicating parties, completing two-way authentication and preventing unauthorized devices from accessing the communication link.
[0027] After completing two-way authentication, both devices, combining the environmental physical entropy value and the elliptic curve key exchange method, negotiate to generate a unique session symmetric key. The specific process is as follows: First, the acquisition and quantification of physical entropy are involved. Device A and Device B respectively activate their hardware sensor modules. Device A acquires data from its built-in triaxial accelerometer within a time window. Analog noise signal inside Alternatively, device B can collect the ambient thermal noise from the microphone; device B, on the other hand, collects the voltage fluctuation curve of the battery at the moment of load switching. These analog signals are converted into digital sequences by an analog-to-digital converter (ADC). To extract a highly random bitstream, the device truncates the least significant bit (LSB) most affected by noise from the digital sequence, forming the original random sequence. Subsequently, to eliminate any potential DC bias in the hardware circuitry, both parties use a von Neumann debiasing algorithm to process the original sequence, ultimately generating local physical entropy values. and Here and All are binary bit strings, and their length depends on the sampling time and the retention rate after debiasing.
[0028] After completing the physical entropy preparation, both parties proceed to the elliptic curve key exchange phase. Both parties pre-configure the same elliptic curve parameters, including the finite field. Curve equation coefficients and Base point and the order of the base point Device A uses a cryptographically secure pseudo-random number generator to generate a random integer as a temporary private key. , must meet Subsequently, device A computes the temporary public key using scalar multiplication. The calculation formula is: ;in, This represents scalar multiplication on an elliptic curve. Similarly, device B generates operations that satisfy... Temporary private key And calculate its temporary public key. : Both parties exchange their respective temporary public keys via a wireless communication module. and .
[0029] After receiving each other's public keys, both parties calculate the shared elliptic curve points. Device A uses the received public key... Calculate shared points The calculation process is as follows: Similarly, device B calculates: ; Due to the commutative law of elliptic curve operations, the points obtained by both sides... They are the same. To convert this point into key material, both parties extract the shared point. x-coordinate As the basic shared key .
[0030] Finally, to ensure the randomness and uniqueness of the key, both parties combine the underlying shared key with the physical entropy value. They then construct a mixed input string. This string is derived from the underlying shared key. Temporary public keys of both parties , and their respective local physical entropy values , It is assembled according to a predefined order. The assembly logic can be represented as: ;in, This represents the bit string concatenation operation. (Introduction) and To prevent key reuse attacks, the following was introduced. and This is to introduce hardware physical characteristics to prevent purely mathematical cracking.
[0031] Finally, both parties used a pre-defined one-way hash algorithm (such as SHA-256) to process the mixed input string. Perform a hash operation to generate a fixed-length hash value. This is used to generate a session symmetric key that conforms to a specific encryption algorithm (such as AES-128 or AES-256). Both parties extract the first part of the hash value Bit( (where the required key length is), the formula is as follows: ; Thus, without directly transmitting the key, device A and device B independently negotiated a completely identical session symmetric key by combining physical environment characteristics and mathematical challenges.
[0032] (2) Data encryption and encapsulation In this embodiment, device A acts as the sender and device B as the receiver. Both parties have negotiated and generated the same session symmetric key K through the aforementioned steps. To meet the synchronous verification requirements for data confidentiality and integrity, this embodiment uses the Advanced Encryption Standard Galois / Counter Mode (AES-GCM) or the Chinese national cryptographic algorithm SM4-GCM as the authentication encryption mode.
[0033] Device A first constructs anti-replay header information and additional authentication data. To prevent attackers from intercepting and repeatedly sending old data packets, Device A encapsulates anti-replay information in the packet header, which is specifically manifested as a monotonically increasing sequence number. or current timestamp The serial number Maintained locally by device A, the sequence number is automatically incremented by one with each data packet sent, ensuring uniqueness and unpredictability. Device A will store this sequence number. As additional authentication data It can be a part of, or combined with the protocol version number and device identifier to form complete additional authentication data. Although this part of the data does not need to be encrypted, it must be included in the integrity verification scope to prevent malicious tampering that could lead to protocol parsing errors or replay attacks.
[0034] Subsequently, device A initializes its encryption engine. Device A generates a unique initialization vector IV, typically generated by a random number or counter, to ensure that different ciphertexts are produced when the same key encrypts different messages. Device A divides the plaintext data P to be transmitted into several fixed-length plaintext blocks. Simultaneously, device A constructs additional authentication data A, which contains information such as headers, sequence numbers, or protocol versions that do not require encryption but need to verify integrity.
[0035] During the encryption process, device A uses the session symmetric key K to perform encryption operations on the initialization vector IV, generating the Galois hash key H and the initial counter block. Subsequently, device A performs counter-mode encryption on the plaintext block P: for the i-th plaintext block... Device A calculates the counter block. Encryption value and group it with plaintext Perform a bitwise XOR operation to generate ciphertext blocks. The calculation formula is as follows: ;in, This represents the XOR operation. This indicates a block cipher algorithm (AES or SM4) based on key K. All ciphertext blocks are combined to form the final ciphertext C.
[0036] While generating the ciphertext, device A simultaneously calculates the data integrity verification tag T (i.e., the authentication tag). Device A uses Galois field multiplication to perform a polynomial operation on the additional authentication data A, the ciphertext C, and their length information with the Galois hash key H. Specifically, device A pads A and C to an integer multiple of the block length and performs the operation in the Galois field. The process involves cumulative multiplication operations, followed by a weighted summation using powers of the hash key H. The calculation logic for the authentication tag T can be expressed as follows: ;in, This represents the Galois hash function based on key H. This is the intermediate hash value. This represents the concatenation of the initialization vector and the initial counter. The calculated tag T is typically 128, 124, 120, 112, or 104 bits. In this embodiment, the first 128 bits are preferably truncated as the final authentication tag.
[0037] Finally, device A initializes the vector IV, ciphertext C, authentication tag T, and anti-replay header information containing the serial number. Encapsulated as an offline secure data packet, its structure can be represented as follows: .
[0038] (3) Interference-resistant transmission and reassembly After encapsulating the offline secure data packet, the first terminal device A sends the offline secure data packet through the near-field communication channel. To ensure the reliability of data transmission in the near-field communication channel, before sending the offline secure data packet, device A first dynamically adjusts the forward error correction coding redundancy according to the channel noise environment. The specific process is as follows: The pre-construction of an adaptive signal-to-noise ratio (SNR)-coding rate (CRR) mapping table includes the following steps: based on Shannon's formula... Calculate the current channel bandwidth Theoretical channel capacity , The signal-to-noise ratio is represented, and combined with the coding gain curve at the target bit error rate, the optimal coding rates are determined to ensure that the bit error rate of the communication link remains below the preset decoding threshold. Minimum signal-to-noise ratio threshold required The minimum signal-to-noise ratio threshold With the corresponding coding rate Establish a one-to-one mapping relationship and store it in memory; During the communication process, the current signal-to-noise ratio value of the near-field communication channel is collected in real time. ; The current signal-to-noise ratio value minimum signal-to-noise ratio threshold in the adaptive mapping table Perform a traversal and comparison to filter out those that meet the requirements. All candidate coding rates; Select the candidate coding rate with the largest value as the target coding rate. And adjust the parameters of the forward error correction coding to the target coding rate. This is to maximize the effective data transmission rate while ensuring link stability.
[0039] At the same time, device A activates a pseudo-random frequency switching mechanism to combat narrowband interference and prevent frequency interception. The specific process of pseudo-random frequency switching is as follows: The negotiated session symmetric key K is used as the initial seed for the frequency hopping sequence generator, and a linear congruential algorithm is used. Iterative generation of pseudo-random number sequences The multiplier Increment and module These are the system parameters agreed upon in advance by both the sender and receiver; The pseudo-random number sequence The numerical mapping is used to select the set of frequency points for the RF module. The specific frequency index is used to generate a frequency hopping pattern; The current communication clock is divided into multiple time slots of fixed duration. At the beginning of each time slot, the transmitting and receiving parties synchronously switch to the target frequency point according to the frequency hopping pattern to transmit and receive data, so as to combat narrowband interference and prevent the frequency point from being intercepted through frequency diversity.
[0040] Device A transmits its encapsulated offline secure data packet (containing ciphertext data blocks, a checksum tag, and anti-replay header information) through the aforementioned near-field communication channel, which undergoes dynamic encoding and frequency hopping processing. Device B, as the receiver, has its radio frequency module in listening mode, ready to receive wireless signals from Device A at any time. Because Device A uses a pseudo-random frequency hopping mechanism during transmission, Device B must use the same session symmetric key. As a seed, a linear congruential algorithm identical to that used by device A is employed. The same pseudo-random number sequence is generated synchronously. Based on the frequency hopping pattern generated by this sequence, device B controls its local radio frequency module to switch to the corresponding target frequency at the beginning of each time slot, thereby ensuring that the received frequency is synchronized with the transmitted frequency of device A and capturing the hopping signal.
[0041] After signal acquisition, device B performs demodulation and decoding operations. Regarding the forward error correction coding dynamically adjusted by device A according to the channel environment, device B first performs down-conversion and analog-to-digital conversion on the received RF signal to extract the baseband signal. Subsequently, device B negotiates or detects the coding parameters, i.e., the target coding rate, based on the current communication link. The device then calls the corresponding channel decoding algorithm to decode the baseband signal. Due to noise and multipath effects in the wireless channel, received data segments may contain bit errors. Through forward error correction decoding, device B can correct a certain number of bit errors and recover the original data bit stream. If the current channel quality is poor, resulting in high coding redundancy, device B fully utilizes the redundant information through the corresponding decoding algorithm to ensure the accuracy of data recovery.
[0042] Due to the instability of wireless transmission and the characteristics of frequency hopping communication, the data packets received by Device B may be out of order or partially duplicated. Therefore, Device B performs out-of-order rearrangement and deduplication on the received data stream. Device B uses the sequence number or time slot index information carried in the data packets to rearrange the scattered received data segments in the correct logical order. For data segments that are repeatedly received due to signal reflection or multipath effects during transmission, Device B removes them by identifying their unique sequence identifiers, retaining only one valid copy of the data. Through this process, Device B reassembles the fragmented, out-of-order, and potentially duplicated received signals into a complete, logically continuous offline security data packet, preparing for subsequent security verification.
[0043] (4) Decryption verification and processing After receiving the complete offline security data packet, device B first extracts the serial number from the anti-replay header information. The system checks if the sequence number is greater than the latest sequence number recorded locally. If not, it is considered a replay attack and the sequence is discarded. If the sequence number verification passes, the same session key K and the received IV are used to perform the same counter mode decryption operation to recover the plaintext. And using the same Galois hash algorithm, based on the received additional authentication data. (If any) and the decrypted plaintext (Or recalculate the authentication tag directly based on the ciphertext C) .
[0044] Subsequently, device B compares the received authentication tag T with the locally calculated... .like If the data is confirmed to be tampered with, the business process will be executed.
[0045] If the two are inconsistent, the data transmission is deemed abnormal, and a retransmission mechanism for the offline security data packet is triggered. Device B first executes the error signal construction and feedback process. Device B's protocol stack generates a transmission error signal frame with a specific format. This signal frame contains an error type identifier to clearly indicate whether the error is due to "integrity verification failure" or "data tampering." To prevent this feedback signal from being maliciously exploited or forged, Device B utilizes the session symmetric key. The error signal frame is then subjected to a lightweight signature or message authentication code calculation to ensure that device A can verify that the feedback indeed comes from a legitimate communication peer. Subsequently, device B sends the feedback signal carrying the error identifier back to device A via the near-field communication channel.
[0046] After sending the original data packet, device A starts a retransmission timer and enters a listening state, waiting for an acknowledgment or feedback signal from device B. When device A receives a transmission error signal from device B, it first uses the session symmetric key... The validity of the signal is verified. Upon successful verification, device A parses the error type identifier in the signal, identifying that the current transmission failure is caused by compromised data integrity. At this point, device A adaptively adjusts based on the error type. For integrity verification failures, device A determines that the current channel environment may experience sudden interference or increased noise. Therefore, before retransmission, device A proactively adjusts the forward error correction coding parameters, appropriately increasing coding redundancy or increasing the number of packet repetitions. Device A uses the adjusted parameters to re-encapsulate and encode the original plaintext data, generating a new offline secure data packet, and retransmits it through the frequency hopping channel. This feedback-based adaptive retransmission mechanism can cope with transient interference in near-field communication environments, significantly improving the success rate of data transmission.
[0047] Example 2 Please refer to Figure 2 This embodiment 2 provides an offline end-to-end secure data communication system for terminal devices, including: The two-way authentication unit is used for the first terminal device and the second terminal device to establish a connection and perform two-way identity authentication through a low-power wireless module in the offline proximity state; both parties use a pre-built hardware security module to verify the identity identifier, and negotiate to generate a unique session symmetric key by combining the environmental physical entropy value and the elliptic curve key exchange method. The data encryption and encapsulation unit is used by the first terminal device to perform encryption operations on the plaintext data to be transmitted using the session symmetric key and an authentication encryption mode to generate ciphertext data blocks, and to calculate and generate a data integrity verification tag; then, the ciphertext data blocks, the verification tag, and the anti-replay header information are encapsulated into an offline secure data packet. The anti-interference transmission and reassembly unit is used for the first terminal device to send the offline security data packet through the near-field communication channel, and dynamically adjust the redundancy of the forward error correction coding and perform pseudo-random frequency jumps according to the channel noise environment during transmission; the second terminal device demodulates and decodes the received signal, performs out-of-order rearrangement and deduplication processing, and reassembles it to obtain a complete offline security data packet. The decryption verification and processing unit is used by the second terminal device to decrypt the reassembled data packet using the session symmetric key, and to recalculate the verification tag for the decrypted plaintext data; if the verification tag is consistent with the integrity verification tag carried in the data packet, the data is confirmed to have not been tampered with and the business processing is performed; otherwise, the data is discarded and an error signal is sent.
[0048] Example 3 This embodiment 3 also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement any step of an offline end-to-end secure data communication method for terminal devices.
[0049] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0050] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.
[0051] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for offline end-to-end secure data communication for terminal devices, characterized in that, include: S1. In the offline proximity state, the first terminal device and the second terminal device establish a connection and perform two-way authentication through the low-power wireless module; both parties use the pre-set hardware security module to verify the identity identifier, and negotiate to generate a unique session symmetric key by combining the environmental physical entropy value and the elliptic curve key exchange method. S2. The first terminal device uses the session symmetric key to perform encryption operations on the plaintext data to be transmitted in the authentication encryption mode to generate ciphertext data blocks, and calculates and generates a data integrity verification tag. The encrypted data block, verification tag, and anti-replay header information are then encapsulated into an offline secure data packet; S3. The first terminal device sends the offline security data packet through the near-field communication channel, and dynamically adjusts the forward error correction coding redundancy and performs pseudo-random frequency jumps according to the channel noise environment during transmission; the second terminal device demodulates and decodes the received signal, performs out-of-order rearrangement and deduplication processing, and reassembles it to obtain a complete offline security data packet. S4. The second terminal device uses the session symmetric key to decrypt the reassembled data packet and recalculates the verification tag on the decrypted plaintext data; if the verification tag is consistent with the integrity verification tag carried in the data packet, the data is confirmed to have not been tampered with and the service processing is performed; otherwise, the data is discarded and an error signal is sent.
2. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, The two-way authentication in S1 specifically includes: The first terminal device and the second terminal device establish an initial handshake connection through Bluetooth Low Energy or Ultra Wideband communication modules and exchange their respective security certificates. The verification of identity using a pre-built hardware security module refers to performing local verification of the digital signature of the security certificate by calling the security element or trusted execution environment embedded in the terminal device.
3. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, In step S1, a unique session symmetric key is negotiated and generated by combining the environmental physical entropy value with the elliptic curve key exchange method, specifically including: Both devices collect acceleration noise data from built-in sensors or ambient noise data from microphones at the current moment, or collect the instantaneous voltage fluctuation curve characteristics of the battery under load changes. The collected analog signals are converted from analog to digital and low-order random bits are extracted. After debiasing, their respective local physical entropy values are generated. Both devices generate temporary private keys based on elliptic curves and calculate corresponding temporary public keys based on the temporary private keys, and exchange the temporary public keys through the wireless module; Both devices use their own temporary private key and the received temporary public key of the other party to perform elliptic curve point multiplication to generate a shared elliptic curve point, and extract the x-coordinate value of the shared elliptic curve point as the basic shared key. The basic shared key, the exchanged temporary public key, and the local physical entropy value are concatenated and combined to generate a mixed entropy input string; A one-way hash operation is performed on the mixed entropy input string using a preset hash algorithm, and the hash value output by the operation is truncated to a preset length to generate the final session symmetric key.
4. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, The S2 step employs an authentication encryption mode to encrypt the plaintext data to be transmitted, specifically including: A unique initialization vector is generated, and based on the session symmetric key and the initialization vector, a Galois hash key and an initial counter block are generated using a block cipher algorithm; Using a counter mode, the initial counter block is incremented using the session symmetric key to obtain the counter block corresponding to each plaintext block. The encrypted value of each counter block is then XORed with the corresponding plaintext block to obtain the ciphertext data. Using the Galois hash key, a polynomial accumulation operation is performed on the additional authentication data, the ciphertext data, and the length information of the additional authentication data and the ciphertext data within the Galois field. The result of the operation is then XORed with the encrypted value of the initial counter block to generate an authentication tag.
5. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, The anti-replay header information in S2 includes a monotonically increasing sequence number or the current timestamp; Meanwhile, in S3, after the second terminal device reassembles the complete offline security data packet, it extracts the anti-replay header information and queries the locally maintained received data packet record. If the anti-replay header information already exists in the record, the offline security data packet is directly discarded.
6. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, In step S3, the process of dynamically adjusting the forward error correction coding redundancy based on the channel noise environment specifically includes: The pre-construction of an adaptive signal-to-noise ratio (SNR)-coding rate (CRR) mapping table includes the following steps: based on Shannon's formula... Calculate the current channel bandwidth Theoretical channel capacity , The signal-to-noise ratio is represented, and combined with the coding gain curve at the target bit error rate, the optimal coding rates are determined to ensure that the bit error rate of the communication link remains below the preset decoding threshold. Minimum signal-to-noise ratio threshold required The minimum signal-to-noise ratio threshold With the corresponding coding rate Establish a one-to-one mapping relationship and store it in memory; During the communication process, the current signal-to-noise ratio value of the near-field communication channel is collected in real time. ; The current signal-to-noise ratio value minimum signal-to-noise ratio threshold in the adaptive mapping table Perform a traversal and comparison to filter out those that meet the requirements. All candidate coding rates; Select the candidate coding rate with the largest value as the target coding rate. And adjust the parameters of the forward error correction coding to the target coding rate. This is to maximize the effective data transmission rate while ensuring link stability.
7. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, The process of pseudo-random frequency jump at the S3 mid-frequency point specifically includes: The negotiated session symmetric key K is used as the initial seed for the frequency hopping sequence generator, and a linear congruential algorithm is used. Iterative generation of pseudo-random number sequences The multiplier Increment and module These are the system parameters agreed upon in advance by both the sender and receiver; The pseudo-random number sequence The numerical mapping is used to select the set of frequency points for the RF module. The specific frequency index is used to generate a frequency hopping pattern; The current communication clock is divided into multiple time slots of fixed duration. At the beginning of each time slot, the transmitting and receiving parties synchronously switch to the target frequency point according to the frequency hopping pattern to transmit and receive data, so as to combat narrowband interference and prevent the frequency point from being intercepted through frequency diversity.
8. The offline end-to-end secure data communication method for terminal devices according to claim 1, characterized in that, In step S4, if the verification tag is inconsistent with the integrity verification tag carried in the data packet, the second terminal device discards the data and generates a transmission error signal containing an error type identifier. The second terminal device feeds back the transmission error signal to the first terminal device through the near-field communication channel. After receiving the transmission error signal, the first terminal device triggers a retransmission mechanism for the offline security data packet.
9. An offline end-to-end secure data communication system for terminal devices, characterized in that, include: The two-way authentication unit is used for the first terminal device and the second terminal device to establish a connection and perform two-way identity authentication through a low-power wireless module in the offline proximity state; both parties use a pre-built hardware security module to verify the identity identifier, and negotiate to generate a unique session symmetric key by combining the environmental physical entropy value and the elliptic curve key exchange method. The data encryption and encapsulation unit is used by the first terminal device to perform encryption operations on the plaintext data to be transmitted using the session symmetric key and an authentication encryption mode to generate ciphertext data blocks, and to calculate and generate data integrity verification tags. The encrypted data block, verification tag, and anti-replay header information are then encapsulated into an offline secure data packet; The anti-interference transmission and reassembly unit is used for the first terminal device to send the offline security data packet through the near-field communication channel, and dynamically adjust the redundancy of the forward error correction coding and perform pseudo-random frequency jumps according to the channel noise environment during transmission; the second terminal device demodulates and decodes the received signal, performs out-of-order rearrangement and deduplication processing, and reassembles it to obtain a complete offline security data packet. The decryption verification and processing unit is used by the second terminal device to decrypt the reassembled data packet using the session symmetric key, and to recalculate the verification tag for the decrypted plaintext data; if the verification tag is consistent with the integrity verification tag carried in the data packet, the data is confirmed to have not been tampered with and the business processing is performed; otherwise, the data is discarded and an error signal is sent.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed by a processor as described in any one of claims 1-8: an offline end-to-end secure data communication method for terminal devices.
