A Bluetooth encrypted communication method, system, electronic device and storage medium

By automatically broadcasting a pairing request with an encrypted session key via Bluetooth devices and verifying it in real time, combined with a pre-shared key and a hash algorithm, the complexity and security risks of the Bluetooth pairing process are resolved, achieving efficient and secure Bluetooth communication.

CN120769256BActive Publication Date: 2026-03-24BEIJING HUIXINTONG ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Pairing Bluetooth devices is a complex process with security risks, especially since data exchange can be intercepted, leading to a poor user experience.

Method used

The first Bluetooth device automatically broadcasts a pairing request containing an encrypted session key. The second Bluetooth device listens in real time and verifies the validity of the session key. Both parties transmit data based on the session key using a preset encryption algorithm, dynamically generate a random session key and encrypt it using a pre-shared key, and combine hash algorithms and environmental awareness data for security adjustments.

Benefits of technology

It simplifies the Bluetooth pairing process, improves pairing efficiency and security, reduces device power consumption, enhances the stability and reliability of data transmission, prevents session keys from being forged and eavesdropped on, and adapts to the security needs of different communication environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120769256B_ABST
    Figure CN120769256B_ABST
Patent Text Reader

Abstract

The application provides a Bluetooth encryption communication method and system, an electronic device and a storage medium, and relates to the technical field of wireless communication. The method comprises the following steps: when a first Bluetooth device triggers a data reporting operation, automatically broadcasting a pairing request containing an encrypted session key; the session key is a dynamically generated random key, and the session key is encrypted by using a pre-shared key; a second Bluetooth device listens to a broadcast channel in real time, verifies the received pairing request, and verifies the validity of the session key, including decrypting the encrypted session key by using the pre-shared key; if the verification is passed, the second Bluetooth device sends a confirmation message to the first Bluetooth device; the first Bluetooth device and the second Bluetooth device perform data transmission by using a preset encryption algorithm based on the session key, and the confirmation message contains an identification of the preset encryption algorithm. The technical scheme provided by the application can improve the pairing efficiency and security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wireless communication technology, specifically to a Bluetooth encrypted communication method, system, electronic device, and storage medium. Background Technology

[0002] Bluetooth communication, as an important short-range wireless communication technology, provides a convenient data transmission method between different devices. For example, Bluetooth technology is widely used in smart wearables, smart homes, and in-vehicle Bluetooth devices. However, in these technologies, Bluetooth devices typically pair using PIN codes or pairing request confirmations, requiring multiple interactions from the user. This pairing method is complex, time-consuming, and susceptible to interception during data exchange, resulting in a poor user experience. Therefore, the Bluetooth pairing process in these technologies is cumbersome and carries certain security risks. Summary of the Invention

[0003] To address the aforementioned technical problems, this application provides a Bluetooth encrypted communication method, system, electronic device, and storage medium.

[0004] In a first aspect, this application provides a Bluetooth encrypted communication method, comprising: when a first Bluetooth device triggers a data reporting operation, it automatically broadcasts a pairing request containing an encrypted session key, wherein the session key is a dynamically generated random key and is encrypted using a pre-shared key; a second Bluetooth device listens to the broadcast channel in real time, verifies the received pairing request, and verifies the validity of the session key, including decrypting the encrypted session key using the pre-shared key; if the verification is successful, the second Bluetooth device sends an acknowledgment message to the first Bluetooth device; the first Bluetooth device and the second Bluetooth device transmit data based on the session key using a preset encryption algorithm, wherein the acknowledgment message contains an identifier of the preset encryption algorithm.

[0005] By adopting the above technical solution, the first Bluetooth device automatically broadcasts a pairing request, reducing user operations and simplifying the pairing process; it dynamically generates and encrypts a random session key, avoiding static keys and plaintext transmission issues, thus enhancing security; the second Bluetooth device verifies the validity of the session key to ensure reliable pairing; and both parties use a preset encryption algorithm based on the session key for data transmission, ensuring data transmission security. Therefore, this technical solution achieves the effect of improving pairing efficiency and security.

[0006] Optionally, when the first Bluetooth device triggers a data reporting operation, it automatically broadcasts a pairing request containing an encrypted session key, including: when the first Bluetooth device triggers a data reporting operation, it dynamically generates a session key based on the identity information and current timestamp information of the first Bluetooth device using a hash algorithm; it encrypts the session key using a pre-shared key to obtain an encrypted session key; and it sends a pairing request through a Bluetooth Low Energy broadcast channel, wherein the pairing request includes the identity information, current timestamp information and encrypted session key of the first Bluetooth device.

[0007] By adopting the above technical solutions, the first Bluetooth device can automatically initiate pairing when the data reporting operation is triggered, eliminating the need for multiple user interactions, simplifying the operation process, saving time, and improving the user experience; a hash algorithm is used to dynamically generate a session key by combining the identity information of the first Bluetooth device and the current timestamp information, ensuring the randomness and dynamism of the key and enhancing the security of the pairing process; a pre-shared key is used to encrypt the session key to prevent it from being intercepted during transmission; and pairing requests are sent through the Bluetooth Low Energy broadcast channel to reduce device power consumption.

[0008] Optionally, the second Bluetooth device listens to the broadcast channel in real time and verifies the received pairing request. Verifying the validity of the session key includes: the second Bluetooth device receiving the pairing request; the second Bluetooth device decrypting the encrypted session key using a pre-shared key to obtain the decrypted session key, wherein the pre-shared key is pre-stored in both the first and second Bluetooth devices; the second Bluetooth device using a hash algorithm to calculate the identity information and current timestamp information of the first Bluetooth device to obtain a first key; and verifying the validity of the session key by comparing the first key with the session key.

[0009] By adopting the above technical solution, the validity of the session key in the pairing request broadcast by the second Bluetooth device to the first Bluetooth device is verified. The session key is dynamically generated and encrypted with a pre-shared key to ensure the security of key transmission. The use of a hash algorithm combined with device identity and timestamp information for verification can prevent the session key from being forged and ensure the security of Bluetooth pairing and subsequent communication processes.

[0010] Optionally, the above method further includes: the first Bluetooth device and the second Bluetooth device continuously monitor signal interference data in the 2.4GHz band, and dynamically switch to the target operating frequency for data transmission by analyzing the signal-to-noise ratio and channel occupancy rate in real time, wherein the target operating frequency is the operating frequency with the least interference.

[0011] By adopting the above technical solution, the first Bluetooth device and the second Bluetooth device continuously monitor the signal interference data of the 2.4GHz band, analyze the signal-to-noise ratio and channel occupancy rate, and dynamically switch to the operating frequency with the least interference for data transmission, thereby avoiding signal interference and improving the stability and reliability of Bluetooth encrypted communication.

