Bluetooth encryption communication method and system, electronic equipment and storage medium

By automatically broadcasting pairing requests with encrypted session keys and verifying them in real time through Bluetooth devices, combined with pre-shared keys and hash algorithms, the problems of complex Bluetooth pairing processes and security risks are solved, and efficient and secure Bluetooth communication is achieved.

CN120769256AActive Publication Date: 2025-10-10BEIJING HUIXINTONG ELECTRONIC TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510987050.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2025-10-10
Estimated Expiration
2045-07-17

AI Technical Summary

Technical Problem

The pairing process of Bluetooth devices is complex and poses security risks, especially when data exchange is easily intercepted, resulting in a poor user experience.

Method used

The first Bluetooth device automatically broadcasts a pairing request containing an encrypted session key, and the second Bluetooth device monitors and verifies the validity of the session key in real time. Both devices use a preset encryption algorithm based on the session key for data transmission, dynamically generate a random session key and encrypt it using a pre-shared key, and combine the hash algorithm and environmental perception data for security adjustment.

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, and prevents keys from being intercepted and tampered with.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120769256A_ABST
    Figure CN120769256A_ABST
Patent Text Reader

Abstract

The invention provides a Bluetooth encryption communication method and system, electronic equipment and a storage medium, and relates to the technical field of wireless communication, and the method comprises the steps that when a first Bluetooth device triggers a data reporting operation, a pairing request containing an encrypted session key is automatically broadcasted, the session key is a dynamically generated random key, and the pairing request is sent to the first Bluetooth device; encrypting the session key through the pre-shared key; the second Bluetooth device monitors 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 by using the pre-shared key; under the condition that the verification is passed, the second Bluetooth device sends a confirmation message to the first Bluetooth device; and the first Bluetooth device and the second Bluetooth device perform data transmission by adopting a preset encryption algorithm based on the session key, and the confirmation message contains a preset encryption algorithm identifier. By implementing the technical scheme provided by the invention, the effect of improving the pairing efficiency and safety is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of wireless communication technology, and in particular to a Bluetooth encrypted communication method, system, electronic device and storage medium. Background Art

[0002] As an important short-range wireless communication technology, Bluetooth communication provides a convenient data transmission channel between different devices. For example, Bluetooth technology is widely used in scenarios such as smart wearables, smart homes, and in-vehicle Bluetooth devices. In related technologies, Bluetooth devices are typically paired using a PIN code or pairing request confirmation method, requiring multiple user interactions. This pairing method is complex and time-consuming, and the data exchange process may be intercepted, resulting in a poor user experience. As can be seen, the Bluetooth pairing process in related technologies is relatively cumbersome and poses certain security risks. Summary of the Invention

[0003] In order to solve the above technical problems, the present application provides a Bluetooth encrypted communication method, system, electronic device and storage medium.

[0004] In the first aspect, the present application provides a Bluetooth encrypted communication method, including: 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 the session key is encrypted by a pre-shared key; the second Bluetooth device monitors 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 use a preset encryption algorithm based on the session key to transmit data, wherein the confirmation message contains a preset encryption algorithm identifier.

[0005] By adopting this technical solution, the first Bluetooth device automatically broadcasts a pairing request, reducing user interaction and simplifying the pairing process. A random session key is dynamically generated and encrypted, avoiding static key and plaintext transmission issues and enhancing security. The second Bluetooth device verifies the validity of the session key to ensure pairing reliability. Both parties use a pre-set encryption algorithm based on the session key for data transmission, ensuring data security. Therefore, this technical solution improves 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, dynamically generating a session key based on the identity information and current timestamp information of the first Bluetooth device through a hash algorithm; encrypting the session key using a pre-shared key to obtain an encrypted session key; and sending a pairing request through a low-power Bluetooth 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 solution, the first Bluetooth device can automatically initiate pairing when triggering the data reporting operation, without 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 in combination with 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 the session key from being intercepted during transmission; and a pairing request is sent through a low-power Bluetooth broadcast channel to reduce device power consumption.

[0008] Optionally, the second Bluetooth device monitors 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 a pre-shared key to decrypt the encrypted session key to obtain a 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 a hash algorithm to operate the identity information and current timestamp information of the first Bluetooth device to obtain a first key; and verifies 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 the security of the key transmission is guaranteed by pre-shared key encryption, and the hash algorithm is used in combination with the device identity and timestamp information for verification, which can prevent the session key from being forged and ensure the security of Bluetooth pairing and subsequent communication processes.

[0010] Optionally, the above method also includes: the first Bluetooth device and the second Bluetooth device continuously monitor the signal interference data in the 2.4GHz frequency band, and dynamically switch to the target operating frequency for data transmission through real-time analysis of the signal-to-noise ratio and channel occupancy, 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 in the 2.4GHz frequency 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 also includes: if the verification is successful, the second Bluetooth device sets the session key to the key parameter in the preset encryption algorithm; the first Bluetooth device and the second Bluetooth device respectively use the preset encryption algorithm based on the session key to encrypt and decrypt the transmitted data.

