A Bluetooth connection method, device, system, equipment and medium
By using preset broadcast transmission power and signal strength judgment in Bluetooth connections, it ensures that only connections are established with legitimate Bluetooth master devices, solving the problem of Bluetooth connection information leakage and improving security.
Patent Information
- Application Number
- CN202211209025.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-09-30
AI Technical Summary
In the existing Bluetooth connection scheme, the risk of information leakage between the Bluetooth master device and the slave device is high. The attacking device can pretend to be the master device and initiate a connection to obtain the private information of the slave device.
By broadcasting targeted broadcast messages based on the preset broadcast transmission power, and judging the legality of the connection request based on the signal strength value, if the signal strength value is less than the threshold, the connection is prohibited; if the signal strength value is not less than the threshold, the connection is established, authentication and Key verification ensures that connections are only established with legitimate master devices.
It effectively improves the security of Bluetooth connections, prevents information leakage, ensures that slave devices only establish connections with legitimate master devices, and enhances connection security.
Smart Images

Figure CN115550895B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless technology, and in particular to a Bluetooth connection method, device, system, equipment and medium. Background Art
[0002] In the existing Bluetooth connection scheme, the Bluetooth master device and the Bluetooth slave device use the Bluetooth low energy connection protocol (Bluetooth low energy, BLE), and Bluetooth low energy connections are divided into multiple types such as general connection and directional connection. In the directional connection, the Bluetooth slave device broadcasts a directional broadcast message, which includes the address of the Bluetooth slave device and the address of the Bluetooth master device; after the Bluetooth master device receives the directional broadcast message and determines that its own address is the same as the address of the Bluetooth master device in the message, it sends a connection request to the Bluetooth slave device and enters the connection state.
[0003] The address of the Bluetooth master device is divided into a public address and a random address. The public address is fixedly assigned and is usually written in the firmware. It is a public and unique address and cannot be changed at will. The random address is not fixedly assigned, but is randomly generated after the Bluetooth master device is started.
[0004] After obtaining the directed broadcast message, the attacking device can disguise itself as the Bluetooth master device to initiate a connection with the Bluetooth slave device based on the address of the Bluetooth master device in the directed broadcast message, and further obtain the private air interface information of the Bluetooth slave device, causing information leakage of the Bluetooth slave device.
[0005] Therefore, how to ensure the security of Bluetooth connections and avoid information leakage from Bluetooth devices has become an urgent problem to be solved. Summary of the invention
[0006] The present invention provides a Bluetooth connection method, device, system, equipment and medium, which are used to solve the problem of low security of Bluetooth connection in the prior art.
[0007] The present invention provides a Bluetooth connection method, the method comprising:
[0008] Based on the preset broadcast transmission power, broadcast target directional broadcast message;
[0009] If a Bluetooth low energy (BLE) connection request is received, the signal strength value of the BLE connection request is determined; if the signal strength value is less than a preset threshold, it is determined that the BLE connection request is sent by a non-Bluetooth master device, and establishing a Bluetooth connection with the non-Bluetooth master device is prohibited; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by the Bluetooth master device, and a Bluetooth connection with the Bluetooth master device is established.
[0010] Further, establishing a Bluetooth connection with the Bluetooth master device includes:
[0011] Establishing a BLE connection with the Bluetooth master device;
[0012] If the first host random MAC address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is successfully authenticated, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast;
[0013] Receive a communication connection request sent by the Bluetooth master device, and establish a communication connection with the Bluetooth master device.
[0014] Furthermore, the method further comprises:
[0015] If the first host random mac address sent by the Bluetooth master device is not received, and / or the first access address Access Addr and the first negotiation key stored by itself are not sent to the Bluetooth master device, it is determined that the Bluetooth master device has not been authenticated successfully, then the authentication is determined to be completed and the BLE connection with the Bluetooth master device is disconnected.
[0016] Further, after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device, the method further includes:
[0017] Obtain the second host MAC address and the second negotiation key carried in the communication connection request;
[0018] Determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key;
[0019] If the above judgment results are all yes, the subsequent step of establishing a communication connection with the Bluetooth master device is executed.
[0020] Furthermore, the method further comprises:
[0021] If the above judgment results are not all yes, then the communication connection request is determined to be an illegal connection, and the communication connection request is not responded to.
[0022] Accordingly, the present invention provides a Bluetooth connection device, the device comprising:
[0023] A broadcast module, used to broadcast a target directional broadcast message based on a preset broadcast transmission power;
[0024] A connection module is used to determine the signal strength value of a Bluetooth low energy BLE connection request if it is received; if the signal strength value is less than a preset threshold, determine that the BLE connection request is sent by a non-Bluetooth master device, and prohibit establishing a Bluetooth connection with the non-Bluetooth master device; if the signal strength value is not less than the preset threshold, determine that the BLE connection request is sent by the Bluetooth master device, and establish a Bluetooth connection with the Bluetooth master device.
[0025] Furthermore, the connection module is specifically used to establish a BLE connection with the Bluetooth master device; if the first host random mac address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is authenticated successfully, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast; a communication connection request sent by the Bluetooth master device is received, and a communication connection with the Bluetooth master device is established.
[0026] Furthermore, the connection module is also used to determine that the authentication is completed and disconnect the BLE connection with the Bluetooth master device if the first host random MAC address sent by the Bluetooth master device is not received and / or the first access address Access Addr and the first negotiation key stored in itself are not sent to the Bluetooth master device, and it is determined that the Bluetooth master device has not been authenticated successfully.
[0027] Furthermore, the connection module is also used to obtain the second host mac address and the second negotiation key carried in the communication connection request after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device; determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key; if the above judgment results are all yes, execute the subsequent steps of establishing a communication connection with the Bluetooth master device.
[0028] Furthermore, the connection module is further configured to determine that the communication connection request is an illegal connection and not respond to the communication connection request if the above judgment results are not all yes.
[0029] Accordingly, the present invention provides a Bluetooth connection system, which includes: a Bluetooth master device and a Bluetooth slave device that executes the above Bluetooth connection method.
[0030] Accordingly, the present invention provides an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0031] The memory stores a computer program, and when the program is executed by the processor, the processor executes the steps of any one of the above-mentioned Bluetooth connection methods.
[0032] Accordingly, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any one of the above-mentioned Bluetooth connection methods.
[0033] The present invention provides a Bluetooth connection method, apparatus, system, equipment and medium. In this method, a target directional broadcast message is broadcast based on a preset broadcast transmission power. Since the preset broadcast transmission power is low, a Bluetooth master device can only receive the target directional broadcast message at a close distance of a Bluetooth slave device, while a non-Bluetooth master device obtains the target directional broadcast message at a long distance. Therefore, after receiving a Bluetooth low energy BLE connection request, a signal strength value of the BLE connection request is determined. If the signal strength value is less than a preset threshold, it is determined that the BLE connection request is sent by a non-Bluetooth master device, and establishing a Bluetooth connection with the non-Bluetooth master device is prohibited; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by a Bluetooth master device, and a Bluetooth connection with the Bluetooth master device is established, thereby ensuring that the Bluetooth slave device only establishes a Bluetooth connection with the Bluetooth master device, thereby ensuring the security of the Bluetooth connection and avoiding information leakage of the Bluetooth slave device. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0035] Figure 1 A schematic diagram of a Bluetooth connection method according to an embodiment of the present invention;
[0036] Figure 2 A schematic diagram of the structure of a Bluetooth connection device provided by an embodiment of the present invention;
[0037] Figure 3 A schematic diagram of a Bluetooth connection system provided by an embodiment of the present invention;
[0038] Figure 4A schematic diagram of a Bluetooth connection method according to an embodiment of the present invention;
[0039] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] The prior art adopts a pairing method called Just Work, in which the Bluetooth master device actively initiates a connection request and completes the pairing. The user does not need to participate in the pairing process, nor does the user need to know the knowledge of Bluetooth pairing, which provides a good user experience. However, since the user does not participate in the Bluetooth pairing process in the Just Work mode, the Bluetooth master device may be connected to an illegal Bluetooth slave device without the user's knowledge, which poses a great security risk.
[0042] An existing method for enhancing the security of a directional connection Bluetooth address is to quantify the most recent multiple frequency hopping characteristic information to form an advanced key; otherwise, the frequency hopping channel information in the most recent frequency hopping characteristic information is used to form a reference key; the directional broadcast end uses the advanced key or the reference key to encrypt the address in the broadcast message, and after the encryption is completed, a directional broadcast is performed; after the scanning end scans and obtains the broadcast message, it uses the advanced key or the reference key to decrypt it, and when the address in the decrypted broadcast message is consistent with its own address, a directional connection is initiated; this method can avoid Bluetooth device information leakage and improve the security of the directional connection Bluetooth address; however, the encryption of the Bluetooth address cannot solve the problem of address leakage.
[0043] An existing authentication method, electronic device and storable medium for Bluetooth devices are used to authenticate with a gateway device when network configuration is required, wherein corresponding device information is extracted based on built-in identification information, verification information of the Bluetooth device is obtained through the extracted device information, the verification information of the Bluetooth device is compared with the verification information of the gateway device, and whether the authentication is passed is determined based on the comparison result; when the Bluetooth device is configured with a network, it is necessary to authenticate with the gateway device through network authentication, and a gateway needs to be added and connected to the network, which increases maintenance costs, and network configuration cannot be achieved if the network is abnormal.
[0044] In order to improve the security of Bluetooth connection, embodiments of the present invention provide a Bluetooth connection method, apparatus, system, device and medium.
[0045] Embodiment 1:
[0046] Figure 1 A schematic diagram of a Bluetooth connection method provided by an embodiment of the present invention, the process includes the following steps:
[0047] S101: Based on the preset broadcast transmission power, a target-directed broadcast message is broadcast.
[0048] In order to improve the security of Bluetooth connection, a Bluetooth connection method provided in an embodiment of the present invention is applied to a Bluetooth slave device, wherein the Bluetooth slave device may be an electronic device with Bluetooth function, for example, the electronic device may be a tablet computer, a smart phone, a laptop computer, a Bluetooth speaker or other device with Bluetooth function, and the embodiment of the present invention does not limit this.
[0049] The Bluetooth slave device broadcasts a targeted directional broadcast message based on the preset broadcast transmission power. The directional broadcast is to establish a Bluetooth connection as soon as possible. Therefore, the targeted directional broadcast message carries the address of the Bluetooth slave device and the address of the Bluetooth master device. The directional broadcast cannot last for more than 1.28 seconds. If the Bluetooth master device does not actively request to stop or the Bluetooth connection is not established, the Bluetooth slave device will stop broadcasting.
[0050] The addresses of Bluetooth devices are divided into public addresses (Public MAC) and random addresses (Random MAC). The public address is fixedly assigned and is generally written in the firmware. It is a public and unique address and cannot be changed at will.
[0051] In order to reduce the possibility of the target-directed broadcast message being obtained by the attacking device, the pre-set broadcast transmission power in the embodiment of the present invention is low power, for example, the broadcast transmission power may be 0dbm. Therefore, the Bluetooth connection method in the embodiment of the present invention is only applicable to the search, discovery and connection of the Bluetooth master device which is close to the Bluetooth slave device.
[0052] S102: If a Bluetooth low energy (BLE) connection request is received, determine the signal strength value of the BLE connection request; if the signal strength value is less than a preset threshold, determine that the BLE connection request is sent by a non-Bluetooth master device, and prohibit establishing a Bluetooth connection with the non-Bluetooth master device; if the signal strength value is not less than the preset threshold, determine that the BLE connection request is sent by the Bluetooth master device, and establish a Bluetooth connection with the Bluetooth master device.
[0053] The Bluetooth slave device receives a BLE connection request, where the BLE connection request may be sent by a Bluetooth master device or a non-Bluetooth master device; in order to ensure that a Bluetooth connection is established with the Bluetooth master device and improve the security of the Bluetooth connection, the Bluetooth slave device determines the signal strength value of the BLE connection request, specifically determines the received signal strength indication (RSSI).
[0054] According to the determined signal strength value of the BLE connection request and the preset threshold, determine whether the signal strength value is not less than the preset threshold, wherein the preset threshold is pre-set, and if you want to improve the security of the Bluetooth connection, you can set the preset threshold to be larger, and if you want to improve the success of the Bluetooth connection, you can set the preset threshold to be smaller; if the signal strength value is less than the preset threshold, it is determined that the BLE connection request is sent by a non-Bluetooth master device, and therefore it is prohibited to establish a Bluetooth connection with the Bluetooth master device; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by the Bluetooth master device, and therefore a Bluetooth connection is established between the Bluetooth slave device itself and the Bluetooth master device.
[0055] As a possible implementation, when the electronic device determines that the signal strength value is not less than a preset threshold, it can also perform Bluetooth pairing based on a pre-saved Bluetooth pairing method. If the Bluetooth pairing is successful, it is determined that the BLE connection request is sent by the Bluetooth master device, thereby establishing a Bluetooth connection between the Bluetooth slave device itself and the Bluetooth master device.
[0056] As a possible implementation, the Bluetooth slave device determines the corresponding Bluetooth pairing mode according to the capabilities supported by both the Bluetooth master device and the Bluetooth slave device: whether screen display, key input, and NFC communication are supported. For example, if screen display is supported, the corresponding Bluetooth pairing mode is determined to be digital comparison (Numeric Comparison); if key input is supported, the corresponding Bluetooth pairing mode is determined to be inputting a pairing code (Passkey Entry); if NFC communication is supported, the corresponding Bluetooth pairing mode is determined to be using an out-of-band mechanism (Out of Band, OOB); wherein digital comparison means that both the pairing parties display a 6-digit number, and the user manually checks whether the numbers are consistent. If the numbers are consistent, the Bluetooth pairing is determined to be successful, such as pairing between mobile phones; inputting a pairing code requires the pairing target, i.e., the Bluetooth master device, to input a 6-digit number displayed on the Bluetooth slave device. If the input number is the same as the displayed number, it means that the pairing is successful, such as connecting a Bluetooth keyboard; OOB means that the Bluetooth slave device and the Bluetooth master device exchange pairing information through other means, such as through near field communication (Near The pairing information is exchanged using NFC (Near Field Communication) technology. The Bluetooth device stores 16 bits of static oob information in the flash memory. During the connection process, the Bluetooth master device and the Bluetooth slave device send oob to each other and verify each other, which can also be regarded as a shared key.
[0057] Specifically, the Bluetooth slave device turns on dual slave mode, including authentication slave mode and communication slave mode, where the authentication slave mode is turned on by default and is pre-set to one of the high-security level authentications to prevent man-in-the-middle attacks (MITM). The high-security level authentication can be Numeric Comparison, Passkey Entry, and Out of Band.
[0058] Since in the embodiment of the present invention, the target directional broadcast message is broadcast based on the preset broadcast transmission power, and since the preset broadcast transmission power is low, the Bluetooth master device can only receive the target directional broadcast message at a close distance of the Bluetooth slave device, while the non-Bluetooth master device obtains the target directional broadcast message at a long distance. Therefore, after receiving the Bluetooth low energy BLE connection request, the signal strength value of the BLE connection request is determined. If the signal strength value is less than the preset threshold, it is determined that the BLE connection request is sent by the non-Bluetooth master device, and the establishment of a Bluetooth connection with the non-Bluetooth master device is prohibited; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by the Bluetooth master device, and a Bluetooth connection with the Bluetooth master device is established, thereby ensuring that the Bluetooth slave device only establishes a Bluetooth connection with the Bluetooth master device, thereby ensuring the security of the Bluetooth connection and avoiding information leakage of the Bluetooth slave device.
[0059] Embodiment 2:
[0060] In order to establish a Bluetooth connection, based on the above embodiment, in an embodiment of the present invention, the step of establishing a Bluetooth connection with the Bluetooth master device includes:
[0061] Establishing a BLE connection with the Bluetooth master device;
[0062] If the first host random MAC address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is successfully authenticated, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast;
[0063] Receive a communication connection request sent by the Bluetooth master device, and establish a communication connection with the Bluetooth master device.
[0064] In order to establish a Bluetooth connection, in an embodiment of the present invention, the Bluetooth slave device establishes a BLE connection with the Bluetooth master device, and starts to exchange key information after the BLE connection is successfully established, and determines that the Bluetooth master device has successfully authenticated the Bluetooth slave device after the key information exchange is completed.
[0065] Specifically, when exchanging key information, the Bluetooth slave device receives the first host random MAC address sent by the Bluetooth master device, and sends its own first access address Access Addr and the first negotiation key to the Bluetooth master device; wherein the first host random MAC address is the address of the Bluetooth master device each time it initiates a communication connection and changes randomly.
[0066] After successfully authenticating the Bluetooth master device, the Bluetooth slave device disconnects from the Bluetooth master device, broadcasts a communication broadcast message, receives a communication connection request sent by the Bluetooth master device, and establishes a communication connection with the Bluetooth master device.
[0067] Specifically, in an embodiment of the present invention, after the key information interaction is completed, it is determined that the Bluetooth master device is successfully authenticated. The communication slave mode is not turned on by default. When there is an authenticated Bluetooth master device, the communication slave mode is turned on, and the communication broadcast message is broadcast in the communication slave mode to establish a communication connection with the authenticated Bluetooth master device and realize message sending and receiving. In order to simplify the connection method, the pairing method is set to simple pairing (Just Works).
[0068] In order to establish a Bluetooth connection with a Bluetooth master device, in an embodiment of the present invention, the method further includes:
[0069] If the first host random mac address sent by the Bluetooth master device is not received, and / or the first access address Access Addr and the first negotiation key stored by itself are not sent to the Bluetooth master device, it is determined that the Bluetooth master device has not been authenticated successfully, then the authentication is determined to be completed and the BLE connection with the Bluetooth master device is disconnected.
[0070] If the Bluetooth slave device does not receive the first host random MAC address sent by the Bluetooth master device, or does not send its own first access address Access Addr and the first negotiation key to the Bluetooth master device, or does not receive the first host random MAC address sent by the Bluetooth master device and does not send its own first access address Access Addr and the first negotiation key to the Bluetooth master device, it is determined that the Bluetooth master device has not been authenticated successfully, and therefore determines that the authentication is completed and disconnects the BLE connection with the Bluetooth master device.
[0071] All Bluetooth devices in the prior art, including Bluetooth master devices and maliciously connected attack devices, can randomly connect to Bluetooth slave devices, causing the Bluetooth slave devices to shut down broadcasting and maintain communication within 6 connection intervals, and other Bluetooth devices cannot search for Bluetooth slave devices, and other authenticated Bluetooth master devices cannot connect during the network configuration of new devices. In the embodiment of the present invention, due to the use of a dual slave mode, authentication and communication are independent and do not affect each other, so that during the network configuration of new devices, the normal data interaction of other authenticated Bluetooth master devices is not affected, and they can still search, connect, and send and receive messages.
[0072] Embodiment 3:
[0073] In order to prevent malicious attacks from attacking devices, based on the above embodiments, in an embodiment of the present invention, after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device, the method further includes:
[0074] Obtain the second host MAC address and the second negotiation key carried in the communication connection request;
[0075] Determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key;
[0076] If the above judgment results are all yes, the subsequent step of establishing a communication connection with the Bluetooth master device is executed.
[0077] In order to prevent malicious attacks on attacking devices, after receiving the communication connection request sent by the Bluetooth master device, the Bluetooth slave device obtains the second host MAC address carried in the communication connection request; determines whether the second host MAC address is a random address (random addr); if so, determines whether the second host MAC address is the same as the first host random MAC address based on the second host MAC address and the saved first host random MAC address; if so, verifies whether the second host MAC address is the same as the first access address Access Addr based on the second host MAC address and the saved first access address Access Addr; if so, determines whether the second negotiation key is the same as the first negotiation key based on the second negotiation key carried in the communication connection request and the saved first negotiation key; if so, performs subsequent steps to establish a communication connection with the Bluetooth master device.
[0078] After the data exchange of the communication connection between the Bluetooth slave device and the Bluetooth master device is completed, the Bluetooth master device and the Bluetooth slave device negotiate again the negotiation key, access address and host random MAC address for the next connection, and disconnect after the negotiation is completed.
[0079] In an embodiment of the present invention, the Bluetooth slave device completes the identity authentication of both parties with dynamically changing key information, and performs verification after receiving the communication connection request, thereby preventing the risk of the attack device continuously initiating malicious connections and causing abnormal broadcasting of the Bluetooth slave device, and completes end-to-end security authentication without the need for other third-party devices or tools, saving costs.
[0080] In order to prevent malicious connection of the attack device, in an embodiment of the present invention, the method further includes:
[0081] If the above judgment results are not all yes, then the communication connection request is determined to be an illegal connection, and the communication connection request is not responded to.
[0082] If the second host MAC address is not a random address, and / or if the second host MAC address is different from the first host random MAC address, and / or if the second host MAC address is different from the first access address Access Addr, and / or if the second negotiation key is different from the first negotiation key, the communication connection request is determined to be an illegal connection and the communication connection request is not responded to.
[0083] Embodiment 4:
[0084] Figure 2 A schematic diagram of a Bluetooth connection device provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the device comprises:
[0085] The broadcast module 201 is used to broadcast a target directional broadcast message based on a preset broadcast transmission power;
[0086] The connection module 202 is used to determine the signal strength value of the BLE connection request if a Bluetooth low energy BLE connection request is received. If the signal strength value is less than a preset threshold, it is determined that the BLE connection request is sent by a non-Bluetooth master device, and it is prohibited to establish a Bluetooth connection with the non-Bluetooth master device; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by the Bluetooth master device, and a Bluetooth connection with the Bluetooth master device is established.
[0087] Furthermore, the connection module 202 is specifically used to establish a BLE connection with the Bluetooth master device; if the first host random mac address sent by the Bluetooth master device is received, and the first access address AccessAddr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is authenticated successfully, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast; a communication connection request sent by the Bluetooth master device is received, and a communication connection with the Bluetooth master device is established.
[0088] Furthermore, the connection module 202 is also used to determine that the authentication is completed and disconnect the BLE connection with the Bluetooth master device if the first host random MAC address sent by the Bluetooth master device is not received and / or the first access address Access Addr and the first negotiation key stored in itself are not sent to the Bluetooth master device, and it is determined that the Bluetooth master device has not been authenticated successfully.
[0089] Furthermore, the connection module 202 is also used to obtain the second host mac address and the second negotiation key carried in the communication connection request after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device; determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key; if the above judgment results are all yes, execute the subsequent steps of establishing a communication connection with the Bluetooth master device.
[0090] Furthermore, the connection module 202 is further configured to determine that the communication connection request is an illegal connection and not respond to the communication connection request if the above judgment results are not all yes.
[0091] Embodiment 6:
[0092] Figure 3 A schematic diagram of a Bluetooth connection system provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the Bluetooth connection system includes: a Bluetooth master device 301 and a Bluetooth slave device 302 that executes the steps of the Bluetooth connection method of any of the above embodiments, the Bluetooth master device 301 is used to send a BLE connection request to the Bluetooth slave device 302 after receiving a target directional broadcast message, send a first host random MAC address to the Bluetooth slave device 302 after establishing a BLE connection, and send a communication connection request to the Bluetooth slave device 302 after receiving a communication broadcast message.
[0093] As a possible implementation method, in an embodiment of the present invention, after sending a communication connection request, the Bluetooth master device 301 also determines whether the second host mac address carried in the communication connection request is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key; if the above judgment results are all yes, a communication connection with the Bluetooth slave device 302 is established.
[0094] Figure 4 A schematic diagram of a Bluetooth connection method according to an embodiment of the present invention is shown in FIG. Figure 4 As shown, the Bluetooth slave device turns on the authentication slave mode, sets the broadcast transmission power to 0dbm, broadcasts the target directional broadcast message and waits for connection.
[0095] The Bluetooth master device initiates a BLE connection request, determines the corresponding pairing method based on the capabilities of both devices, establishes a BLE connection, synchronizes key information, and saves key information.
[0096] The Bluetooth slave device determines the rssi of the BLE connection request and determines whether the rssi is not less than the preset threshold. If so, a BLE connection is established and key synchronization information is saved in the communication slave mode, the BLE connection is disconnected and the authentication is determined to be completed. If not, the BLE connection is disconnected and the authentication is determined to be completed.
[0097] The Bluetooth slave device starts the communication slave mode and determines whether there is an authenticated Bluetooth master device. If so, it broadcasts a communication broadcast message and waits for connection. If not, it continues to determine whether there is an authenticated Bluetooth master device.
[0098] The Bluetooth master device initiates a communication connection request, and the Bluetooth master device and the Bluetooth slave device determine whether the second host mac address is a random address based on the second host mac address and the second negotiation key carried in the communication connection request. If so, determine whether the second host mac address is the same as the first host random mac address. If so, check whether the second host mac address is the same as the first access address Access Addr. If so, determine whether the second negotiation key is the same as the first negotiation key. If so, negotiate the negotiation key, access address and host random mac address for the next connection. After the negotiation is completed, disconnect the communication connection, and initiate a communication connection request again to wait for connection; if the above judgment results are not all yes, determine that the communication connection request is an illegal connection, and do not respond to the communication connection request.
[0099] Embodiment 7:
[0100] Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Based on the above embodiments, an embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes: a processor 501 , a communication interface 502 , a memory 503 and a communication bus 504 , wherein the processor 501 , the communication interface 502 , and the memory 503 communicate with each other via the communication bus 504 .
[0101] The memory 503 stores a computer program. When the program is executed by the processor 501, the processor 501 performs the following steps:
[0102] Based on the preset broadcast transmission power, broadcast target directional broadcast message;
[0103] If a Bluetooth low energy (BLE) connection request is received, the signal strength value of the BLE connection request is determined; if the signal strength value is less than a preset threshold, it is determined that the BLE connection request is sent by a non-Bluetooth master device, and establishing a Bluetooth connection with the non-Bluetooth master device is prohibited; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by the Bluetooth master device, and a Bluetooth connection with the Bluetooth master device is established.
[0104] Further, the processor 501 is specifically configured to establish a Bluetooth connection with the Bluetooth master device, including:
[0105] Establishing a BLE connection with the Bluetooth master device;
[0106] If the first host random MAC address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is successfully authenticated, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast;
[0107] Receive a communication connection request sent by the Bluetooth master device, and establish a communication connection with the Bluetooth master device.
[0108] Furthermore, the processor 501 is also used to determine that the authentication is completed and disconnect the BLE connection with the Bluetooth master device if the first host random MAC address sent by the Bluetooth master device is not received, and / or the first access address Access Addr and the first negotiation key stored in itself are not sent to the Bluetooth master device, and it is determined that the Bluetooth master device has not been authenticated successfully.
[0109] Further, the processor 501 is further configured to, after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device, the method further includes:
[0110] Obtain the second host MAC address and the second negotiation key carried in the communication connection request;
[0111] Determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key;
[0112] If the above judgment results are all yes, the subsequent step of establishing a communication connection with the Bluetooth master device is executed.
[0113] Furthermore, the processor 501 is further configured to determine that the communication connection request is an illegal connection and not respond to the communication connection request if the above judgment results are not all yes.
[0114] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0115] The communication interface 502 is used for communication between the electronic device and other devices.
[0116] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0117] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0118] Embodiment 8:
[0119] On the basis of the above embodiments, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program executable by a processor, and when the program runs on the processor, the processor implements the following steps when executing:
[0120] Based on the preset broadcast transmission power, broadcast target directional broadcast message;
[0121] If a Bluetooth low energy (BLE) connection request is received, the signal strength value of the BLE connection request is determined; if the signal strength value is less than a preset threshold, it is determined that the BLE connection request is sent by a non-Bluetooth master device, and establishing a Bluetooth connection with the non-Bluetooth master device is prohibited; if the signal strength value is not less than the preset threshold, it is determined that the BLE connection request is sent by the Bluetooth master device, and a Bluetooth connection with the Bluetooth master device is established.
[0122] Further, establishing a Bluetooth connection with the Bluetooth master device includes:
[0123] Establishing a BLE connection with the Bluetooth master device;
[0124] If the first host random MAC address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is successfully authenticated, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast;
[0125] Receive a communication connection request sent by the Bluetooth master device, and establish a communication connection with the Bluetooth master device.
[0126] Furthermore, the method further comprises:
[0127] If the first host random mac address sent by the Bluetooth master device is not received, and / or the first access address Access Addr and the first negotiation key stored by itself are not sent to the Bluetooth master device, it is determined that the Bluetooth master device has not been authenticated successfully, then the authentication is determined to be completed and the BLE connection with the Bluetooth master device is disconnected.
[0128] Further, after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device, the method further includes:
[0129] Obtain the second host MAC address and the second negotiation key carried in the communication connection request;
[0130] Determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key;
[0131] If the above judgment results are all yes, the subsequent step of establishing a communication connection with the Bluetooth master device is executed.
[0132] Furthermore, the method further comprises:
[0133] If the above judgment results are not all yes, then the communication connection request is determined to be an illegal connection, and the communication connection request is not responded to.
[0134] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0135] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0136] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0138] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A Bluetooth connection method, characterized in that: Applied to a Bluetooth slave device, the method comprises: Based on the preset broadcast transmission power, broadcast target directional broadcast message; If a Bluetooth low energy BLE connection request is received, determine the signal strength value of the BLE connection request; if the signal strength value is less than a preset threshold, determine that the BLE connection request is sent by a non-Bluetooth master device, and prohibit establishing a Bluetooth connection with the non-Bluetooth master device; if the signal strength value is not less than the preset threshold, determine that the BLE connection request is sent by the Bluetooth master device, and establish a Bluetooth connection with the Bluetooth master device; The establishing of a Bluetooth connection with the Bluetooth master device comprises: Establishing a BLE connection with the Bluetooth master device; If the first host random MAC address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is successfully authenticated, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast; Receive a communication connection request sent by the Bluetooth master device, and establish a communication connection with the Bluetooth master device.
2. The method according to claim 1, characterized in that The method further comprises: If the first host random mac address sent by the Bluetooth master device is not received, and / or the first access address Access Addr and the first negotiation key stored by itself are not sent to the Bluetooth master device, it is determined that the Bluetooth master device has not been authenticated successfully, then the authentication is determined to be completed and the BLE connection with the Bluetooth master device is disconnected.
3. The method according to claim 1, characterized in that After receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device, the method further includes: Obtain the second host MAC address and the second negotiation key carried in the communication connection request; Determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key; If the above judgment results are all yes, the subsequent step of establishing a communication connection with the Bluetooth master device is executed.
4. The method according to claim 3, characterized in that The method further comprises: If the above judgment results are not all yes, then the communication connection request is determined to be an illegal connection, and the communication connection request is not responded to.
5. A Bluetooth connection device, characterized in that: The device comprises: A broadcast module, used to broadcast a target directional broadcast message based on a preset broadcast transmission power; A connection module, configured to, if a Bluetooth low energy BLE connection request is received, determine a signal strength value of the BLE connection request; if the signal strength value is less than a preset threshold, determine that the BLE connection request is sent by a non-Bluetooth master device, and prohibit establishing a Bluetooth connection with the non-Bluetooth master device; if the signal strength value is not less than the preset threshold, determine that the BLE connection request is sent by the Bluetooth master device, and establish a Bluetooth connection with the Bluetooth master device; The connection module is specifically used to establish a BLE connection with the Bluetooth master device; if the first host random mac address sent by the Bluetooth master device is received, and the first access address Access Addr and the first negotiation key saved by itself are sent to the Bluetooth master device, it is determined that the Bluetooth master device is successfully authenticated, the BLE connection with the Bluetooth master device is disconnected, and a communication broadcast message is broadcast; a communication connection request sent by the Bluetooth master device is received, and a communication connection with the Bluetooth master device is established.
6. The device according to claim 5, characterized in that The connection module is also used to determine that the authentication is completed and disconnect the BLE connection with the Bluetooth master device if the first host random MAC address sent by the Bluetooth master device is not received and / or the first access address Access Addr and the first negotiation key stored in itself are not sent to the Bluetooth master device, and it is determined that the Bluetooth master device has not been authenticated successfully.
7. The device according to claim 5, characterized in that The connection module is further used to obtain the second host mac address and the second negotiation key carried in the communication connection request after receiving the communication connection request sent by the Bluetooth master device and before establishing the communication connection with the Bluetooth master device; determine whether the second host mac address is a random address, whether the second host mac address is the same as the first host random mac address, whether the second host mac address is the same as the first access address Access Addr, and whether the second negotiation key is the same as the first negotiation key; if the above judgment results are all yes, execute the subsequent steps of establishing a communication connection with the Bluetooth master device.
8. The device according to claim 7, characterized in that The connection module is further configured to determine that the communication connection request is an illegal connection and not respond to the communication connection request if the above judgment results are not all yes.
9. A Bluetooth connection system, characterized in that: The system comprises: a Bluetooth master device and a Bluetooth slave device executing any Bluetooth connection method described in claims 1-4.
10. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; A computer program is stored in the memory, and when the program is executed by the processor, the processor executes the steps of the Bluetooth connection method according to any one of claims 1 to 4.
11. A computer-readable storage medium, characterized in that: It stores a computer program executable by a processor, and when the program runs on the processor, the processor executes the steps of the Bluetooth connection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and device for binding Bluetooth devices
CN104967966A
Low-power-consumption-bluetooth-based data transmission method and system, and master and slave devices
CN106878926A
Bluetooth pairing method and system
CN108738008A
System and method for peripheral initiated host arbitration
US20170244715A1
Bluetooth connection method and terminal
WO2018000134A1