[0012] Optionally, the above method further includes: if the verification is successful, the second Bluetooth device sets the session key as a key parameter in a preset encryption algorithm; the first Bluetooth device and the second Bluetooth device respectively use the preset encryption algorithm to encrypt and decrypt the transmitted data based on the session key.

[0013] By adopting the above technical solution, when the first Bluetooth device triggers data reporting, it automatically broadcasts a pairing request containing an encrypted session key. After listening and verifying, the second Bluetooth device sends a confirmation message. The second Bluetooth device sets the session key as the key parameter of a preset encryption algorithm. Based on this session key, the first and second Bluetooth devices use the preset encryption algorithm to encrypt and decrypt the transmitted data. This simplifies the Bluetooth pairing process, avoids multiple user interactions, and the dynamically generated and encrypted session key ensures the security of Bluetooth pairing and data transmission, thereby improving the user experience.

[0014] Optionally, the first Bluetooth device and the second Bluetooth device transmit data using a preset encryption algorithm based on a session key, including: the first Bluetooth device collects target data in real time and encrypts the target data using a preset encryption algorithm and a session key; the first Bluetooth device sends the encrypted target data to the second Bluetooth device; the second Bluetooth device receives the encrypted target data and decrypts it using the preset encryption algorithm and a session key to obtain the target data.

[0015] By adopting the above technical solution, the first Bluetooth device can encrypt the target data collected in real time and transmit it to the second Bluetooth device. The second Bluetooth device then decrypts the encrypted data to obtain the target data. This realizes data transmission between Bluetooth devices based on dynamically generated and encrypted session keys and preset encryption algorithms, avoiding security issues caused by static key generation or plaintext transmission, simplifying pairing operations, and improving the convenience and security of Bluetooth communication.

[0016] Optionally, after the second Bluetooth device receives the encrypted target data and decrypts it using a preset encryption algorithm and session key to obtain the target data, the above method further includes: if the target data meets preset conditions, the second Bluetooth device sends a control command to the first Bluetooth device to instruct the first Bluetooth device to adjust monitoring parameters or perform corresponding operations.

[0017] By adopting the above technical solution, when the first Bluetooth device triggers data reporting, it automatically broadcasts a pairing request containing a dynamically randomized and encrypted session key. The second Bluetooth device listens for and verifies the request. After successful verification, the two devices transmit data based on the session key using a preset encryption algorithm. The second Bluetooth device receives the encrypted target data and decrypts it to obtain the target data. If the target data meets the preset conditions, it can send a control command to the first Bluetooth device. This enables the second Bluetooth device to flexibly control the first Bluetooth device according to the target data, improving the flexibility and practicality of Bluetooth encrypted communication.

[0018] Optionally, during communication, the first Bluetooth device and the second Bluetooth device can also automatically adjust the complexity of the preset encryption algorithm based on environmental awareness data. The specific steps are as follows: The first Bluetooth device and the second Bluetooth device each have built-in environmental awareness sensors to monitor the noise and interference signal strength in the surrounding environment. The environmental awareness data includes the noise and interference signal strength in the surrounding environment. Based on the environmental awareness data, both devices dynamically assess the security level of the current communication environment. When the assessment result is high risk, both devices automatically increase the complexity of the encryption algorithm, using a higher level encryption algorithm and a longer key length. When the assessment result is low risk, both devices automatically reduce the complexity of the encryption algorithm.

[0019] By adopting the above technical solution, the first and second Bluetooth devices have built-in environmental perception sensors to monitor noise and interference signal strength. Based on this environmental perception data, the security level of the communication environment is assessed, and the degree of risk in the communication environment can be accurately identified. When the risk is high, increasing the complexity of the encryption algorithm, using a higher level of encryption algorithm and a longer key length can enhance communication security and prevent data from being intercepted and cracked. When the risk is low, reducing the complexity of the encryption algorithm can reduce the consumption of device resources, improve communication efficiency, and achieve a balance between security and efficiency.

[0020] Optionally, based on environmental perception data, both devices dynamically assess the security level of the current communication environment, including: when the noise decibel value in the surrounding environment is greater than or equal to a preset decibel threshold, or the interference signal strength is greater than or equal to a preset signal strength threshold, the current communication environment is determined to be high-risk; when the noise decibel value in the surrounding environment is less than a preset decibel threshold and the interference signal strength is less than a preset signal strength threshold, the current communication environment is determined to be low-risk.

[0021] By adopting the above technical solution, the current communication environment can be accurately judged as high-risk or low-risk based on the comparison between the ambient noise decibel value and the interference signal strength and the preset threshold. This provides a basis for automatically adjusting the complexity of the preset encryption algorithm, enabling Bluetooth encrypted communication to flexibly adjust the encryption strength according to the actual environment, ensuring communication security while avoiding resource waste caused by over-encryption.

[0022] Optionally, during communication, the first Bluetooth device and the second Bluetooth device further employ a time synchronization protocol to ensure accurate synchronization of their timestamps. The time synchronization protocol includes the following steps: when broadcasting a pairing request, the first Bluetooth device simultaneously sends its current timestamp information; after receiving the pairing request, the second Bluetooth device records the received current timestamp information and calculates an adjustment amount based on network latency and clock offset to calibrate its local timestamp; when sending an acknowledgment message, the second Bluetooth device attaches the calibrated local timestamp for the first Bluetooth device to verify and synchronize; based on the synchronized timestamps, both parties dynamically adjust the session key generation cycle and the parameter update frequency of the encryption algorithm.

[0023] By adopting the above technical solution, when the first Bluetooth device broadcasts a pairing request, it sends the current timestamp information. The second Bluetooth device receives the information and calibrates its local timestamp, and then attaches the calibrated local timestamp for the first Bluetooth device to verify and synchronize. This ensures that the timestamps of both parties are accurately synchronized. Based on the synchronized timestamps, both parties dynamically adjust the generation cycle of the session key and the parameter update frequency of the encryption algorithm, which can improve the security and flexibility of Bluetooth encrypted communication and make the encryption mechanism better adapt to actual communication situations.

[0024] Optionally, the above method further includes: after each data transmission ends, the first Bluetooth device and the second Bluetooth device dynamically update the session key based on preset rules, wherein the preset rules include, but are not limited to: the amount of data transmitted reaches a predetermined threshold, and a predetermined time interval has elapsed.

[0025] By adopting the above technical solution, after each data transmission, the first Bluetooth device and the second Bluetooth device dynamically update the session key based on preset rules, avoiding security issues caused by the key remaining unchanged for a long time, enhancing the security of Bluetooth encrypted communication, and preventing the session key from being cracked during long-term use.