[0013] By adopting the above technical solution, the first Bluetooth device automatically broadcasts a pairing request containing an encrypted session key when triggering data reporting, and the second Bluetooth device sends a confirmation message after listening and verification. The second Bluetooth device sets the session key to the key parameter of the preset encryption algorithm. The first and second Bluetooth devices encrypt and decrypt the transmitted data based on this session key using the preset encryption algorithm, which simplifies the Bluetooth pairing process and avoids multiple user interactions. The dynamically generated and encrypted session key ensures the security of Bluetooth pairing and data transmission, and improves the user experience.

[0014] Optionally, the first Bluetooth device and the second Bluetooth device use a preset encryption algorithm based on the session key to transmit data, including: the first Bluetooth device collects target data in real time, and encrypts the target data using a preset encryption algorithm and 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 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, thereby realizing 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 also includes: when the target data meets preset conditions, the second Bluetooth device sends a control instruction 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 dynamic random and encrypted session key, and the second Bluetooth device listens and verifies. After the verification is passed, the two use a preset encryption algorithm based on the session key to transmit data. 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 instruction to the first Bluetooth device, enabling the second Bluetooth device to flexibly control the first Bluetooth device according to the target data situation, thereby improving the flexibility and practicality of Bluetooth encrypted communication.

[0018] Optionally, during the communication process, the first Bluetooth device and the second Bluetooth device also automatically adjust the complexity of the preset encryption algorithm based on the environmental perception data. The specific steps are as follows: the first Bluetooth device and the second Bluetooth device each have a built-in environmental perception sensor for monitoring the noise and interference signal strength in the surrounding environment. The environmental perception data includes the noise and interference signal strength in the surrounding environment; based on the environmental perception data, both devices dynamically evaluate the security level of the current communication environment; when the evaluation result is high risk, both devices automatically increase the complexity of the encryption algorithm and adopt a higher-level encryption algorithm and a longer key length; when the evaluation result is low risk, both devices automatically reduce the complexity of the encryption algorithm.

[0019] By adopting the above technical solution, the first Bluetooth device and the second Bluetooth device have built-in environmental perception sensors to monitor the noise and interference signal strength, and evaluate the security level of the communication environment based on the environmental perception data, so as to accurately identify the risk level of the communication environment; when the risk is high, the complexity of the encryption algorithm is increased, and a higher-level encryption algorithm and a longer key length are adopted to enhance communication security and prevent data from being intercepted and cracked; when the risk is low, the complexity of the encryption algorithm is reduced, which can reduce device resource consumption, improve communication efficiency, and achieve a balance between security and efficiency.

[0020] Optionally, based on the environmental perception data, the devices of both parties dynamically evaluate 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, determining that the current communication environment is high risk; when the noise decibel value in the surrounding environment is less than the preset decibel threshold and the interference signal strength is less than the preset signal strength threshold, determining that the current communication environment is low risk.

[0021] By adopting the above technical solution, it is possible to accurately judge whether the current communication environment is high-risk or low-risk based on the comparison of the decibel value of the surrounding environment noise and the interference signal strength with the preset threshold, thereby providing a basis for the subsequent automatic adjustment of the complexity of the preset encryption algorithm, so that Bluetooth encrypted communication can flexibly adjust the encryption strength according to the actual environment, which not only ensures communication security but also avoids the waste of resources caused by excessive encryption.

[0022] Optionally, during the communication process, the first Bluetooth device and the second Bluetooth device further adopt a time synchronization protocol to ensure the accurate synchronization of the timestamps of both parties. The time synchronization protocol includes the following steps: when the first Bluetooth device broadcasts a pairing request, it also sends the current timestamp information; after the second Bluetooth device receives the pairing request, it records the received current timestamp information, and calculates the adjustment amount based on the network delay and clock offset to calibrate the local timestamp; when the second Bluetooth device sends a confirmation message, it attaches the calibrated local timestamp for the first Bluetooth device to verify and synchronize; based on the synchronized timestamps, both parties dynamically adjust the generation period of the session key and the parameter update frequency of the encryption algorithm.

[0023] By adopting the above technical solution, the first Bluetooth device sends the current timestamp information when broadcasting a pairing request, the second Bluetooth device receives the information and calibrates the local timestamp, and then attaches the calibrated local timestamp for verification and synchronization by the first Bluetooth device, thereby ensuring that the timestamps of both parties are accurately synchronized. Based on the synchronized timestamps, both parties dynamically adjust the generation period 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 also includes: after each data transmission is completed, 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 transmitted data reaches a predetermined threshold and a predetermined time interval has passed.

[0025] By adopting the above technical solution, the first Bluetooth device and the second Bluetooth device dynamically update the session key based on preset rules after each data transmission, 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 the second aspect of the present application, a Bluetooth encrypted communication system is also provided, including: a first Bluetooth device, used 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 through a pre-shared key; a second Bluetooth device, used to verify the validity of the session key when receiving the pairing request, and send a confirmation message to the first Bluetooth device if the verification is successful; the first Bluetooth device and the second Bluetooth device are also used to transmit data between the first Bluetooth device and the second Bluetooth device through a preset encryption algorithm based on the session key, wherein the preset encryption algorithm identifier is included in the confirmation message.

[0027] In a third aspect of the present application, an electronic device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements any one of the above method steps when executing the program.

[0028] In a fourth aspect of the present application, a computer-readable storage medium is further provided. The computer-readable storage medium stores instructions. When the instructions are executed, any one of the above method steps is performed.

[0029] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: 1. The first Bluetooth device automatically broadcasts a pairing request to reduce user operations and make the pairing process simpler. A random session key is dynamically generated and encrypted to avoid static key and plaintext transmission issues and enhance security. The second Bluetooth device verifies the validity of the session key to ensure pairing reliability. Both parties use a preset encryption algorithm based on the session key for data transmission, achieving the effect of improving pairing efficiency and security. 2. A hash algorithm is used to dynamically generate a session key by combining the first Bluetooth device's identity information and the current timestamp information, ensuring the randomness and dynamism of the key and enhancing the security of the pairing process. The session key is encrypted using a pre-shared key to prevent it from being intercepted during transmission. Pairing requests are sent over the Bluetooth low energy broadcast channel to reduce device power consumption. 3. The first Bluetooth device and the second Bluetooth device continuously monitor the 2.4GHz frequency band signal interference data, 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 This is a flowchart of a Bluetooth encrypted communication method provided by an embodiment of the present application; Figure 2 This is a framework diagram of a Bluetooth encrypted communication system provided by an embodiment of the present application; Figure 3 This is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.

[0031] Description of reference numerals: 300 - electronic device; 301 - processor; 302 - communication bus; 303 - user interface; 304 - network interface; 305 - memory. DETAILED DESCRIPTION

[0032] In order 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 in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

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

[0034] In the description of the embodiments of the present application, the term "plurality" means two or more. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of such features. The terms "include," "comprise," "have" and their variations all mean "including but not limited to," unless otherwise specifically emphasized.

[0035] This application provides a Bluetooth encrypted communication method, referring to Figure 1 , Figure 1 : is a flowchart of a Bluetooth encrypted communication method provided by an embodiment of the present application, the method comprising: Step S101: When a data reporting operation is triggered, the first Bluetooth device automatically broadcasts a pairing request including an encrypted session key, wherein the session key is a dynamically generated random key and is encrypted using a pre-shared key. Step S102: The second Bluetooth device monitors 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; Step S103: If the verification is successful, the second Bluetooth device sends a confirmation message to the first Bluetooth device; Step S104: The first Bluetooth device and the second Bluetooth device use a preset encryption algorithm to perform data transmission based on the session key, wherein the confirmation message includes an identifier of the preset encryption algorithm.

[0036] Through the above steps, the first Bluetooth device automatically broadcasts a pairing request, reducing user operations and simplifying the pairing process. A random session key is dynamically generated and encrypted, avoiding static key and plaintext transmission issues and enhancing security. The second Bluetooth device verifies the validity of the session key to ensure pairing reliability. Both parties use a pre-set encryption algorithm based on the session key for data transmission, ensuring data security. Therefore, this embodiment achieves improved pairing efficiency and security.

[0037] 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 than traditional static keys. The first Bluetooth device then encrypts this session key using a pre-shared key (PSK), a key pre-shared between the communicating parties and determined before communication begins. The encrypted session key is included in the pairing request and broadcast, eliminating the need for manual user triggering. The second Bluetooth device monitors 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 PSK to verify its validity. If the decryption is successful and the session key matches the expected value, the pairing request is legitimate. The second Bluetooth device then sends a confirmation message to the first Bluetooth device. This confirmation message includes a pre-set encryption algorithm identifier, informing the first Bluetooth device of the encryption algorithm to be used for subsequent data transmission. After the confirmation message is sent, the first and second Bluetooth devices use the dynamically generated session key and the pre-set encryption algorithm specified in the confirmation message for data transmission. Because the session key is dynamically generated, it can be different for each pairing process. Furthermore, the encryption algorithm used during data transmission significantly enhances data transmission security.

[0038] 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, one-time, unpredictable, and secure session key. It then encrypts the session key using a pre-shared key (PSK) negotiated securely by both parties and broadcasts it to surrounding devices. A second Bluetooth device continuously monitors the broadcast channel and, upon receiving a pairing request, decrypts the encrypted session key using the same pre-shared key. If the decryption is successful and verified to be valid, the pairing request is considered legitimate. Upon verification, the second Bluetooth device sends a confirmation message to the first Bluetooth device, containing the encryption algorithm identifier (such as AES, SM4, or ECC) to be used in subsequent communications, thereby negotiating encryption communication parameters. Both parties perform subsequent data transmission based on the dynamically generated session key and the specified encryption algorithm, ensuring the security of the communication process. It implements an automated pairing process without manual user intervention, simplifying the Bluetooth connection steps and making it particularly suitable for scenarios where smart devices require quick connection. It uses dynamically generated one-time session keys to avoid the security risks associated with long-term use of the same key. 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, allowing users to select the appropriate encryption algorithm based on device capabilities to further ensure communication security.