[0026] In a second aspect of this application, a Bluetooth encrypted communication system is also provided, comprising: a first Bluetooth device, configured to automatically broadcast a pairing request containing an encrypted session key when a data reporting operation is triggered, wherein the session key is a dynamically generated random key, and the encrypted session key is obtained by encrypting the session key using a pre-shared key; a second Bluetooth device, configured to verify the validity of the session key upon receiving the pairing request, and send an acknowledgment message to the first Bluetooth device if the verification is successful; the first Bluetooth device and the second Bluetooth device are further configured to transmit data between the first Bluetooth device and the second Bluetooth device based on the session key using a preset encryption algorithm, wherein the acknowledgment message contains an identifier of the preset encryption algorithm.

[0027] In a third aspect of this application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the program to implement the method steps of any of the above claims.

[0028] In a fourth aspect of this application, a computer-readable storage medium is also provided, which stores instructions that, when executed, perform the method steps of any of the above claims.

[0029] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages:

[0030] 1. The first Bluetooth device automatically broadcasts a pairing request, reducing user operations and making the pairing process simpler; it dynamically generates and encrypts a random session key, avoiding static keys and plaintext transmission issues, thus enhancing security; the second Bluetooth device verifies the validity of the session key to ensure the reliability of pairing; both parties use a preset encryption algorithm to transmit data based on the session key, achieving the effect of improving pairing efficiency and security.

[0031] 2. A hash algorithm is used to dynamically generate a session key by combining the identity information of the first Bluetooth device and the current timestamp information, ensuring the randomness and dynamism of the key and enhancing the security of the pairing process; a pre-shared key is used to encrypt the session key to prevent it from being intercepted during transmission; and the pairing request is sent through the Bluetooth Low Energy broadcast channel to reduce device power consumption.

[0032] 3. The first and second Bluetooth devices continuously monitor the signal interference data in the 2.4GHz band, analyze the signal-to-noise ratio and channel occupancy, and dynamically switch to the operating frequency with the least interference for data transmission, thereby avoiding signal interference and improving the stability and reliability of Bluetooth encrypted communication. Attached Figure Description

[0033] Figure 1 This is a flowchart of a Bluetooth encrypted communication method provided in an embodiment of this application;

[0034] Figure 2 This is a framework diagram of a Bluetooth encrypted communication system provided in an embodiment of this application;

[0035] Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.

[0036] Explanation of reference numerals in the attached figures: 300 - Electronic device; 301 - Processor; 302 - Communication bus; 303 - User interface; 304 - Network interface; 305 - Memory. Detailed Implementation

[0037] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0038] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0039] In the description of the embodiments of this application, the term "multiple" means two or more. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0040] This application provides a Bluetooth encrypted communication method, referring to... Figure 1 , Figure 1 This is a flowchart of a Bluetooth encrypted communication method provided in an embodiment of this application. The method includes:

[0041] In step S101, when the first Bluetooth device triggers a data reporting operation, it automatically broadcasts a pairing request containing an encrypted session key. The session key is a dynamically generated random key, and the session key is encrypted using a pre-shared key.

[0042] Step S102: The second Bluetooth device listens to the broadcast channel in real time, verifies the received pairing request, and verifies the validity of the session key, including decrypting the encrypted session key using the pre-shared key.

[0043] Step S103: If the verification is successful, the second Bluetooth device sends a confirmation message to the first Bluetooth device.

[0044] In step S104, the first Bluetooth device and the second Bluetooth device transmit data using a preset encryption algorithm based on the session key, wherein the confirmation message contains a preset encryption algorithm identifier.

[0045] Through the above steps, the first Bluetooth device automatically broadcasts a pairing request, reducing user operations and simplifying the pairing process; it dynamically generates and encrypts a random session key, avoiding static keys and plaintext transmission issues, thus enhancing security; the second Bluetooth device verifies the validity of the session key to ensure reliable pairing; and both parties use a preset encryption algorithm based on the session key to transmit data, ensuring data transmission security. Therefore, this embodiment achieves the effect of improving pairing efficiency and security.

[0046] When the first Bluetooth device triggers a data reporting operation, it dynamically generates a random session key. This session key is temporary and randomly generated, offering higher security compared to traditional static keys. The first Bluetooth device then encrypts this session key using a pre-shared key, a key pre-determined between the communicating parties before communication begins. The encrypted session key is included in the pairing request and broadcast, requiring no manual triggering from the user. The second Bluetooth device listens to the broadcast channel in real time. Upon receiving the pairing request from the first Bluetooth device, it decrypts the encrypted session key using the same pre-shared key to verify its validity. If decryption is successful and the session key matches expectations, the pairing request is considered legitimate, and the second Bluetooth device sends an confirmation message to the first Bluetooth device. This confirmation message contains an identifier for a preset encryption algorithm, informing the first Bluetooth device which encryption algorithm will be used for subsequent data transmission. After the confirmation message is sent, both the first and second Bluetooth devices transmit data based on this dynamically generated session key and the preset encryption algorithm specified in the confirmation message. Because the session key is dynamically generated and may differ for each pairing process, and because encryption algorithms are used during data transmission, data transmission security is significantly improved.

[0047] This embodiment proposes a Bluetooth encrypted communication method based on a combination of a pre-shared key and a dynamic session key. When a first Bluetooth device needs to perform operations such as data reporting, it dynamically generates a random session key. This key is for one-time use and has strong unpredictability and security. Using a pre-shared key (PSK) negotiated securely beforehand, the session key is encrypted and broadcast to surrounding devices. A second Bluetooth device continuously listens to the broadcast channel. Upon receiving a pairing request, it decrypts the received encrypted session key using the same pre-shared key. If decryption is successful and the request is verified as valid, the pairing request is considered legitimate. After verification, the second Bluetooth device sends an acknowledgment message to the first Bluetooth device, which includes the identifier of the encryption algorithm used for subsequent communication (such as AES, SM4, ECC, etc.), thus negotiating encrypted communication parameters. Both parties then perform subsequent data transmission based on the dynamically generated session key and the specified encryption algorithm, ensuring the security of the communication process. It automates the pairing process without requiring manual user intervention, simplifying the Bluetooth connection steps and making it particularly suitable for scenarios requiring rapid connection of smart devices. It uses dynamically generated one-time session keys to avoid the security risks associated with using the same key for a long time. It encrypts session keys with pre-shared keys to prevent man-in-the-middle attacks (MITM) and eavesdropping. It supports an encryption algorithm negotiation mechanism, which can select the appropriate encryption algorithm based on the device's capabilities, further ensuring communication security.

[0048] In an optional embodiment, when the first Bluetooth device triggers a data reporting operation, it automatically broadcasts a pairing request containing an encrypted session key, including: when the first Bluetooth device triggers a data reporting operation, it dynamically generates a session key based on the identity information and current timestamp information of the first Bluetooth device using a hash algorithm; it encrypts the session key using a pre-shared key to obtain an encrypted session key; and it sends a pairing request through a Bluetooth Low Energy broadcast channel, wherein the pairing request includes the identity information, current timestamp information and encrypted session key of the first Bluetooth device.