[0039] 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, dynamically generating a session key based on the identity information and current timestamp information of the first Bluetooth device through a hash algorithm; encrypting the session key using a pre-shared key to obtain an encrypted session key; and sending a pairing request through a low-power Bluetooth broadcast channel, wherein the pairing request includes the identity information, current timestamp information and encrypted session key of the first Bluetooth device.

[0040] In the above embodiment, the first Bluetooth device can automatically initiate pairing when triggering the data reporting operation, without 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 in combination with the identity information of the first Bluetooth device and the current timestamp information to ensure the randomness and dynamism of the key and enhance the security of the pairing process; a pre-shared key is used to encrypt the session key to prevent the session key from being intercepted during transmission; and a pairing request is sent through a low-power Bluetooth broadcast channel to reduce device power consumption.

[0041] When the first Bluetooth device triggers a data reporting operation, it broadcasts a pairing request according to specific steps. First, a hash algorithm is used to dynamically generate a session key, combining its own identity information and the current timestamp. The identity 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 timely and unique. This information is then processed using a hash algorithm (such as SHA-256) to generate a unique and unpredictable session key, ensuring the randomness and uniqueness of the session key. The generated session key is then encrypted using a pre-shared key to obtain an encrypted session key. Finally, a pairing request is sent via the Bluetooth Low Energy broadcast channel, and this pairing request contains the identity information of the first Bluetooth device, the current timestamp information, and the encrypted session key. This embodiment generates a session key based on a hash algorithm, device identity, and a timestamp, which has higher randomness and unpredictability, reduces the risk of being cracked, and makes the basis of encrypted communication more reliable; the introduction of a timestamp makes the pairing request time-sensitive, and the recipient can determine whether to accept the request based on the current time, thereby effectively preventing old messages from being maliciously replayed and exploited; improves the accuracy and effectiveness of the pairing process; by including identity information and a timestamp in the pairing request, the recipient can more accurately verify the identity of the sender and the timeliness of the request, reduces the possibility of invalid pairing and erroneous connection, and improves the stability of Bluetooth device communication.

[0042] In an optional embodiment, the second Bluetooth device monitors the broadcast channel in real time and verifies the received pairing request, and the verification of 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 a hash algorithm to operate the identity information and current timestamp information of the first Bluetooth device to obtain the first key; and the validity of the session key is verified by comparing the first key with the session key.

[0043] In the above embodiment, the second Bluetooth device verifies the validity of the session key in the pairing request broadcast by the first Bluetooth device, dynamically generates the session key and ensures the security of key transmission through pre-shared key encryption, and uses a hash algorithm combined with device identity and timestamp information for verification, which can prevent the session key from being forged and ensure the security of Bluetooth pairing and subsequent communication processes.

[0044] The second Bluetooth device decrypts the received encrypted session key using a pre-stored pre-shared key (PSK) to restore the original session key. Using the same hash algorithm (e.g., SHA-256), the second Bluetooth device recalculates the first key based on the device identity and timestamp in the pairing request. This generates a locally calculated first key. By comparing the first key with the decrypted session key, the device verifies their consistency, thereby 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. Because the generation of the first key relies on the timestamp, the second Bluetooth device can indirectly verify the validity of the timestamp (e.g., checking whether it is within a reasonable time window) to prevent replay attacks. This embodiment uses a dual authentication mechanism (decryption + locally generated key comparison) to ensure that only devices holding the same pre-shared key and with the correct identity and expiration 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 inferring the identity or timestamp from the session key, enhancing the security of the key generation process. The introduction of the timestamp combined with the dynamic session key ensures that the key for each pairing request is bound to the real time, significantly reducing the success rate of replay attacks. The second Bluetooth device automatically verifies using the pre-shared key and hash algorithm, eliminating the need for the user to enter a PIN or manually confirm. This improves security while maintaining ease of operation, balancing user experience with security requirements.

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

[0046] In the above embodiment, the first Bluetooth device and the second Bluetooth device continuously monitor the signal interference data of the 2.4GHz frequency 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.

[0047] The first and second Bluetooth devices continuously monitor signals in the 2.4GHz band, collecting interference data such as the signal-to-noise ratio (SNR) and channel occupancy. (The SNR reflects signal quality, while the channel occupancy reflects frequency congestion.) These devices analyze this data in real time to assess the interference level at each operating frequency. For example, frequencies with low SNRs and high channel occupancy are considered high-interference frequencies, while frequencies with low SNRs and high channel occupancy are considered low-interference frequencies. Based on this analysis, the devices automatically switch to the "target operating frequency" with the lowest interference for data transmission, ensuring that communication always occurs on the optimal channel. Bluetooth operates in the 2.4GHz ISM public band and is susceptible to co-channel interference from devices such as Wi-Fi, microwave ovens, and wireless mice. Related technologies typically use fixed frequencies or simple frequency hopping (such as adaptive frequency hopping (AFH) in traditional Bluetooth, which may rely on a preset channel list). These devices are unable to dynamically adapt to the interference environment in real time, resulting in reduced data rates, increased packet loss, and even connection interruptions. This embodiment reduces signal attenuation and bit error rates through real-time monitoring and dynamic switching to the frequency with minimal interference, ensuring data transmission reliability. This is particularly effective 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. Dynamic selection based on signal-to-noise ratio and channel occupancy allows devices to prioritize the use of "idle and high-quality" frequencies, improving overall frequency band utilization and reducing mutual interference between devices on the same frequency. Without manual configuration or reliance on fixed channel planning, devices can autonomously adapt to dynamically changing interference environments (such as microwave ovens starting and stopping, new Wi-Fi devices connecting), improving the universality of Bluetooth communication.