[0049] In the above embodiments, the first Bluetooth device can automatically initiate pairing when the data reporting operation is triggered, eliminating the need for multiple user interactions, simplifying the operation process, saving time, and improving the user experience; a hash algorithm is used to dynamically generate a session key by combining the identity information of the first Bluetooth device and the current timestamp information, ensuring the randomness and dynamism of the key and enhancing the security of the pairing process; a pre-shared key is used to encrypt the session key to prevent it from being intercepted during transmission; and a pairing request is sent through a low-power Bluetooth broadcast channel to reduce device power consumption.

[0050] When the first Bluetooth device triggers a data reporting operation, it broadcasts a pairing request according to specific steps. First, it dynamically generates a session key using a hash algorithm, combining its own identification information and current timestamp information. The identification information is used to uniquely identify the device (such as a MAC address or device ID), while the timestamp information ensures that each generated session key is time-sensitive and unique. The hash algorithm (such as SHA-256) is used to process the above information to generate a unique and unpredictable session key, thus ensuring the randomness and uniqueness of the session key. Next, the generated session key is encrypted using a pre-shared key to obtain an encrypted session key. Finally, a pairing request is sent through the Bluetooth Low Energy broadcast channel, and this pairing request includes the first Bluetooth device's identification information, current timestamp information, and the encrypted session key. This embodiment generates a session key based on a hash algorithm, device identification, and timestamps. This key has higher randomness and unpredictability, reducing the risk of being cracked and making the foundation of encrypted communication more reliable. The introduction of timestamps makes pairing requests time-sensitive, allowing the receiver to determine whether to accept the request based on the current time, thereby effectively preventing old messages from being maliciously replayed and exploited. This improves the accuracy and effectiveness of the pairing process. By including identification information and timestamps in the pairing request, the receiver can more accurately verify the sender's identity and the timeliness of the request, reducing the possibility of invalid pairings and erroneous connections, and improving the stability of Bluetooth device communication.

[0051] In an optional embodiment, the second Bluetooth device listens to the broadcast channel in real time and verifies the received pairing request. Verifying the validity of the session key includes: the second Bluetooth device receiving the pairing request; the second Bluetooth device decrypting the encrypted session key using a pre-shared key to obtain a decrypted session key, wherein the pre-shared key is pre-stored in both the first and second Bluetooth devices; the second Bluetooth device using a hash algorithm to calculate the identity information and current timestamp information of the first Bluetooth device to obtain a first key; and verifying the validity of the session key by comparing the first key with the session key.

[0052] In the above embodiments, the validity of the session key in the pairing request broadcast by the second Bluetooth device to the first Bluetooth device is verified. The session key is dynamically generated and encrypted with a pre-shared key to ensure the security of key transmission. The use of a hash algorithm combined with device identity and timestamp information for verification can prevent the session key from being forged and ensure the security of Bluetooth pairing and subsequent communication processes.

[0053] The second Bluetooth device uses a pre-stored pre-shared key (PSK) to decrypt the received encrypted session key, restoring the original session key. Using the same hash algorithm (e.g., SHA-256), the second Bluetooth device recalculates and generates a first key based on the device identity and timestamp in the pairing request. This locally calculated first key is then compared with the decrypted session key to verify their consistency, thus confirming the key's legitimacy and integrity. If they match, the session key is valid, and the pairing request is legitimate; otherwise, the pairing request is invalid. Since the generation of the first key depends on the timestamp, the second Bluetooth device can indirectly verify the timestamp's validity (e.g., checking if it's within a reasonable time window), preventing replay attacks. This embodiment employs a dual authentication mechanism (decryption + local key generation comparison) to ensure that only devices holding the same pre-shared key and possessing correct identity and timeliness information can complete pairing. This significantly reduces the risk of data eavesdropping, tampering, or impersonation. The one-way nature of the hash algorithm prevents attackers from deducing identity or timestamps from the session key, enhancing the security of the key generation process. The introduction of timestamps, combined with dynamic session keys, ensures that the key for each pairing request is bound to the real-time time, significantly reducing the success rate of replay attacks. The second Bluetooth device does not require user input of a PIN code or manual confirmation; it can complete automated authentication solely through the pre-shared key and hash algorithm, maintaining ease of operation while improving security and balancing user experience with security requirements.

[0054] In an optional embodiment, the method further includes: the first Bluetooth device and the second Bluetooth device continuously monitor signal interference data in the 2.4 GHz band, and dynamically switch to the target operating frequency for data transmission by analyzing the signal-to-noise ratio and channel occupancy rate in real time, wherein the target operating frequency is the operating frequency with the least interference.

[0055] In the above embodiments, the first Bluetooth device and the second Bluetooth device continuously monitor the signal interference data of the 2.4GHz band, analyze the signal-to-noise ratio and channel occupancy rate, and dynamically switch to the operating frequency with the least interference for data transmission, thereby avoiding signal interference and improving the stability and reliability of Bluetooth encrypted communication.

[0056] The first and second Bluetooth devices continuously monitor signals in the 2.4GHz band, collecting interference data such as signal-to-noise ratio (SNR) and channel occupancy (SNR reflects signal quality, and channel occupancy reflects band congestion). By analyzing the monitoring data in real time, they assess the interference level of each operating frequency. For example, frequencies with low SNR and high channel occupancy are considered high-interference frequencies, and vice versa. Based on the analysis results, they automatically switch to the "target operating frequency" with the least interference for data transmission, ensuring communication always occurs on the optimal channel. Bluetooth operates in the 2.4GHz ISM public band, which is susceptible to interference from devices such as Wi-Fi, microwave ovens, and wireless mice operating on the same frequency. In related technologies, Bluetooth devices typically use fixed frequencies or simple frequency hopping (such as adaptive frequency hopping (AFH) in traditional Bluetooth, but which may rely on a preset channel list), failing to dynamically adapt to the real-time interference environment, leading to decreased data transmission rates, increased packet loss rates, and even connection interruptions. This embodiment reduces signal attenuation and bit error rate by real-time monitoring and dynamic switching to the frequency with the least interference, ensuring the reliability of data transmission, especially in high-interference scenarios (such as dense smart home environments and office areas). Compared with traditional fixed frequencies or preset frequency hopping, this mechanism can more accurately avoid real-time interference, reducing the number of retransmissions and connection retry frequencies caused by interference. Based on the dynamic selection of signal-to-noise ratio and channel occupancy, the device prioritizes the use of "idle and high-quality" frequencies, improving the overall utilization of the frequency band and reducing mutual interference between devices on the same frequency. Without the need for manual configuration or reliance on fixed channel planning, the device can autonomously adapt to dynamically changing interference environments (such as microwave oven start-up and shutdown, new Wi-Fi device access), improving the universality of Bluetooth communication.

[0057] In an optional embodiment, the method further includes: if the verification is successful, the second Bluetooth device sets the session key as a key parameter in a preset encryption algorithm; the first Bluetooth device and the second Bluetooth device respectively use the preset encryption algorithm to encrypt and decrypt the transmitted data based on the session key.

[0058] In the above embodiment, when the first Bluetooth device triggers data reporting, it automatically broadcasts a pairing request containing an encrypted session key. After listening and verifying, the second Bluetooth device sends a confirmation message. The second Bluetooth device sets the session key as the key parameter of a preset encryption algorithm. Based on this session key, the first and second Bluetooth devices use the preset encryption algorithm to encrypt and decrypt the transmitted data, which simplifies the Bluetooth pairing process, avoids multiple user interactions, and the dynamically generated and encrypted session key ensures the security of Bluetooth pairing and data transmission, thereby improving the user experience.

[0059] After the second Bluetooth device verifies the pairing request, it sets the decrypted session key as a key parameter in a preset encryption algorithm. The preset encryption algorithm is a pre-agreed encryption method, such as AES (Advanced Encryption Standard). The session key serves as the key parameter for this algorithm and is used for subsequent data encryption and decryption operations. During data transmission, the first and second Bluetooth devices respectively use the preset encryption algorithm and the session key to encrypt and decrypt the transmitted data. The sender uses the encryption algorithm and session key to encrypt plaintext data into ciphertext data, and the receiver uses the same encryption algorithm and session key to decrypt the ciphertext data back into plaintext data. Through this embodiment, a full-process security mechanism of "key generation → verification → application" is formed, from the dynamic generation of the session key, encrypted transmission, validity verification, to its final embedding as a parameter in the encryption algorithm. This ensures that data is encrypted and protected throughout the transmission process, avoiding communication failures due to mismatched algorithm parameters (e.g., one party uses AES-128, while the other mistakenly interprets it as AES-256). By binding the algorithm identifier in the confirmation message to the session key parameter, it ensures that both parties have strictly consistent configurations of the encryption algorithm.

[0060] In an optional embodiment, the first Bluetooth device and the second Bluetooth device transmit data using a preset encryption algorithm based on a session key, including: the first Bluetooth device collecting target data in real time and encrypting the target data using the preset encryption algorithm and the session key; the first Bluetooth device sending the encrypted target data to the second Bluetooth device; and the second Bluetooth device receiving the encrypted target data and decrypting it using the preset encryption algorithm and the session key to obtain the target data.

[0061] In the above embodiments, the first Bluetooth device can encrypt the target data collected in real time and transmit it to the second Bluetooth device. The second Bluetooth device then decrypts the encrypted data to obtain the target data. This realizes data transmission between Bluetooth devices based on dynamically generated and encrypted session keys and preset encryption algorithms, avoiding security issues caused by static key generation or plaintext transmission, simplifying pairing operations, and improving the convenience and security of Bluetooth communication.

[0062] The first Bluetooth device collects target data (such as sensor data, control commands, etc.) in real time. Based on a negotiated preset encryption algorithm (such as AES, SM4, etc.) and a dynamic session key, it encrypts the raw data to form ciphertext. The encrypted ciphertext is then sent to the second Bluetooth device via the Bluetooth channel. During transmission, only the ciphertext data exists; the raw data is not directly exposed to the channel. Upon receiving the ciphertext, the second Bluetooth device decrypts it using the exact same preset encryption algorithm and session key, restoring the ciphertext to the original target data, ensuring data consistency before and after transmission. By using a session key and preset encryption algorithm to encrypt and decrypt data, the security of Bluetooth communication data transmission is greatly improved, effectively preventing data theft and tampering. The dynamically generated session key and encrypted transmission mechanism make key management more secure and reliable, reducing the risk of key leakage and cracking. Encryption and decryption operations ensure the integrity and accuracy of data during transmission, reducing the possibility of data transmission errors and loss, thereby improving the reliability of Bluetooth communication.

[0063] In an optional embodiment, after the second Bluetooth device receives the encrypted target data and decrypts it using a preset encryption algorithm and a session key to obtain the target data, the method further includes: if the target data meets preset conditions, the second Bluetooth device sends a control command to the first Bluetooth device to instruct the first Bluetooth device to adjust monitoring parameters or perform corresponding operations.

[0064] In the above embodiment, when the first Bluetooth device triggers data reporting, it automatically broadcasts a pairing request containing a dynamically randomized and encrypted session key. The second Bluetooth device listens for and verifies the request. After successful verification, the two devices transmit data based on the session key using a preset encryption algorithm. The second Bluetooth device receives the encrypted target data and decrypts it to obtain the target data. If the target data meets the preset conditions, it can send a control command to the first Bluetooth device. This enables the second Bluetooth device to flexibly control the first Bluetooth device according to the target data, improving the flexibility and practicality of Bluetooth encrypted communication.

[0065] After receiving the encrypted target data sent by the first Bluetooth device, the second Bluetooth device decrypts it using a preset encryption algorithm and session key to recover the original plaintext data, i.e., the decrypted target data. If the decrypted target data meets preset conditions (e.g., the data value reaches a certain threshold, the data pattern conforms to a specific pattern, etc.), the second Bluetooth device sends control commands to the first Bluetooth device. These control commands can instruct the first Bluetooth device to adjust monitoring parameters (such as the sensor's sampling frequency, sensitivity, etc.) or perform corresponding operations (such as turning a device function on or off). By directly sending control commands to the second Bluetooth device according to preset conditions, intermediate steps in the control process are reduced, improving control efficiency. This method makes the control between Bluetooth devices more automated, requiring no manual intervention and improving the system's intelligence level. Through real-time monitoring and rapid response mechanisms, it is ensured that the first Bluetooth device can adjust or operate in a timely manner according to the instructions of the second Bluetooth device, improving the system's reliability.

[0066] In an optional embodiment, during communication, the first Bluetooth device and the second Bluetooth device also automatically adjust the complexity of the preset encryption algorithm based on environmental awareness data. The specific steps are as follows: The first Bluetooth device and the second Bluetooth device each have built-in environmental awareness sensors to monitor the noise and interference signal strength in the surrounding environment. The environmental awareness data includes the noise and interference signal strength in the surrounding environment. Based on the environmental awareness data, both devices dynamically assess the security level of the current communication environment. When the assessment result is high risk, both devices automatically increase the complexity of the encryption algorithm, using a higher level encryption algorithm and a longer key length. When the assessment result is low risk, both devices automatically reduce the complexity of the encryption algorithm.

[0067] In the above embodiments, the first Bluetooth device and the second Bluetooth device have built-in environmental perception sensors to monitor noise and interference signal strength. Based on the environmental perception data, they assess the security level of the communication environment and can accurately identify the degree of risk in the communication environment. When the risk is high, increasing the complexity of the encryption algorithm, using a higher level of encryption algorithm and a longer key length can enhance communication security and prevent data from being intercepted and cracked. When the risk is low, reducing the complexity of the encryption algorithm can reduce the consumption of device resources, improve communication efficiency, and achieve a balance between security and efficiency.

[0068] The first and second Bluetooth devices each have built-in environmental sensing sensors to monitor the strength of noise and interference signals in the surrounding environment. The environmental sensing data includes the strength of noise and interference signals in the surrounding environment. Based on the monitored environmental sensing data, both devices dynamically assess the security level of the current communication environment. This assessment may be based on thresholds for noise and interference signal strength; for example, when the noise or interference signal strength exceeds a certain threshold, the environment is considered less secure; conversely, it is considered more secure. When the assessment result is high-risk, both devices automatically increase the complexity of the encryption algorithm, using a higher-level encryption algorithm and a longer key length. For example, upgrading from AES-128 encryption to AES-256 encryption, or from RSA-1024 encryption to RSA-2048 encryption. When the assessment result is low-risk, both devices automatically reduce the complexity of the encryption algorithm. This reduces the computational resource consumption during encryption and decryption, improving communication efficiency. This embodiment demonstrates how, in high-risk communication environments, automatically increasing the complexity of the encryption algorithm effectively defends against potential attacks and protects the security of communication data. In low-risk communication environments, automatically reducing the complexity of the encryption algorithm decreases the computational resource consumption during encryption and decryption, thereby improving communication efficiency. The device can dynamically adjust its encryption strategy based on real-time monitored environmental data, ensuring good performance in different communication environments. By dynamically adjusting the complexity of the encryption algorithm, energy consumption and computational load can be minimized while ensuring communication security, making it particularly suitable for battery-powered mobile devices or Internet of Things (IoT) devices. When potential security threats are detected, the system can promptly strengthen encryption measures, effectively resisting attackers' attempts to intercept or tamper with data. Allowing the device to flexibly adjust its encryption strategy based on real-time environmental conditions enables Bluetooth technology to better serve diverse application scenarios, including home automation, the industrial internet, and healthcare.

[0069] As an optional implementation, when dynamically assessing the security level of the current communication environment based on environmental awareness data, the local resource status of the first and second Bluetooth devices can also be considered. Local resource status includes remaining battery power, CPU load, and memory usage. When the security level is high-risk and the remaining battery power of either device is below a preset battery threshold, both devices prioritize lightweight encryption algorithms. When the security level is low-risk and the CPU load is below a preset load threshold, both devices can temporarily increase the complexity of the encryption algorithm for security reinforcement. In other words, based on environmental risk assessment, the encryption strategy is dynamically adjusted by integrating the device's own resource status (battery power, CPU, memory). For example, in high-risk + low-battery scenarios, lightweight algorithms (such as AES-128 instead of AES-256) are prioritized to reduce power consumption while ensuring basic security. In low-risk + low-load scenarios, the encryption strength is temporarily increased (such as increasing the number of hash operation rounds) to enhance security using idle resources without affecting device performance. Related technologies may only consider external environmental interference without considering the device's own status (e.g., high-strength encryption on a low-battery device will accelerate power consumption), which may lead to a sudden drop in device battery life or performance lag. This embodiment intelligently switches encryption strategies based on the device's "health status" to avoid "over-security" or "performance overdraft," and is especially suitable for low-power IoT devices (such as sensor nodes and wearable devices).

[0070] In an optional embodiment, based on environmental perception data, both devices dynamically assess the security level of the current communication environment, including: when the noise decibel value in the surrounding environment is greater than or equal to a preset decibel threshold, or the interference signal strength is greater than or equal to a preset signal strength threshold, the current communication environment is determined to be high-risk; when the noise decibel value in the surrounding environment is less than a preset decibel threshold and the interference signal strength is less than a preset signal strength threshold, the current communication environment is determined to be low-risk.

[0071] In the above embodiments, the current communication environment can be accurately determined as high-risk or low-risk based on the comparison between the ambient noise decibel value and the interference signal strength and the preset threshold. This provides a basis for automatically adjusting the complexity of the preset encryption algorithm, enabling Bluetooth encrypted communication to flexibly adjust the encryption strength according to the actual environment, ensuring communication security while avoiding resource waste caused by over-encryption.

[0072] The first and second Bluetooth devices have built-in environmental sensors (such as signal detection modules and microphone noise detection) to monitor the noise level and wireless interference intensity (such as the signal strength of Wi-Fi and other Bluetooth devices) of the surrounding environment in real time. Both devices assess the security risk level (e.g., low or high risk) of the current communication environment based on environmental data (such as signal-to-noise ratio and interference source density). A preset decibel threshold is used to measure the background noise level in the environment, and a preset signal strength threshold is used to measure the interference intensity of other wireless signals in the environment. When the noise level in the surrounding environment is greater than or equal to the preset decibel threshold, or when the interference signal strength is greater than or equal to the preset signal strength threshold, the current communication environment is determined to be high-risk. When the noise level in the surrounding environment is less than the preset decibel threshold and the interference signal strength is less than the preset signal strength threshold, the current communication environment is determined to be low-risk. For example, in high-risk environments (such as densely populated public Wi-Fi areas): automatically switch to more complex algorithms (such as AES-256 instead of AES-128) or longer key lengths (such as increasing from 128 bits to 256 bits); in low-risk environments (such as home private networks): reduce encryption strength (such as using lightweight Chacha20) to save computing resources.

[0073] In an optional embodiment, during communication, the first Bluetooth device and the second Bluetooth device further employ a time synchronization protocol to ensure accurate synchronization of their timestamps. The time synchronization protocol includes the following steps: when broadcasting a pairing request, the first Bluetooth device simultaneously sends its current timestamp information; after receiving the pairing request, the second Bluetooth device records the received current timestamp information and calculates an adjustment amount based on network latency and clock offset to calibrate its local timestamp; when sending an acknowledgment message, the second Bluetooth device attaches the calibrated local timestamp for the first Bluetooth device to verify and synchronize; based on the synchronized timestamps, both parties dynamically adjust the session key generation cycle and the parameter update frequency of the encryption algorithm.

[0074] In the above embodiments, when the first Bluetooth device broadcasts a pairing request, it sends the current timestamp information. The second Bluetooth device receives the information and calibrates its local timestamp, and then attaches the calibrated local timestamp for the first Bluetooth device to verify and synchronize. This ensures that the timestamps of both parties are accurately synchronized. Based on the synchronized timestamps, both parties dynamically adjust the generation cycle of the session key and the parameter update frequency of the encryption algorithm, which can improve the security and flexibility of Bluetooth encrypted communication and make the encryption mechanism better adapt to actual communication situations.

[0075] When broadcasting a pairing request, the first Bluetooth device sends its local current timestamp along with the message. The timestamp can be based on the device's internal clock or reference a standard time source. Upon receiving the timestamp, the second Bluetooth device records its own local timestamp. Based on the network transmission delay (estimated via round-trip time (RTT)) and clock offset (the clock difference between the two devices), it calculates an adjustment value for calibration. This adjustment value is then used to correct its local timestamp to match that of the first Bluetooth device. When sending an acknowledgment message, the second Bluetooth device includes its calibrated local timestamp, which the first Bluetooth device uses to verify and further adjust its own timestamp, achieving bidirectional synchronization. Based on time synchronization, both devices dynamically adjust the session key generation cycle and control the update frequency of the encryption algorithm parameters.

[0076] In an optional embodiment, the method further includes: after each data transmission ends, the first Bluetooth device and the second Bluetooth device dynamically update the session key based on preset rules, wherein the preset rules include, but are not limited to: the amount of data transmitted reaches a predetermined threshold, and a predetermined time interval has elapsed.

[0077] In the above embodiments, after each data transmission ends, the first Bluetooth device and the second Bluetooth device dynamically update the session key based on preset rules to avoid security issues caused by the key remaining unchanged for a long time, enhance the security of Bluetooth encrypted communication, and prevent the session key from being cracked during long-term use.

[0078] After each data transmission, both devices dynamically update the session key according to preset rules. This mechanism ensures that even if an attacker obtains the session key at some point, they cannot use it in subsequent communications, thus improving communication security. For example, when the amount of data transmitted reaches a certain threshold, a session key update is triggered. This prevents attackers from acquiring enough information to crack the key through large data transmissions. After a certain time interval, regardless of the data transmission volume, the session key is updated. This time interval can be adjusted according to the security requirements of the communication environment. Dynamically updating the session key prevents data leakage and tampering even if an attacker obtains it at some point; flexibly adjusting the session key update frequency through preset rules avoids unnecessary update operations, reduces computational resource consumption, and improves communication efficiency.

[0079] The triggering conditions for dynamically updating the session key based on preset rules also include security time monitoring results. The security events include at least one of the following: the number of times illegal pairing requests are received exceeds a preset threshold; the bit error rate of transmitted data is detected to exceed a preset bit error rate threshold three times consecutively; or the MAC address of the first Bluetooth device or the second Bluetooth device is tampered with.

[0080] It should be noted that the above embodiments describe pairing connections initiated by the first Bluetooth device as an example. However, in practical applications, the initiator of a pairing connection is not limited to the first Bluetooth device. The second Bluetooth device can also initiate a pairing connection. When the second Bluetooth device initiates a pairing connection, its operation process is similar to that of the first Bluetooth device, only the roles are reversed. For example, when the second Bluetooth device (such as a smartphone) needs to actively read data from the first Bluetooth device (such as a smart bracelet), the second Bluetooth device can broadcast a pairing request. At this time, the original role of the "first Bluetooth device" becomes the responder, using the same pre-shared key to decrypt the session key and reply with a confirmation message. All technical features such as dynamic key generation, environmental awareness encryption adjustment, and time synchronization protocol in the aforementioned embodiments remain consistent; only the roles of "broadcast" and "listen" in the process need to be swapped. There are other typical application scenarios, such as a mobile phone controlling a smart door lock, where the mobile phone (second Bluetooth device) actively initiates pairing, and the door lock (first Bluetooth device) executes the command after verifying the key; or, in industrial central control, sensors are polled, the central control unit (second Bluetooth device) broadcasts requests periodically, and the sensors (first Bluetooth device) respond as needed.

[0081] The present application will now be described in detail with reference to specific embodiments.

[0082] After Bluetooth device A (corresponding to the aforementioned first Bluetooth device) is powered on, it automatically broadcasts a pairing request containing a randomly generated session key;

[0083] After receiving the pairing request, Bluetooth device B (corresponding to the aforementioned second Bluetooth device) verifies the validity of the session key and responds with an acknowledgment message;

[0084] Devices A and B communicate using a preset encryption algorithm based on a session key, ensuring secure information transmission.

[0085] Taking the quick pairing between a smartwatch (Device A) and a smartphone (Device B) as an example, when the smartwatch enables Bluetooth searching, it automatically broadcasts a pairing request carrying a randomly generated 128-bit session key. Upon receiving the request, the smartphone verifies the session key using its built-in encryption module and sends a confirmation message. Both parties then use the AES encryption algorithm based on this session key for subsequent communication, effectively preventing unauthorized access.

[0086] Furthermore, to enhance encryption strength, a mechanism for dynamically adjusting session keys is adopted, regenerating a new session key before each communication to resist long-term eavesdropping attacks.

[0087] Implementation method:

[0088] (1) Before each communication begins, device A generates a new session key and sends it to device B through an encrypted channel;

[0089] (2) After receiving the new session key, device B immediately updates the key parameters in the encryption algorithm;

[0090] (3) Both parties perform data encryption and decryption operations based on the new session key to ensure that each communication is in a highly secure state.

[0091] Furthermore, to improve the stability and anti-interference capability of Bluetooth signals, intelligent frequency modulation technology is introduced, which automatically adjusts the operating frequency according to the ambient noise to avoid signal conflicts.

[0092] Implementation method:

[0093] (1) The Bluetooth device continuously monitors the surrounding electromagnetic environment and analyzes the frequency distribution of noise sources;

[0094] (2) Based on the analysis results, intelligently select the operating frequency with the least interference;

[0095] (3) Synchronize frequency adjustment information between devices to ensure that the communication frequencies of both parties are consistent, thereby improving communication quality and speed.

[0096] Compared with related technologies, this application has at least the following technical effects: 1) It adopts a mechanism for dynamically generating session keys, which significantly improves the encryption strength and effectively defends against potential eavesdropping and attacks; 2) It introduces intelligent frequency modulation technology, which significantly improves the stability of Bluetooth signals and can maintain high-quality communication even in complex electromagnetic environments; 3) It optimizes the pairing process, reduces user operation steps, improves user experience, and makes the connection between Bluetooth devices faster and more convenient.