[0048] In an optional embodiment, the above method also 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 based on the session key to encrypt and decrypt the transmitted data.

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

[0050] After the second Bluetooth device verifies that the pairing request is successful, 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 algorithm's key parameter and is used for subsequent data encryption and decryption operations. During data transmission, the first and second Bluetooth devices use the preset encryption algorithm and session key, respectively, 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. This embodiment forms a full-process security mechanism of "key generation → verification → application," from the dynamic generation, encrypted transmission, validity verification, and final embedding of the session key as a parameter in the encryption algorithm. This ensures full encryption protection during data transmission and prevents communication failures due to algorithm parameter mismatches (e.g., one party using AES-128 and the other mistakenly identifying it as AES-256). By binding the algorithm identifier in the confirmation message to the session key parameters, both parties are ensured to have strictly consistent encryption algorithm configurations.

[0051] In an optional embodiment, the first Bluetooth device and the second Bluetooth device use a preset encryption algorithm based on a session key to transmit data, 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 the session key to obtain the target data.

[0052] In the above embodiment, 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, thereby realizing 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.

[0053] The first Bluetooth device collects target data (such as sensor data and control instructions) in real time and encrypts the original data using a negotiated preset encryption algorithm (such as AES or SM4) and a dynamic session key to generate ciphertext. This encrypted ciphertext is then sent to the second Bluetooth device via the Bluetooth channel. During transmission, only the ciphertext exists, and the original data is not directly exposed to the channel. After 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 and ensuring data consistency before and after transmission. Encrypting and decrypting data using session keys and preset encryption algorithms significantly improves the security of Bluetooth communication data transmission and effectively prevents data theft and tampering. The dynamically generated session keys and encrypted transmission mechanism make key management more secure and reliable, reducing the risk of key leakage and cracking. The 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.

[0054] In an optional embodiment, 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 also includes: when the target data meets preset conditions, the second Bluetooth device sends a control instruction to the first Bluetooth device to instruct the first Bluetooth device to adjust the monitoring parameters or perform corresponding operations.

[0055] In the above embodiment, when the first Bluetooth device triggers data reporting, it automatically broadcasts a pairing request containing a dynamic random and encrypted session key. The second Bluetooth device listens and verifies. After the verification is passed, the two use a preset encryption algorithm based on the session key to transmit data. 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 instruction to the first Bluetooth device, enabling the second Bluetooth device to flexibly control the first Bluetooth device according to the target data, thereby improving the flexibility and practicality of Bluetooth encrypted communication.

[0056] 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 restore 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 will send control instructions to the first Bluetooth device. These control instructions can instruct the first Bluetooth device to adjust monitoring parameters (such as the sampling frequency and sensitivity of a sensor) or perform corresponding operations (such as turning a device function on or off). By directly sending control instructions based on preset conditions in the second Bluetooth device, the intermediate links in the control process are reduced and control efficiency is improved. This method makes control between Bluetooth devices more automated, eliminating the need for human intervention and improving the intelligence level of the system. Through real-time monitoring and a rapid response mechanism, it ensures that the first Bluetooth device can promptly adjust or operate according to the instructions of the second Bluetooth device, thereby improving system reliability.

[0057] In an optional embodiment, the first Bluetooth device and the second Bluetooth device also automatically adjust the complexity of the preset encryption algorithm based on the environmental perception data during the communication process. The specific steps are as follows: the first Bluetooth device and the second Bluetooth device are respectively equipped with built-in environmental perception sensors for monitoring the noise and interference signal strength in the surrounding environment. The environmental perception data includes the noise and interference signal strength in the surrounding environment; based on the environmental perception data, both devices dynamically evaluate the security level of the current communication environment; when the evaluation result is high risk, both devices automatically increase the complexity of the encryption algorithm and adopt a higher-level encryption algorithm and a longer key length; when the evaluation result is low risk, both devices automatically reduce the complexity of the encryption algorithm.

[0058] In the above embodiment, the first Bluetooth device and the second Bluetooth device have built-in environmental perception sensors to monitor the noise and interference signal strength, and evaluate the security level of the communication environment based on the environmental perception data, so as to accurately identify the risk level of the communication environment; when the risk is high, the complexity of the encryption algorithm is increased, and a higher-level encryption algorithm and a longer key length are adopted to enhance communication security and prevent data from being intercepted and cracked; when the risk is low, the complexity of the encryption algorithm is reduced, which can reduce device resource consumption, improve communication efficiency, and achieve a balance between security and efficiency.

[0059] The first and second Bluetooth devices each have built-in environmental sensing sensors to monitor 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 this environmental sensing data, both devices dynamically assess the security level of the current communication environment. This security level assessment may be based on noise and interference signal strength thresholds. For example, when the noise or interference signal strength exceeds a certain threshold, the environment is considered to be less secure; otherwise, it is considered to be more secure. If the assessment result is high risk, both devices automatically increase the complexity of the encryption algorithm, adopting a higher-level encryption algorithm and a longer key length. For example, upgrading from AES-128 to AES-256 or from RSA-1024 to RSA-2048. If the assessment result is low risk, both devices automatically reduce the complexity of the encryption algorithm. This reduces computing resource consumption during encryption and decryption, improving communication efficiency. Through this embodiment, in high-risk communication environments, by automatically increasing the complexity of the encryption algorithm, it is possible to effectively resist potential attacks and protect the security of communication data. In low-risk communication environments, by automatically reducing the complexity of the encryption algorithm, the computing resource consumption during the encryption and decryption processes is reduced, thereby improving communication efficiency. The device can dynamically adjust the encryption strategy based on the real-time monitored environmental perception data, so that it can maintain good performance in different communication environments. By dynamically adjusting the complexity of the encryption algorithm, energy consumption and computing load can be minimized while ensuring communication security, which is particularly suitable for battery-powered mobile devices or Internet of Things (IoT) devices. When a potential security threat is detected, the system can promptly strengthen encryption measures to effectively resist attackers' attempts to intercept or tamper with data. Allowing devices to flexibly adjust encryption strategies based on real-time environmental conditions enables Bluetooth technology to better serve diverse application scenarios, whether in home automation, industrial Internet, or healthcare.

[0060] As an optional implementation, when dynamically evaluating the security level of the current communication environment according to the environment perception data, the local resource state of the first Bluetooth device and the second Bluetooth device can also be combined, the local resource state including the remaining power of the device, the CPU load and the memory occupancy rate; when the security level is high risk and the remaining power of any device is lower than a preset power threshold, the lightweight encryption algorithm is preferentially selected by the two devices; when the security level is low risk and the CPU load of the device is lower than a preset load threshold, the encryption algorithm complexity can be temporarily increased to perform security reinforcement by the two devices. That is, on the basis of the environment risk evaluation, the device itself resource state (power, CPU and memory) is fused to dynamically adjust the encryption strategy, for example, for the high risk + low power scenario, the lightweight algorithm (such as AES-128 instead of AES-256) is preferentially selected, the basic security is ensured while the energy consumption is reduced; for the low risk + low load scenario, the encryption strength is temporarily increased (such as increasing the number of hash operation rounds), the idle resources are used to enhance the security without affecting the device performance. In the related technology, only the external environmental interference can be considered, the device itself state (such as the low power device performing high strength encryption will accelerate power consumption) is not combined, which can cause the device endurance to be greatly reduced or the performance to be stalled. The present embodiment intelligently switches the encryption strategy according to the device “health state”, avoids “security overkill” or “performance overdraft”, and is especially suitable for low-power Internet of Things devices (such as sensor nodes and wearable devices).

[0061] In an optional embodiment, according to the environment perception data, the two devices dynamically evaluate 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, it is determined that the current communication environment is high risk; when the noise decibel value in the surrounding environment is less than the preset decibel threshold and the interference signal strength is less than the preset signal strength threshold, it is determined that the current communication environment is low risk.

[0062] In the above embodiment, according to the comparison of the surrounding environment noise decibel value and the interference signal strength with the preset threshold, it can be accurately judged whether the current communication environment is high risk or low risk, thereby providing a basis for subsequent automatic adjustment of the preset encryption algorithm complexity, so that the Bluetooth encryption communication can flexibly adjust the encryption strength according to the actual environment, which not only ensures the communication security, but also avoids the resource waste caused by excessive encryption.

[0063] The first and second Bluetooth devices have built-in environmental sensors (such as signal detection modules and microphone noise detection) that monitor the surrounding noise level and wireless interference intensity (such as Wi-Fi and the signal strength of other Bluetooth devices) in real time. Both devices assess the security risk level (e.g., low risk 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 decibel value of the surrounding noise is greater than or equal to the preset decibel threshold, or 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 decibel value of the surrounding noise 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 public Wi-Fi-dense areas), the system automatically switches to a higher-complexity algorithm (such as AES-256 instead of AES-128) or a longer key length (such as increasing from 128 bits to 256 bits). In low-risk environments (such as home private networks), the system reduces encryption strength (such as using lightweight Chacha20) to save computing resources.

[0064] In an optional embodiment, the first Bluetooth device and the second Bluetooth device further adopt a time synchronization protocol to ensure the accurate synchronization of the timestamps of both parties during the communication process. The time synchronization protocol includes the following steps: the first Bluetooth device sends the current timestamp information at the same time when broadcasting the pairing request; after the second Bluetooth device receives the pairing request, it records the received current timestamp information and calculates the adjustment amount based on the network delay and clock offset to calibrate the local timestamp; when the second Bluetooth device sends a confirmation message, it 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 period and the encryption algorithm parameter update frequency.