[0097] This application also provides a Bluetooth encrypted communication system, such as Figure 2 As shown, Figure 2 This is a framework diagram of a Bluetooth encrypted communication system provided in an embodiment of this application. The system includes:

[0098] The first Bluetooth device is used to automatically broadcast a pairing request containing an encrypted session key when a data reporting operation is triggered. The session key is a dynamically generated random key, and the encrypted session key is obtained by encrypting the session key with a pre-shared key. The second Bluetooth device is used to verify the validity of the session key when it receives the pairing request, and send an acknowledgment message to the first Bluetooth device if the verification is successful. The first and second Bluetooth devices are also used to transmit data between the first and second Bluetooth devices based on the session key using a preset encryption algorithm. The acknowledgment message contains an identifier of the preset encryption algorithm.

[0099] It should be noted that the system provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0100] This application also provides a computer-readable storage medium storing instructions that, when executed, perform the steps of any of the methods described above.

[0101] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0102] This application also discloses an electronic device. For example... Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. The electronic device 300 may include: at least one processor 301, at least one communication bus 302, a user interface 303, at least one network interface 304, and a memory 305.

[0103] The communication bus 302 is used to enable communication between these components.

[0104] The user interface 303 may include a display screen and a camera. Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0105] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0106] The processor 301 may include one or more processing cores. The processor 301 connects to various parts of the electronic device (such as a server) using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 305, and by calling data stored in memory 305. Optionally, the processor 301 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 301 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 301 and may be implemented as a separate chip.