[0065] In the above embodiment, the first Bluetooth device sends the current timestamp information when broadcasting a pairing request, the second Bluetooth device receives the information and calibrates the local timestamp, and then attaches the calibrated local timestamp for verification and synchronization by the first Bluetooth device, thereby ensuring that the timestamps of both parties are accurately synchronized. Based on the synchronized timestamps, both parties dynamically adjust the generation period 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.

[0066] When broadcasting a pairing request, the first Bluetooth device sends out its local current timestamp information. The timestamp can be based on the device's internal clock or referenced to a standard time source. After receiving the timestamp, the second Bluetooth device records its own local timestamp. Based on the network transmission delay (which can be estimated by the round-trip time RTT) and the clock offset (the clock difference between the two devices), it calculates an adjustment value for calibration. The adjustment value is used to correct its local timestamp to keep it consistent with that of the first Bluetooth device. When sending a confirmation message, the second Bluetooth device includes the calibrated local timestamp, which the first Bluetooth device verifies and further adjusts its own timestamp accordingly to achieve two-way synchronization. Based on time synchronization, both devices dynamically adjust the generation cycle of the session key and control the update frequency of the encryption algorithm parameters.

[0067] In an optional embodiment, the above method also includes: after each data transmission is completed, 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 transmitted data reaches a predetermined threshold and a predetermined time interval has passed.

[0068] In the above embodiment, 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.

[0069] After each data transmission, both devices dynamically update the session key according to pre-set rules. This mechanism ensures that even if an attacker obtains the session key at a certain point, they cannot use it in subsequent communications, thereby 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 obtaining sufficient information to crack the key through large amounts of data transmission. The session key is updated after a certain interval, regardless of the amount of data transmitted. This interval can be adjusted to suit the security requirements of the communication environment. Dynamic session key updates prevent attackers from using the key in subsequent communications, even if they obtain it at a certain point, effectively preventing data leakage and tampering. Flexible adjustment of the session key update frequency based on pre-set rules avoids unnecessary updates, reduces computing resource consumption, and improves communication efficiency.

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

[0071] It should be noted that the aforementioned embodiments describe a pairing connection initiated by a first Bluetooth device as an example. However, in actual applications, the initiator of a pairing connection is not limited to the first Bluetooth device; a second Bluetooth device can also initiate a pairing connection. When a second Bluetooth device initiates a pairing connection, the operational process is similar to that of the first Bluetooth device, with the roles swapped. For example, when a second Bluetooth device (such as a smartphone) needs to actively read data from a first Bluetooth device (such as a smart bracelet), it can broadcast a pairing request. At this point, the original "first Bluetooth device" becomes the responder, decrypting the session key using the same pre-shared key and sending a confirmation message. All technical features, such as dynamic key generation, context-aware encryption adjustment, and time synchronization protocols, remain consistent across the aforementioned embodiments; only the "broadcasting" and "listening" roles in the process need to be swapped. Other typical application scenarios include a mobile phone controlling a smart door lock, where the phone (second Bluetooth device) actively initiates pairing, and the door lock (first Bluetooth device) verifies the key and executes the command; or an industrial central control system polling sensors, where the central control system (second Bluetooth device) periodically broadcasts requests, and the sensors (first Bluetooth device) respond on demand.

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

[0073] After Bluetooth device A (corresponding to the aforementioned first Bluetooth device) is started, it automatically broadcasts a pairing request including a randomly generated session key; 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 a confirmation message; Devices A and B communicate data based on the session key and a preset encryption algorithm to ensure the security of information transmission.

[0074] For example, consider the fast pairing between a smartwatch (Device A) and a smartphone (Device B). When the smartwatch initiates Bluetooth search, it automatically broadcasts a pairing request containing 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. Subsequent communications between the two parties are encrypted using the AES algorithm based on this session key, effectively preventing unauthorized access.

[0075] Furthermore, in order to enhance the encryption strength, a mechanism for dynamically adjusting the session key is adopted, and a new session key is regenerated before each communication to resist long-term monitoring attacks.

[0076] Implementation method: (1) Before each communication begins, device A generates a new session key and sends it to device B through an encrypted channel; (2) After receiving the new session key, device B immediately updates the key parameters in the encryption algorithm; (3) Both parties perform data encryption and decryption operations based on the new session key to ensure that each communication is highly secure.

[0077] Furthermore, in order to improve the stability and anti-interference ability of Bluetooth signals, intelligent frequency modulation technology is introduced to automatically adjust the operating frequency according to the environmental noise to avoid signal conflicts.

[0078] Implementation method: (1) Bluetooth devices continuously monitor the surrounding electromagnetic environment and analyze the frequency distribution of noise sources; (2) Based on the analysis results, intelligently select the operating frequency with the least interference; (3) Synchronize frequency adjustment information between devices to ensure that the communication frequencies of both parties are consistent, thereby improving communication quality and speed.

[0079] 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 maintains 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.