[0107] The memory 305 may include random access memory (RAM) or read-only memory. Optionally, the memory 305 may include a non-transitory computer-readable storage medium. The memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 305 may also be at least one storage device located remotely from the aforementioned processor 301. (Refer to...) Figure 3 The memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a Bluetooth encrypted communication method.

[0108] exist Figure 3In the illustrated electronic device 300, the user interface 303 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 301 can be used to call an application program of a Bluetooth encrypted communication method stored in the memory 305. When executed by one or more processors 301, the electronic device 300 performs one or more of the methods described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0109] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0110] In the various embodiments provided in this application, it should be understood that the disclosed apparatus or system can be implemented in other ways. For example, the apparatus or system embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.

[0111] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the disclosure herein.

[0112] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art that are not described in this disclosure.

Claims

1. A Bluetooth encrypted communication method, characterized in that, include: When the first Bluetooth device triggers a data reporting operation, it automatically broadcasts a pairing request containing an encrypted session key, wherein the session key is a dynamically generated random key and is encrypted with a pre-shared key; The second Bluetooth device listens to the broadcast channel in real time, verifies the received pairing request, and verifies the validity of the session key, including decrypting the encrypted session key using the pre-shared key; If the verification is successful, the second Bluetooth device sends a confirmation message to the first Bluetooth device; The first Bluetooth device and the second Bluetooth device transmit data using a preset encryption algorithm based on the session key, wherein the confirmation message contains a preset encryption algorithm identifier; During communication, the first Bluetooth device and the second Bluetooth device automatically adjust the complexity of the preset encryption algorithm based on environmental awareness data. The specific steps are as follows: The first Bluetooth device and the second Bluetooth device each have a built-in environmental sensing sensor for monitoring the noise and interference signal strength in the surrounding environment. The environmental sensing data includes the noise and interference signal strength in the surrounding environment. Based on the environmental perception data, both devices dynamically assess the security level of the current communication environment; When the assessment result is high risk, both devices automatically increase the complexity of the encryption algorithm, using a higher level of encryption algorithm and a longer key length; When the assessment result is low risk, both devices automatically reduce the complexity of the encryption algorithm.