[0080] 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 the present application, which includes: The first Bluetooth device is used to automatically broadcast a pairing request including 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 upon receiving the pairing request, and send a confirmation message to the first Bluetooth device if the verification is successful; the first Bluetooth device and the second Bluetooth device are further used to transmit data between the first Bluetooth device and the second Bluetooth device using a preset encryption algorithm based on the session key, wherein the confirmation message includes a preset encryption algorithm identifier.

[0081] It should be noted that the system provided in the above embodiment is only used as an example to illustrate the division of the above functional modules when realizing the functions thereof. In actual applications, the above functions can be completed by different functional modules according to the needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be described here.

[0082] The present application also provides a computer readable storage medium, which stores instructions, when the instructions are executed, performing the method steps of any one of the above.

[0083] In an exemplary embodiment, the above computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various computer program storage media.

[0084] The present application also discloses an electronic device. As shown in Figure 3 Figure 3 is a structural schematic diagram of an electronic device disclosed by the present application embodiment. The electronic device 300 can 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.

[0085] The communication bus 302 is used to realize the connection and communication between the components.

[0086] The user interface 303 can include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 can also include a standard wired interface and a wireless interface.

[0087] The network interface 304 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

[0088] ​The processor 301 may include one or more processing cores. The processor 301 utilizes various interfaces and circuits to connect various components within the electronic device (e.g., a server). It executes instructions, programs, code sets, or instruction sets stored in the memory 305 and accesses data stored in the memory 305 to perform various server functions and process data. Optionally, the processor 301 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 301 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing content displayed on the display; and the modem handles wireless communications. It is understood that the modem may also be implemented as a separate chip, rather than integrated into the processor 301.

[0089] Among them, the memory 305 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, 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 a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may also optionally be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module and an application of a Bluetooth encryption communication method.

[0090] exist Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call an application of a Bluetooth encrypted communication method stored in the memory 305. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, in order to simplify the description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described order of actions, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.

[0091] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0092] In the several embodiments provided in this application, it should be understood that the disclosed device or system can be implemented in other ways. For example, the device or system embodiments described above are merely schematic, such as the division of units, which is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0093] The foregoing is merely an exemplary embodiment of the present disclosure and is not intended to limit the scope of the present disclosure. In other words, any equivalent variations and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the disclosure herein.

[0094] This application is intended to cover any modifications, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field not described in the present 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 including an encrypted session key, wherein the session key is a dynamically generated random key and is encrypted using a pre-shared key; The second Bluetooth device monitors 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 use a preset encryption algorithm to perform data transmission based on the session key, wherein the confirmation message includes the preset encryption algorithm identifier.

2. The method according to claim 1, characterized in that When the first Bluetooth device triggers the 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, the session key is dynamically generated based on the identity information of the first Bluetooth device and the current timestamp information through a hash algorithm; Encrypting the session key using the pre-shared key to obtain the encrypted session key; The pairing request is sent through a low-power Bluetooth 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 monitors 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 decrypts the encrypted session key using the pre-shared 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 a 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, wherein The method further comprises: The first Bluetooth device and the second Bluetooth device continuously monitor signal interference data in the 2.4 GHz frequency band, and dynamically switch to a target operating frequency for data transmission by real-time analysis of the signal-to-noise ratio and channel occupancy, wherein the target operating frequency is the operating frequency with the least interference.

5. The method according to claim 1, wherein The first Bluetooth device and the second Bluetooth device use a preset encryption algorithm based on the session key to perform data transmission, 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 and decrypts the data using the preset encryption algorithm and the session key to obtain 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 the data using the preset encryption algorithm and the session key to obtain the target data, the method further includes: When the target data meets a preset condition, the second Bluetooth device sends a control instruction to the first Bluetooth device to instruct the first Bluetooth device to adjust monitoring parameters or perform corresponding operations.

7. The method according to claim 1, characterized in that During the communication process, the first Bluetooth device and the second Bluetooth device also automatically adjust the complexity of the preset encryption algorithm based on the environmental perception data. The specific steps are as follows: The first Bluetooth device and the second Bluetooth device are respectively equipped with an environment perception sensor for monitoring noise and interference signal strength in the surrounding environment, and the environment perception data includes the noise in the surrounding environment and the interference signal strength; Based on the environmental perception data, the two devices dynamically evaluate the security level of the current communication environment; If the assessment result is high risk, both devices will 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.

8. A Bluetooth encrypted communication system, characterized in that: include: a first Bluetooth device, configured to automatically broadcast a pairing request including 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 configured to verify the validity of the session key upon receiving the pairing request, and send a 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 perform data transmission between the first Bluetooth device and the second Bluetooth device using a preset encryption algorithm based on the session key, wherein the confirmation message includes an identifier of the preset encryption algorithm.

9. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is performed.

Citation Information

Patent Citations

  • Key negotiation method and system and Bluetooth device

    CN107947931A

  • Method for unlocking intelligent door lock by earphones and earphones

    CN109671192A

  • Pairing method applied to short-distance communication system and wireless equipment

    CN115315968A

  • Digital vehicle key pairing method, electronic equipment and service system

    CN117917903A

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

    CN118075740A