2. The method according to claim 1, characterized in that, When the first Bluetooth device triggers a data reporting operation, it automatically broadcasts a pairing request containing an encrypted session key, including: When the first Bluetooth device triggers a data reporting operation, it dynamically generates the session key based on the identity information and current timestamp information of the first Bluetooth device using a hash algorithm; The session key is encrypted using the pre-shared key to obtain the encrypted session key; The pairing request is sent via a Bluetooth Low Energy broadcast channel, wherein the pairing request includes the identity information of the first Bluetooth device, the current timestamp information, and the encrypted session key.

3. The method according to claim 2, characterized in that, The second Bluetooth device listens to the broadcast channel in real time and verifies the received pairing request. Verifying the validity of the session key includes: The second Bluetooth device receives the pairing request; The second Bluetooth device uses the pre-shared key to decrypt the encrypted session key to obtain the decrypted session key, wherein the pre-shared key is pre-stored in the first Bluetooth device and the second Bluetooth device; The second Bluetooth device uses the hash algorithm to calculate the identity information of the first Bluetooth device and the current timestamp information to obtain the first key; The validity of the session key is verified by comparing the first key with the session key.

4. The method according to claim 1, characterized in that, The method further includes: The first Bluetooth device and the second Bluetooth device continuously monitor signal interference data in the 2.4GHz band. By analyzing the signal-to-noise ratio and channel occupancy rate in real time, they dynamically switch to the target operating frequency for data transmission. The target operating frequency is the operating frequency with the least interference.

5. The method according to claim 1, characterized in that, The first Bluetooth device and the second Bluetooth device transmit data using a preset encryption algorithm based on the session key, including: The first Bluetooth device collects target data in real time and encrypts the target data using the preset encryption algorithm and the session key; The first Bluetooth device sends the encrypted target data to the second Bluetooth device; The second Bluetooth device receives the encrypted target data, decrypts it using the preset encryption algorithm and the session key, and obtains the target data.

6. The method according to claim 5, characterized in that, After the second Bluetooth device receives the encrypted target data and decrypts it using the preset encryption algorithm and the session key to obtain the target data, the method further includes: When the target data meets the preset conditions, the second Bluetooth device sends a control command to the first Bluetooth device to instruct the first Bluetooth device to adjust the monitoring parameters or perform corresponding operations.

7. A Bluetooth encrypted communication system, characterized in that, include: A first Bluetooth device is configured to automatically broadcast a pairing request containing an encrypted session key when a data reporting operation is triggered, wherein the session key is a dynamically generated random key, and the encrypted session key is obtained by encrypting the session key using a pre-shared key; The second Bluetooth device is used to verify the validity of the session key when it receives the pairing request, and send an confirmation message to the first Bluetooth device if the verification is successful. The first Bluetooth device and the second Bluetooth device are further configured to transmit data between the first Bluetooth device and the second Bluetooth device based on the session key using a preset encryption algorithm, wherein the confirmation message includes a preset encryption algorithm identifier; During communication, the first Bluetooth device and the second Bluetooth device also automatically adjust the complexity of the preset encryption algorithm based on environmental awareness data in the following ways: The first Bluetooth device and the second Bluetooth device each have a built-in environmental sensing sensor for monitoring the noise and interference signal strength in the surrounding environment. The environmental sensing data includes the noise and interference signal strength in the surrounding environment. Based on the environmental perception data, both devices dynamically assess the security level of the current communication environment; When the assessment result is high risk, both devices automatically increase the complexity of the encryption algorithm, using a higher level of encryption algorithm and a longer key length; When the assessment result is low risk, both devices automatically reduce the complexity of the encryption algorithm.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for unlocking intelligent door lock by earphones and earphones

    CN109671192A

  • Data processing method based on charging pile, charging pile and terminal

    CN118075740A