Bluetooth device pairing method and device
By obtaining the MAC address and key of the Bluetooth device after logging into the server at the terminal, and using low-power Bluetooth broadcast data for pairing, it solves the problem of cumbersome pressing and pressing the key for users, and improves the experience of Bluetooth devices.
Patent Information
- Application Number
- CN202110523339.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-13
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-05-13
AI Technical Summary
During the pairing of existing Bluetooth devices, users need to hold down the buttons for a long time and operate in a cumbersome manner, resulting in poor user experience.
After logging into the server at the terminal, obtaining the MAC address and key of the Bluetooth device, and using low-power Bluetooth broadcast data for pairing, eliminating the long press and pressing of the key.
Improve user experience and simplify the pairing process of Bluetooth devices.
Smart Images

Figure CN115426638B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer communication technologies, and in particular, to a method and apparatus for pairing Bluetooth devices. Background Art
[0002] Bluetooth devices apply Bluetooth technology and are free from the bondage of wires, so they are favored by more and more users.
[0003] Some Bluetooth devices are provided with buttons. The user makes the Bluetooth device enter the pairing mode by long-pressing the button. After the second terminal searches for the Bluetooth device, it displays the device information of the searched Bluetooth device. After receiving the confirmation information of the device information from the user, it pairs with the Bluetooth device having the device information. After the pairing is successful, a Bluetooth connection is established between the second terminal and the Bluetooth device.
[0004] When establishing a Bluetooth connection between the Bluetooth device and the second terminal next time, the user needs to long-press the button on the Bluetooth device again to make the Bluetooth device enter the pairing mode, resulting in cumbersome user operations and poor user experience. Summary of the Invention
[0005] To overcome the problems in the related art, the present disclosure provides a method and apparatus for pairing Bluetooth devices.
[0006] According to the first aspect of the embodiments of the present disclosure, a method for pairing Bluetooth devices is provided, which is applied to a first terminal. The method includes:
[0007] After logging in to the server using an account, obtaining connection information corresponding to the account in the server, where the connection information includes the MAC address and the key of the Bluetooth device;
[0008] Obtaining broadcast data sent by a Bluetooth device located around the first terminal;
[0009] In response to the broadcast data including the key, pairing the first terminal and the Bluetooth device according to the MAC address and the key.
[0010] Optionally, the pairing of the first terminal and the Bluetooth device according to the MAC address and the key of the Bluetooth device includes:
[0011] Receiving the encrypted actual MAC address of the Bluetooth device sent by the Bluetooth device;
[0012] Using the key to decrypt the encrypted actual MAC address to obtain the actual MAC address;
[0013] Determine whether the actual MAC address is the same as the MAC address. If they are the same, start pairing the first terminal and the Bluetooth device. If they are different, do not pair the first terminal and the Bluetooth device.
[0014] Optionally, the method further includes:
[0015] In response to the broadcast data including the key, output a confirmation notice of the Bluetooth device;
[0016] Receive the confirmation information of the Bluetooth device, and start to perform the operation of pairing the first terminal and the Bluetooth device according to the MAC address and the key.
[0017] According to the second aspect of the embodiments of the present disclosure, a Bluetooth device pairing method is provided, which is applied to a second terminal. The method includes:
[0018] After logging in to the server using an account, pair the second terminal and the Bluetooth device;
[0019] In response to successful pairing, generate a key;
[0020] Send the key to the Bluetooth device;
[0021] Send the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
[0022] Optionally, the step of pairing the second terminal and the Bluetooth device after logging in to the server using an account includes:
[0023] After logging in to the server using the account, receive a first notice sent by the Bluetooth device. The first notice is a notice sent by the Bluetooth device after determining that the second terminal passes the verification according to the terminal public key of the second terminal and the private key of the Bluetooth device. The first notice includes the MAC address of the Bluetooth device;
[0024] Verify the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device;
[0025] In response to the Bluetooth device passing the verification, send a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device. The Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code;
[0026] Receive a second notice sent by the Bluetooth device. The second notice is a notice sent by the Bluetooth device after determining that the second terminal passes the verification according to the second verification code;
[0027] Verify the Bluetooth device according to the first verification code, and in response to the Bluetooth device passing the verification, determine that the second terminal is successfully paired with the Bluetooth device.
[0028] Optionally, the method further includes:
[0029] Obtain the public key of the Bluetooth device.
[0030] Generate a first key according to the private key of the second terminal and the public key of the Bluetooth device.
[0031] Encrypt the pairing request data using the first key.
[0032] Send the encrypted pairing request data and the public key of the second terminal to the Bluetooth device, so that the Bluetooth device generates a second key according to the public key of the terminal and the private key of the Bluetooth device, decrypts the encrypted pairing request data using the second key, and in response to successfully decrypting the encrypted pairing request data, encrypts the pairing request response data using the second key, generates a first notification including the encrypted pairing request response data, where the encrypted pairing request response data includes the MAC address of the Bluetooth device, and sends the first notification to the second terminal.
[0033] Optionally, the verifying the Bluetooth device according to the private key of the second terminal and the public key of the Bluetooth device of the Bluetooth device includes:
[0034] Decrypt the encrypted pairing request response data in the first notification using the first key.
[0035] In response to successfully decrypting the encrypted pairing request response data, determine that the Bluetooth device passes the verification.
[0036] In response to failing to decrypt the encrypted pairing request response data, determine that the Bluetooth device fails to pass the verification.
[0037] Optionally, the method further includes:
[0038] Encrypt the first verification code using the first key.
[0039] Send the encrypted first verification code to the Bluetooth device, so that the Bluetooth device decrypts the encrypted first verification code using the second key, determines whether the decryption result of the encrypted first verification code is the same as the second verification code, and if so, encrypts the second verification code using the second key to obtain an encrypted second verification code, and sends the second notification including the encrypted second verification code to the second terminal.
[0040] Optionally, verifying the Bluetooth device according to the first verification code includes:
[0041] Decrypting the encrypted second verification code in the second notification using the first key;
[0042] Determining whether the decryption result of the encrypted second verification code is consistent with the first verification code;
[0043] If they are consistent, determining that the Bluetooth device passes the verification;
[0044] If they are inconsistent, determining that the Bluetooth device fails the verification.
[0045] Optionally, obtaining the public key of the Bluetooth device of the Bluetooth device includes:
[0046] Receiving the device information of the Bluetooth device sent by the Bluetooth device;
[0047] Obtaining the public key of the Bluetooth device corresponding to the device information in the server.
[0048] Optionally, the method further includes:
[0049] In response to meeting the conditions of the combined information, sending an instruction to the server to delete the combined information, so that the server deletes the combined information stored internally according to the instruction.
[0050] According to a third aspect of the embodiments of the present disclosure, a Bluetooth device pairing method is provided, which is applied to a Bluetooth device. The method includes:
[0051] After receiving the public key of the terminal sent by the second terminal, verifying the second terminal according to the private key of the Bluetooth device of the Bluetooth device and the public key of the terminal;
[0052] In response to the second terminal passing the verification, sending a first notification to the second terminal, where the first notification includes the MAC address of the Bluetooth device, so that after the second terminal device determines that the Bluetooth device passes the verification according to the private key of the second terminal and the public key of the Bluetooth device of the Bluetooth device, according to the MAC address included in the first notification, sending a Bluetooth pairing request to the Bluetooth device, and the Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code;
[0053] Verifying the second terminal according to the second verification code;
[0054] In response to the successful verification of the second terminal, send a second notification to the second terminal, where the second notification is used to trigger the second terminal to verify the Bluetooth device according to the first verification code. In response to the successful verification of the Bluetooth device, determine that the second terminal is successfully paired with the Bluetooth device.
[0055] Optionally, the method further includes:
[0056] Receive the terminal public key and the encrypted pairing request data sent by the second terminal, where the encrypted pairing request data is data obtained by the second terminal generating a first key according to the terminal private key and the Bluetooth device public key and encrypting the pairing request data using the first key;
[0057] The verification of the second terminal according to the Bluetooth device private key and the terminal public key of the Bluetooth device includes:
[0058] Generate a second key according to the Bluetooth device private key and the terminal public key;
[0059] Decrypt the encrypted pairing request data using the second key;
[0060] In response to the successful decryption of the encrypted pairing request data, determine that the second terminal passes the verification;
[0061] In response to the failure of decrypting the encrypted pairing request data, determine that the second terminal fails to pass the verification.
[0062] Optionally, the method further includes:
[0063] Receive the encrypted first verification code sent by the second terminal, where the encrypted first verification code is data obtained by the second terminal encrypting the first verification code using the first key;
[0064] The verification of the second terminal according to the second verification code includes:
[0065] Decrypt the encrypted first verification code using the second key;
[0066] Determine whether the decryption result is consistent with the second verification code;
[0067] If they are consistent, determine that the second terminal passes the verification;
[0068] If they are not consistent, determine that the second terminal fails to pass the verification.
[0069] Optionally, the method further includes:
[0070] Receive the encrypted key sent by the second terminal, where the encrypted key is obtained by the second terminal encrypting the key using a first key after determining that the pairing between the second terminal and the Bluetooth device is successful;
[0071] Use the second key to decrypt the encrypted key to obtain the key;
[0072] Store the key.
[0073] According to a fourth aspect of the embodiments of the present disclosure, there is provided a Bluetooth device pairing apparatus applied to a first terminal. The apparatus includes:
[0074] A connection information acquisition module, configured to acquire connection information corresponding to the account in the server after logging in to the server using the account, where the connection information includes the MAC address and key of the Bluetooth device;
[0075] A broadcast data acquisition module, configured to acquire broadcast data sent by Bluetooth devices located around the first terminal;
[0076] A device pairing module, configured to, in response to the broadcast data including the key, pair the first terminal and the Bluetooth device according to the MAC address and the key.
[0077] Optionally, the device pairing module includes:
[0078] An actual MAC address receiving sub-module, configured to receive the encrypted actual MAC address of the Bluetooth device sent by the Bluetooth device;
[0079] An address decryption sub-module, configured to use the key to decrypt the encrypted actual MAC address to obtain the actual MAC address;
[0080] An address determination sub-module, configured to determine whether the actual MAC address is the same as the MAC address. If they are the same, start pairing the first terminal and the Bluetooth device. If they are not the same, do not pair the first terminal and the Bluetooth device.
[0081] Optionally, the apparatus further includes:
[0082] A notification output module, configured to output a confirmation notification of the Bluetooth device in response to the broadcast data including the key;
[0083] A confirmation information receiving module, configured to receive confirmation information about the Bluetooth device and start performing the operation of pairing the first terminal and the Bluetooth device according to the MAC address and the key.
[0084] According to a fifth aspect of the embodiments of the present disclosure, a Bluetooth device pairing apparatus is provided, which is applied to a second terminal. The apparatus includes:
[0085] A terminal pairing module, configured to pair the second terminal and a Bluetooth device after logging in to a server using an account;
[0086] A key generation module, configured to generate a key in response to successful pairing;
[0087] A key sending module, configured to send the key to the Bluetooth device;
[0088] A combined information sending module, configured to send the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
[0089] Optionally, the terminal pairing module includes:
[0090] A first notification receiving sub-module, configured to receive a first notification sent by the Bluetooth device after logging in to the server using the account. The first notification is a notification sent by the Bluetooth device after determining that the second terminal passes verification according to the terminal public key of the second terminal and the private key of the Bluetooth device, and the first notification includes the MAC address of the Bluetooth device;
[0091] A first Bluetooth device verification sub-module, configured to verify the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device;
[0092] A Bluetooth pairing request sending sub-module, configured to send a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device in response to the Bluetooth device passing verification. The Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code;
[0093] A second notification receiving sub-module, configured to receive a second notification sent by the Bluetooth device. The second notification is a notification sent by the Bluetooth device after determining that the second terminal passes verification according to the second verification code;
[0094] A second Bluetooth device verification sub-module, configured to verify the Bluetooth device according to the first verification code, and determine that the second terminal is successfully paired with the Bluetooth device in response to the Bluetooth device passing verification.
[0095] Optionally, the apparatus further includes:
[0096] A public key acquisition module, configured to acquire the Bluetooth device public key of the Bluetooth device;
[0097] The first key generation module is configured to generate a first key according to the terminal private key of the second terminal and the public key of the Bluetooth device;
[0098] The pairing request data encryption module is configured to encrypt the pairing request data using the first key;
[0099] The data sending module is configured to send the encrypted pairing request data and the terminal public key of the second terminal to the Bluetooth device, so that the Bluetooth device generates a second key according to the terminal public key and the Bluetooth device private key, decrypts the encrypted pairing request data using the second key, and in response to successfully decrypting the encrypted pairing request data, encrypts the pairing request response data using the second key to generate a first notification including the encrypted pairing request response data, where the encrypted pairing request response data includes the MAC address of the Bluetooth device, and sends the first notification to the second terminal.
[0100] Optionally, the first Bluetooth device verification sub-module includes:
[0101] The pairing request response data decryption unit is configured to decrypt the encrypted pairing request response data in the first notification using the first key;
[0102] The first verification passed unit is configured to determine that the Bluetooth device passes the verification in response to successfully decrypting the encrypted pairing request response data;
[0103] The first verification failed unit is configured to determine that the Bluetooth device fails the verification in response to failing to decrypt the encrypted pairing request response data.
[0104] Optionally, the device further includes:
[0105] The first verification code encryption module is configured to encrypt the first verification code using the first key;
[0106] The encrypted data sending module is configured to send the encrypted first verification code to the Bluetooth device, so that the Bluetooth device decrypts the encrypted first verification code using the second key, determines whether the decryption result of the encrypted first verification code is consistent with the second verification code, and if so, encrypts the second verification code using the second key to obtain an encrypted second verification code, and sends the second notification including the encrypted second verification code to the second terminal.
[0107] Optionally, the second Bluetooth device verification sub-module includes:
[0108] A second verification code decryption unit, configured to decrypt the encrypted second verification code in the second notification using the first key;
[0109] A decryption result determination unit, configured to determine whether the decryption result of the encrypted second verification code is consistent with the first verification code;
[0110] A second verification passed unit, configured to determine that the Bluetooth device passes the verification if they are consistent;
[0111] A second verification failed unit, configured to determine that the Bluetooth device fails the verification if they are inconsistent.
[0112] Optionally, the public key acquisition module includes:
[0113] A device information receiving sub-module, configured to receive the device information of the Bluetooth device sent by the Bluetooth device;
[0114] A Bluetooth device public key acquisition sub-module, configured to acquire the Bluetooth device public key corresponding to the device information in the server.
[0115] Optionally, the device further includes:
[0116] An instruction sending module, configured to send an instruction for deleting the combined information to the server in response to meeting the condition of the combined information, so that the server deletes the combined information stored internally according to the instruction.
[0117] According to a sixth aspect of the embodiments of the present disclosure, there is provided a Bluetooth device pairing device, applied to a Bluetooth device, the device includes:
[0118] A second terminal verification module, configured to verify the second terminal according to the Bluetooth device private key of the Bluetooth device and the terminal public key after receiving the terminal public key sent by the second terminal;
[0119] A first notification sending module, configured to send a first notification to the second terminal in response to the second terminal passing the verification, the first notification includes the MAC address of the Bluetooth device, so that after the second terminal device determines that the Bluetooth device passes the verification according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device, it sends a Bluetooth pairing request to the Bluetooth device according to the MAC address included in the first notification, and the Bluetooth pairing request triggers the second terminal to generate a first verification code, and the Bluetooth device to generate a second verification code;
[0120] A terminal verification module, configured to verify the second terminal according to the second verification code;
[0121] A second notification sending module, configured to send a second notification to the second terminal in response to the successful verification of the second terminal, where the second notification is used to trigger the second terminal to verify the Bluetooth device according to the first verification code, and in response to the successful verification of the Bluetooth device, determine that the second terminal is successfully paired with the Bluetooth device.
[0122] Optionally, the device further includes:
[0123] A request data receiving module, configured to receive the terminal public key and the encrypted pairing request data sent by the second terminal, where the encrypted pairing request data is data obtained by the second terminal generating a first key according to the terminal private key and the Bluetooth device public key and encrypting the pairing request data using the first key;
[0124] The second terminal verification module includes:
[0125] A second key generation sub-module, configured to generate a second key according to the Bluetooth device private key and the terminal public key;
[0126] A request data decryption sub-module, configured to decrypt the encrypted pairing request data using the second key;
[0127] A first verification passed sub-module, configured to determine that the second terminal passes verification in response to the successful decryption of the encrypted pairing request data;
[0128] A first verification failed sub-module, configured to determine that the second terminal fails verification in response to the failure of decrypting the encrypted pairing request data.
[0129] Optionally, the device further includes:
[0130] A verification code receiving module, configured to receive the encrypted first verification code sent by the second terminal, where the encrypted first verification code is obtained by the second terminal encrypting the first verification code using the first key;
[0131] The terminal verification module includes:
[0132] A verification code decryption sub-module, configured to decrypt the encrypted first verification code using the second key;
[0133] A decryption result judgment sub-module, configured to determine whether the decryption result is consistent with the second verification code;
[0134] A second verification passed sub-module, configured to determine that the second terminal passes verification if they are consistent;
[0135] The second verification failure sub-module is configured to determine that the second terminal fails the verification if they are inconsistent.
[0136] Optionally, the device further includes:
[0137] An encrypted key receiving module, configured to receive the encrypted key sent by the second terminal, where the encrypted key is obtained by encrypting the key with a first key after the second terminal determines that the second terminal is successfully paired with the Bluetooth device;
[0138] An encrypted key decryption module, configured to decrypt the encrypted key with the second key to obtain the key;
[0139] A key storage module, configured to store the key.
[0140] According to a seventh aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any one of the above first aspects, and / or, the method described in any one of the above second aspects is implemented.
[0141] According to an eighth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any one of the above third aspects is implemented.
[0142] According to a ninth aspect of the embodiments of the present disclosure, there is provided a terminal, including:
[0143] A processor;
[0144] A memory for storing processor-executable instructions;
[0145] Wherein, the processor is configured to execute the instructions to implement the method described in any one of the above first aspects, and / or, the method described in any one of the above second aspects.
[0146] According to a tenth aspect of the embodiments of the present disclosure, there is provided a Bluetooth device, including:
[0147] A processor;
[0148] A memory for storing processor-executable instructions;
[0149] Wherein, the processor is configured to execute the instructions to implement the method described in any one of the above third aspects.
[0150] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
[0151] In the embodiments of the present disclosure, after logging in to the server using an account, connection information corresponding to the account in the server is obtained. The connection information includes the MAC address and the key of the Bluetooth device. Broadcast data sent by the Bluetooth device located around the second terminal is obtained. In response to the broadcast data including the key obtained from the server, the first terminal and the Bluetooth device are paired according to the MAC address and the key obtained from the server. By adopting the above method, it is possible to control the Bluetooth device to enter the pairable mode, eliminating the operation of the user long-pressing the button on the Bluetooth device to make the Bluetooth device enter the pairable mode, and improving the user experience.
[0152] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0153] Figure 1 is a flowchart of a method for pairing a Bluetooth device shown according to an exemplary embodiment;
[0154] Figure 2 is a flowchart of another method for pairing a Bluetooth device shown according to an exemplary embodiment;
[0155] Figure 3 is a flowchart of another method for pairing a Bluetooth device shown according to an exemplary embodiment;
[0156] Figure 4 is a schematic diagram of a UI menu shown according to an exemplary embodiment;
[0157] Figure 5 is a block diagram of a device for pairing a Bluetooth device shown according to an exemplary embodiment;
[0158] Figure 6 is a block diagram of another device for pairing a Bluetooth device shown according to an exemplary embodiment;
[0159] Figure 7 is a block diagram of a device for pairing a Bluetooth device shown according to an exemplary embodiment;
[0160] Figure 8 is a schematic diagram of the structure of a terminal shown according to an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0161] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0162] The terms used in this disclosure are for the purpose of describing particular embodiments only and are not intended to limit the disclosure. The singular forms "a", "the", and "said" used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0163] It should be understood that although the terms first, second, third, etc. may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".
[0164] Figure 1 is a flowchart of a method for pairing a Bluetooth device shown according to an exemplary embodiment. Figure 1 The method shown is applied to a first terminal, and the first terminal may be a mobile phone, a tablet, a notebook, a wearable device, etc. Figure 1 The method shown includes:
[0165] In step 101, after logging in to the server using an account, connection information corresponding to the account in the server is obtained. The connection information includes the MAC address and the key of the Bluetooth device.
[0166] The first terminal logs in to the server using an account. After the first terminal successfully pairs with the Bluetooth device and establishes a Bluetooth connection, it will obtain the account, the MAC address (Media Access Control Address) of the Bluetooth device, and the key. The key is used to encrypt and decrypt communication data when the first terminal using the account and the Bluetooth device communicate via Bluetooth.
[0167] The first terminal uploads the combined information of the account, the MAC address of the Bluetooth device, and the key to the server, so that when the account is used again, the first terminal using the account can obtain the MAC address and the key of the Bluetooth device corresponding to the account from the server.
[0168] The Bluetooth device supports traditional Bluetooth technology and low-power Bluetooth technology. The Bluetooth device may be a Bluetooth headset, etc.
[0169] In step 102, broadcast data sent by Bluetooth devices located around the first terminal is obtained.
[0170] Bluetooth Low Energy (BLE) features low power consumption. Before a Bluetooth device establishes a Bluetooth connection with a first terminal, it can send broadcast data via Bluetooth Low Energy, and the broadcast data can include a small amount of data information.
[0171] In step 103, in response to the broadcast data including the key obtained from the server, pair the first terminal and the Bluetooth device according to the MAC address of the Bluetooth device and the key.
[0172] For a Bluetooth device that has established a Bluetooth connection with the first terminal using an account in the past, the key (i.e., the key obtained from the server) is stored in the Bluetooth device. After such a Bluetooth device is powered on, it can send broadcast data via Bluetooth Low Energy, and the broadcast data includes the key. The keys stored in the Bluetooth device can be presented in a list form.
[0173] After the first terminal obtains the broadcast data sent by the surrounding Bluetooth devices, determine whether the broadcast data includes the key. After determining that the broadcast data includes the key obtained from the server, determine whether to pair the first terminal and the Bluetooth device according to the MAC address of the Bluetooth device and the key obtained from the server. If so, pair the first terminal and the Bluetooth device; if not, do not pair the first terminal and the Bluetooth device.
[0174] In some embodiments, the first terminal pairs the first terminal and the Bluetooth device according to the MAC address of the Bluetooth device and the key, which can be achieved in the following way:
[0175] Step a1: Receive the encrypted actual MAC address of the Bluetooth device sent by the Bluetooth device.
[0176] Step a2: Use the key to decrypt the encrypted actual MAC address to obtain the actual MAC address.
[0177] Step a3: Determine whether the actual MAC address obtained in step a2 is consistent with the MAC address obtained from the server. If it is consistent, start pairing the first terminal and the Bluetooth device; if it is not consistent, do not pair the first terminal and the Bluetooth device.
[0178] In some embodiments, based on steps a1 - a3, when the first terminal pairs the first terminal and the Bluetooth device according to the MAC address of the Bluetooth device and the key, it may further include:
[0179] Step a4: Obtain the Bluetooth Low Energy address of the Bluetooth device.
[0180] The Bluetooth device can broadcast the Bluetooth Low Energy address via Bluetooth Low Energy, and the first terminal can obtain the Bluetooth Low Energy address of the Bluetooth device via Bluetooth Low Energy.
[0181] Step a5: Encrypt the Bluetooth Low Energy address using a key.
[0182] Step a6: Send the encrypted Bluetooth Low Energy address to the Bluetooth device.
[0183] The Bluetooth device decrypts the encrypted Bluetooth Low Energy address using an internal key. After determining that the decrypted Bluetooth Low Energy address is the same as the actual Bluetooth Low Energy address of the Bluetooth device, it encrypts the actual MAC address of the Bluetooth device using the key and sends the encrypted actual MAC address to the first terminal.
[0184] In some embodiments, the operation of pairing the first terminal and the Bluetooth device can be implemented in the following manner:
[0185] Step b1: Send a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device. The Bluetooth pairing request triggers the first terminal to generate verification code 1 and the Bluetooth device to generate verification code 2.
[0186] Step b2: Receive the second notification sent by the Bluetooth device. The second notification is sent by the Bluetooth device after determining that the second terminal has passed the verification according to verification code 2.
[0187] Step b3: Verify the Bluetooth device according to verification code 1. In response to the Bluetooth device passing the verification, it is determined that the first terminal and the Bluetooth device are successfully paired.
[0188] The second terminal generates password 1 according to the terminal private key of the second terminal and the public key of the Bluetooth device, encrypts verification code 1 using password 1, and sends the encrypted verification code 1 to the Bluetooth device.
[0189] The Bluetooth device locally stores a key list, which includes at least one key data. When performing this step, the second terminal does not send the terminal public key of the second terminal to the Bluetooth device. Therefore, the Bluetooth device decrypts the encrypted verification code 1 according to the key in the key list. If the decryption is successful, verification code 1 is obtained, and it is determined whether verification code 1 and verification code 2 are the same. If they are the same, it is determined that the second terminal has passed the verification.
[0190] The Bluetooth device generates password 2 according to the private key of the Bluetooth device and the public key of the second terminal, encrypts verification code 2 using password 2, and sends the encrypted verification code 2 to the second terminal. The second terminal decrypts the encrypted verification code 2 using password 1 to obtain verification code 2, and determines whether verification code 2 and verification code 1 are the same. If they are the same, it is determined that the Bluetooth device has passed the verification.
[0191] In some embodiments, in response to the broadcast data including the key, an acknowledgment notification of the Bluetooth device is output, and after receiving the acknowledgment information of the Bluetooth device, an operation of sending a request to the Bluetooth device according to the MAC address and the key of the Bluetooth device is started.
[0192] For example, in response to the broadcast data including the key, a window pops up, and the window displays "These are the headphones you have connected to on other devices". The window displays an OK option and a Cancel option. If the user's selection operation on the OK option is received, then an operation of pairing the first terminal and the Bluetooth device according to the MAC address and the key of the Bluetooth device is started.
[0193] In this embodiment, a user confirmation step is added, and the user can choose whether to allow the second terminal to establish a Bluetooth connection with the Bluetooth device selected by the second terminal according to their own will, improving the user experience.
[0194] In the embodiments of the present disclosure, after logging in to the server using an account, connection information corresponding to the account in the server is obtained. The information includes the MAC address and the key of the Bluetooth device. Broadcast data sent by the Bluetooth device located around the second terminal via low-power Bluetooth is obtained. In response to the broadcast data including the key obtained from the server, the first terminal and the Bluetooth device are paired according to the MAC address and the key of the Bluetooth device. By adopting the above method, it is possible to control the Bluetooth device to enter the pairable mode, eliminating the operation of the user long-pressing the button on the Bluetooth device to make the Bluetooth device enter the pairable mode, and improving the user experience.
[0195] Figure 2 It is a flowchart of another Bluetooth device pairing method shown according to an exemplary embodiment. Figure 2 The method shown is applied to the second terminal, and the second terminal can be a mobile phone, a tablet, a laptop, a wearable device, etc. Figure 2 The method shown includes:
[0196] In step 201, after logging in to the server using an account, the second terminal and the Bluetooth device are paired.
[0197] In some embodiments, the operation of pairing the second terminal and the Bluetooth device can be implemented in the following manner:
[0198] The first step, after logging in to the server using the account, a first notification sent by the Bluetooth device is received. The first notification is a notification sent by the Bluetooth device after determining that the second terminal has passed the verification according to the second terminal public key generated by the second terminal and the Bluetooth device private key of the Bluetooth device. The first notification includes the MAC address of the Bluetooth device, and the Bluetooth device is verified according to the second terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device.
[0199] In the second step, in response to successful verification of the Bluetooth device, a Bluetooth pairing request is sent to the Bluetooth device according to the MAC address of the Bluetooth device. The Bluetooth pairing request triggers the second terminal (which can be the second terminal protocol stack) to generate a first verification code, and the Bluetooth device (which can be the Bluetooth device protocol stack) to generate a second verification code.
[0200] In the third step, receive the second notification sent by the Bluetooth device. The second notification is a notification sent by the Bluetooth device after determining that the second terminal has passed the verification according to the second verification code.
[0201] In the fourth step, verify the Bluetooth device according to the first verification code. In response to the Bluetooth device passing the verification, it is determined that the second terminal and the Bluetooth device are successfully paired.
[0202] In response to the Bluetooth device failing to pass the verification, it is determined that the pairing between the second terminal and the Bluetooth device fails.
[0203] In this embodiment, the second terminal and the Bluetooth device can send data via low energy Bluetooth.
[0204] In this embodiment, the second terminal and the Bluetooth device perform pairing by using the terminal public key of the second terminal, the terminal private key of the second terminal, the Bluetooth device public key, the Bluetooth device private key, the first verification code, and the second verification code.
[0205] The Bluetooth device public key and the Bluetooth device private key can be fixed, and the second terminal public key and the second terminal private key can be temporarily generated by the second terminal.
[0206] In step 202, in response to successful pairing, a key is generated.
[0207] The generated key can be referred to as the Account Key.
[0208] For example, the second terminal generates a new terminal public key and a terminal private key, calculates the new terminal public key and the terminal private key, and determines the calculation result as the key Account Key. Another example is that the second terminal randomly generates the key Account Key. This embodiment does not limit the method of generating the key Account Key.
[0209] In step 203, send the key to the Bluetooth device.
[0210] In step 204, send the combined information of the account, the MAC address of the Bluetooth device, and the key to the server.
[0211] In some embodiments, after receiving the first notification, the second terminal sends a first switching instruction to the Bluetooth device. The first switching instruction is used to instruct the Bluetooth device to perform an input / output capability switch, so that the Bluetooth device has the permission to obtain the second verification code and send the second notification;
[0212] After determining successful pairing with the Bluetooth device, the second terminal sends a second switching instruction to the Bluetooth device, and the second switching instruction is used to instruct the Bluetooth device to switch back to the originally used input / output capabilities.
[0213] For example, the originally used input / output capabilities (IO Capabilities) of the Bluetooth device is NoInput / NoOutput. After receiving the first notification, the second terminal sends a first switching instruction to the Bluetooth device via Bluetooth Low Energy, causing the Bluetooth device to switch the IO Capabilities to Display / YesNo. After determining successful pairing with the Bluetooth device, the second terminal sends a second switching instruction to the Bluetooth device, causing the Bluetooth device to switch the IO Capabilities back to the originally used NoInput / NoOutput.
[0214] After receiving the first notification, the second terminal can send a first switching instruction to the Bluetooth device via Bluetooth Low Energy,
[0215] In some embodiments, the second terminal can also perform the following operations:
[0216] Step c1: Obtain the public key of the Bluetooth device.
[0217] For example, the server stores the correspondence between the device information of the Bluetooth device, the public key of the Bluetooth device, and the private key of the Bluetooth device.
[0218] The second terminal receives the device information of the Bluetooth device sent by the Bluetooth device and obtains the public key of the Bluetooth device corresponding to the device information in the server.
[0219] The second terminal receives the device information of the Bluetooth device sent by the Bluetooth device via Bluetooth Low Energy.
[0220] The device information of the Bluetooth device can be the identifier of the Bluetooth device, such as the device model, unique code, etc. of the Bluetooth device.
[0221] After turning on the Bluetooth, the second terminal can scan for the Bluetooth Low Energy service, obtain the device model broadcast by the Bluetooth device via Bluetooth Low Energy. After determining that the Bluetooth device is a specified device according to the device model of the Bluetooth device, such as determining that the Bluetooth device is a device produced by a specified manufacturer, a corresponding notification is popped up. After receiving the confirmation information from the user, a temporary terminal private key and a terminal public key are generated, the public key of the Bluetooth device is obtained from the server, the Bluetooth device is verified according to the terminal private key and the public key of the Bluetooth device, and the terminal public key is sent to the Bluetooth device, so that the Bluetooth device verifies the second terminal according to the private key of the Bluetooth device and the terminal public key.
[0222] Step c2: Generate a first key based on the terminal private key of the second terminal and the public key of the Bluetooth device.
[0223] A preset algorithm can be used to calculate the terminal private key and the public key of the Bluetooth device, and the calculation result can be determined as the first key. The first key can be referred to as AES Key1.
[0224] Step c3: Encrypt the pairing request data using the first key.
[0225] Step c4: Send the encrypted pairing request data and the terminal public key of the second terminal to the Bluetooth device.
[0226] The Bluetooth device generates a second key based on the terminal public key and the Bluetooth device private key, decrypts the encrypted pairing request data using the second key, and in response to successful decryption of the encrypted pairing request data, encrypts the pairing request response data using the second key to generate a first notification including the encrypted pairing request response data. The encrypted pairing request response data includes the MAC address of the Bluetooth device, and sends the first notification to the second terminal. The second key can be referred to as AES Key2.
[0227] In this embodiment, the second terminal and the Bluetooth device can send data via low - power Bluetooth.
[0228] Next, an example of the data formats of the pairing request and the terminal public key of the second terminal is given. Table 1.1 shows the data formats of the pairing request and the terminal public key, and Table 1.2 shows the specific data format of the pairing request.
[0229] Table 1.1
[0230] Byte Length (bits) Description Is Mandatory 0-15 128 Pairing Request Mandatory 16-79 512 Public key Optional
[0231] Table 1.2
[0232]
[0233]
[0234] In Tables 1.1 and 1.2, Seeker refers to the second terminal, such as a mobile phone, and Provider refers to the Bluetooth device, such as a Bluetooth headset.
[0235] Based on the settings in steps c1 - c4, for the verification of the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key in the above - mentioned first step, it can be achieved in the following way: First, use the first key to decrypt the encrypted pairing request response data in the first notification; Second, in response to the successful decryption of the encrypted pairing request response data, it is determined that the Bluetooth device passes the verification. On the contrary, in response to the failure of decrypting the encrypted pairing request response data, it is determined that the Bluetooth device fails the verification.
[0236] In this embodiment, the second terminal determines the first key. Based on this, the sending of the key to the Bluetooth device in step 203 can be achieved in the following way: Encrypt the key using the first key and send the encrypted key to the Bluetooth device. The Bluetooth device uses the internal second key to decrypt the encrypted key to obtain the key and stores the key.
[0237] A list, Account key list, can be set in the Bluetooth device. The list can store a certain number of keys, Account key. For example, the list can store two keys, Account key. If the list is full, the earliest - stored key, Account key, can be deleted so as to store the new key, Account key, in the list.
[0238] The following gives an example of the data format of the pairing request response. Table 1.3 shows the data format of the pairing request response, and Table 1.4 shows the specific data format of the pairing request response.
[0239] Table 1.3
[0240] Byte Length (bits) Description Remarks 0-15 128 Pairing Response Pairing Response data is sent to the second terminal
[0241] Table 1.4
[0242] Byte Length (bits) Value Remarks 0 8 0x01 = Key-based Pairing Response 1-6 48 BR / EDR address of the Provider 7-15 72 Random number
[0243] In Table 1.4, Provider refers to the Bluetooth device, such as a Bluetooth headset. The BR / EDR address of Provider refers to the traditional Bluetooth address of the Bluetooth device, that is, the MAC address.
[0244] In some embodiments, the second terminal can also perform the following operations:
[0245] d1. Encrypt the first verification code using the first key.
[0246] d2. Send the encrypted first verification code to the Bluetooth device.
[0247] Cause the Bluetooth device to decrypt the encrypted first verification code using the second key, determine whether the decryption result of the encrypted first verification code is consistent with the second verification code. If they are consistent, encrypt the second verification code using the second key to obtain the encrypted second verification code, and send a second notification including the encrypted second verification code to the second terminal.
[0248] The first verification code can be referred to as Passkey1, and the second verification code can be referred to as Passkey2.
[0249] Based on the settings in steps d1 and d2, the operation of verifying the Bluetooth device according to the first verification code in the above fourth step can be implemented in the following manner: First, decrypt the encrypted second verification code in the second notification using the first key; Second, determine whether the decryption result of the encrypted second verification code is consistent with the first verification code; Third, if they are consistent, determine that the Bluetooth device passes the verification, and if they are not consistent, determine that the Bluetooth device fails the verification.
[0250] The following gives an example of the data format of the encrypted verification code. Table 1.5 shows the data format of the encrypted verification code, and Table 1.6 shows the specific data format of the encrypted verification code.
[0251] Table 1.5
[0252] Byte Length (bits) Description 0-15 128 Encrypted Passkey
[0253] Table 1.6
[0254]
[0255] In Table 1.6, Seeker's Passkey refers to the second verification code used by the second terminal, and Provider's Passkey refers to the first verification code used by the Bluetooth device.
[0256] In some embodiments, after the second terminal sends the combined information to the server, it can send an instruction for deleting the combined information to the server under the condition of meeting the condition for deleting the combined information, so that the server deletes the combined information stored internally according to this instruction.
[0257] For example, after the second terminal receives an instruction triggered by the user for deleting the combined information, it sends an instruction for deleting the combined information to the server. Another example is that there is a preset duration. After the second terminal determines that the duration for which the server stores the combined information reaches the preset duration, it automatically sends an instruction for deleting the combined information to the server.
[0258] After the server deletes the combined information, the relevant content displayed on the UI menu of the second terminal is deleted.
[0259] It should be noted that the second terminal executing Figure 2 the method shown and the first terminal executing Figure 1 the method shown can be the same terminal or different terminals.
[0260] In the embodiments of the present disclosure, after the second terminal logs in to the server using an account, it pairs the second terminal with a Bluetooth device. In response to successful pairing, a key is generated and sent to the Bluetooth device, enabling the Bluetooth device to broadcast the key. The combined information of the account, the MAC address of the Bluetooth device, and the key is sent to the server, enabling the terminal using the account to obtain the MAC address and key of the Bluetooth device corresponding to the account from the server and execute Figure 1 the method shown.
[0261] During the pairing process between the Bluetooth device and the second terminal, the second terminal is verified once based on the Bluetooth device private key and the terminal public key, and verified twice based on the second verification code generated by the Bluetooth device. After both verifications pass, the verification of the second terminal is completed.
[0262] Figure 3 FIG. is a flowchart of a Bluetooth device pairing method shown according to an exemplary embodiment. Figure 3 The method shown is applied to a Bluetooth device, which can be a device such as a Bluetooth headset. Figure 3 The method shown may include:
[0263] In step 301, after receiving the terminal public key sent by the second terminal, the second terminal is verified based on the Bluetooth device private key of the Bluetooth device and the terminal public key.
[0264] The terminal public key sent by the second terminal can be received via low energy Bluetooth.
[0265] In some embodiments, the second terminal generates a first key based on the terminal private key and the Bluetooth device public key, encrypts the pairing request data using the first key to obtain the encrypted pairing request data, and sends the encrypted pairing request data to the Bluetooth device. The Bluetooth device can receive the terminal public key and the encrypted pairing request data sent by the second terminal via low energy Bluetooth.
[0266] In this case, the verification of the second terminal based on the Bluetooth device private key of the Bluetooth device and the terminal public key can be achieved in the following manner: First, a second key is generated based on the Bluetooth device private key and the terminal public key; second, the encrypted pairing request data is decrypted using the second key; third, in response to successful decryption of the encrypted pairing request data, it is determined that the second terminal passes the verification, and conversely, in response to failed decryption of the encrypted pairing request data, it is determined that the second terminal fails the verification.
[0267] A preset algorithm can be used to calculate the private key of the Bluetooth device and the public key of the terminal, and the calculation result is determined as the second key.
[0268] In step 302, in response to the successful verification of the second terminal, a first notification is sent to the second terminal, and the first notification includes the MAC address of the Bluetooth device.
[0269] After the second terminal device determines that the Bluetooth device is successfully verified according to the private key of the second terminal and the public key of the Bluetooth device, a Bluetooth pairing request is sent to the Bluetooth device according to the MAC address of the Bluetooth device included in the first notification. The Bluetooth pairing request triggers the second terminal (which can be the second terminal protocol stack) to generate a first verification code, and the Bluetooth device (which can be the Bluetooth device protocol stack) to generate a second verification code.
[0270] The first notification can be sent to the second terminal via low - power Bluetooth.
[0271] In step 303, the second terminal is verified according to the second verification code.
[0272] In some embodiments, after obtaining the first verification code generated by the second terminal, the second terminal can encrypt the first verification code using the first key to obtain the encrypted first verification code, and send the encrypted first verification code to the Bluetooth device. The Bluetooth device can receive the encrypted first verification code sent by the second terminal.
[0273] In this case, the Bluetooth device verifies the second terminal according to the second verification code, which can be achieved in the following way: First, decrypt the encrypted first verification code using the second key; Second, determine whether the decryption result is consistent with the second verification code; Third, if they are consistent, it is determined that the second terminal passes the verification, and conversely, if they are inconsistent, it is determined that the second terminal fails the verification.
[0274] In step 304, in response to the successful verification of the second terminal, a second notification is sent to the second terminal. The second notification is used to trigger the second terminal to verify the Bluetooth device according to the first verification code. In response to the successful verification of the Bluetooth device, it is determined that the second terminal and the Bluetooth device are successfully paired.
[0275] The second notification can be sent to the second terminal via low - power Bluetooth.
[0276] In some embodiments, the second terminal can encrypt the second verification code using the second key to generate a second notification including the encrypted second verification code, and send the second notification including the encrypted second verification code to the second terminal.
[0277] The second terminal decrypts the encrypted second verification code using the first key to obtain the second verification code, determines whether the second verification code is consistent with the first verification code. If they are consistent, it determines that the Bluetooth device verification is passed and determines that the second terminal is successfully paired with the Bluetooth device.
[0278] In some embodiments, after the second terminal determines that it is successfully paired with the Bluetooth device, it obtains a key, for example, generates a new key, encrypts the key using the first key to obtain the encrypted key, and sends the encrypted key to the Bluetooth device.
[0279] After receiving the encrypted key sent by the second terminal, the Bluetooth device decrypts the encrypted key using the second key to obtain the key and stores the key. During subsequent startup processes, the Bluetooth device can broadcast the stored key via Bluetooth Low Energy. The Bluetooth device can store the key in a key list.
[0280] In the embodiments of the present disclosure, during the pairing process between the Bluetooth device and the second terminal, the second terminal is verified once based on the Bluetooth device private key and the terminal public key, and is verified twice based on the second verification code generated by the Bluetooth device. After both verifications are passed, the verification of the second terminal is completed.
[0281] The following introduces the Xiaomi Bluetooth fast pairing protocol.
[0282] Xiaomi Fast Pair Service (XFPS) uses BLE to discover surrounding Bluetooth Sink devices, establishes classic Bluetooth pairing and connection with as few user operations as possible, binds with the Xiaomi account, realizes device roaming, and improves the user experience.
[0283] The main functions include: when there is a Sink device nearby, the mobile phone actively displays a notification; the Sink device is bound to the mobile phone account; when another mobile phone logs in to the Xiaomi account, it automatically connects to the Sink device; the Sink device can be renamed; when the Sink device firmware can be upgraded, the mobile phone displays a notification.
[0284] Terminology: BLE: Bluetooth Low Energy; GATT: GENERIC ATTRIBUTE.
[0285] Role definition: Seeker - Bluetooth Source device, such as mobile phone, tablet, etc.; Provider - Bluetooth Sink device, such as headphones, in - vehicle device, speaker, etc.
[0286] Define the Xiaomi fast pairing Service
[0287] Service UUID Xiaomi Fast Pair Service 0xFD2D
[0288]
[0289]
[0290]
[0291] Cloud Account
[0292] The earphone is registered in the cloud, and a Model ID and a Public / Private Key pair are assigned.
[0293] The cloud assigns the following to each Provider through an algorithm:
[0294]
[0295] Seeker
[0296] Add a UI menu "Connected Device Management" under the Xiaomi account. After logging in to the account, automatically query the paired Bluetooth earphones from the cloud and display them in the device list. After the user clicks to enter, the user can view the device list and can delete one or all of the devices. Figure 4 It is a schematic diagram of a UI menu shown according to an exemplary embodiment.
[0297] Provider
[0298] Provider provides the Xiaomi Fast Pairing Service
[0299]
[0300]
[0301]
[0302] Provider needs to reserve 80 bytes to store 5 128-bit account keys.
[0303] For the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present disclosure is not limited by the described action sequence, because according to the present disclosure, certain steps can be performed in other sequences or simultaneously.
[0304] Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to the present disclosure.
[0305] Corresponding to the foregoing embodiments of the method for implementing application functions, the present disclosure also provides embodiments of an apparatus for implementing application functions and a corresponding electronic device.
[0306] Figure 5 FIG. 4 is a block diagram of a Bluetooth device pairing apparatus according to an exemplary embodiment. The apparatus may be applied to a first terminal, and the apparatus may include:
[0307] A connection information acquisition module 41, configured to acquire connection information corresponding to the account in the server after logging in to the server using the account, where the connection information includes the MAC address and the key of the Bluetooth device;
[0308] A broadcast data acquisition module 42, configured to acquire broadcast data sent by a Bluetooth device located around the first terminal;
[0309] A device pairing module 43, configured to pair the first terminal and the Bluetooth device according to the MAC address and the key in response to the broadcast data including the key.
[0310] In an optional embodiment, based on the Bluetooth device pairing apparatus shown in Figure 5 FIG. 4, the device pairing module 43 may include:
[0311] An actual MAC address receiving sub-module, configured to receive the encrypted actual MAC address of the Bluetooth device sent by the Bluetooth device;
[0312] An address decryption sub-module, configured to decrypt the encrypted actual MAC address using the key to obtain the actual MAC address;
[0313] An address determination sub-module, configured to determine whether the actual MAC address is consistent with the MAC address. If they are consistent, start pairing the first terminal and the Bluetooth device. If they are not consistent, do not pair the first terminal and the Bluetooth device.
[0314] In an optional embodiment, based on the Bluetooth device pairing apparatus shown in Figure 5 FIG. 4, the apparatus may further include:
[0315] A notification output module, configured to output a confirmation notification of the Bluetooth device in response to the broadcast data including the key;
[0316] A confirmation information receiving module, configured to receive confirmation information of the Bluetooth device and start performing an operation of pairing the first terminal and the Bluetooth device according to the MAC address and the key.
[0317] Figure 6 Another block diagram of a Bluetooth device pairing apparatus shown according to an exemplary embodiment. The apparatus can be applied to a second terminal and can include:
[0318] A terminal pairing module 51, configured to pair the second terminal and a Bluetooth device after logging in to a server using an account;
[0319] A key generation module 52, configured to generate a key in response to successful pairing;
[0320] A key sending module 53, configured to send the key to the Bluetooth device;
[0321] A combined information sending module 54, configured to send the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
[0322] In an optional embodiment, based on the Figure 6 shown Bluetooth device pairing apparatus, the terminal pairing module 51 can include:
[0323] A first notification receiving sub-module, configured to receive a first notification sent by the Bluetooth device after logging in to the server using the account. The first notification is a notification sent by the Bluetooth device after determining that the second terminal passes verification according to the terminal public key of the second terminal and the private key of the Bluetooth device, and the first notification includes the MAC address of the Bluetooth device;
[0324] A first Bluetooth device verification sub-module, configured to verify the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device;
[0325] A Bluetooth pairing request sending sub-module, configured to send a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device in response to the Bluetooth device passing verification. The Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code;
[0326] A second notification receiving sub-module, configured to receive a second notification sent by the Bluetooth device. The second notification is a notification sent by the Bluetooth device after determining that the second terminal passes verification according to the second verification code;
[0327] A second Bluetooth device verification sub-module, configured to verify the Bluetooth device according to the first verification code, and determine that the second terminal is successfully paired with the Bluetooth device in response to the Bluetooth device passing verification.
[0328] In an optional embodiment, the apparatus may further include:
[0329] A public key acquisition module, configured to acquire the public key of the Bluetooth device;
[0330] A first key generation module, configured to generate a first key according to the private key of the second terminal and the public key of the Bluetooth device;
[0331] A pairing request data encryption module, configured to encrypt the pairing request data using the first key;
[0332] A data sending module, configured to send the encrypted pairing request data and the public key of the second terminal to the Bluetooth device, so that the Bluetooth device generates a second key according to the public key of the terminal and the private key of the Bluetooth device, decrypts the encrypted pairing request data using the second key, and in response to successfully decrypting the encrypted pairing request data, encrypts the pairing request response data using the second key, generates a first notification including the encrypted pairing request response data, where the encrypted pairing request response data includes the MAC address of the Bluetooth device, and sends the first notification to the second terminal.
[0333] In an optional embodiment, the first Bluetooth device verification sub-module may include:
[0334] A pairing request response data decryption unit, configured to decrypt the encrypted pairing request response data in the first notification using the first key;
[0335] A first verification passed unit, configured to determine that the Bluetooth device passes the verification in response to successfully decrypting the encrypted pairing request response data;
[0336] A first verification failed unit, configured to determine that the Bluetooth device fails the verification in response to failing to decrypt the encrypted pairing request response data.
[0337] In an optional embodiment, the device may further include:
[0338] A first verification code encryption module, configured to encrypt the first verification code using the first key;
[0339] An encrypted data sending module, configured to send the encrypted first verification code to the Bluetooth device, so that the Bluetooth device decrypts the encrypted first verification code using the second key, determines whether the decryption result of the encrypted first verification code is consistent with the second verification code, and if so, encrypts the second verification code using the second key to obtain an encrypted second verification code, and sends the second notification including the encrypted second verification code to the second terminal.
[0340] In an optional embodiment, the second Bluetooth device verification sub-module may include:
[0341] A second verification code decryption unit, configured to decrypt the encrypted second verification code in the second notification using the first key;
[0342] A decryption result determination unit, configured to determine whether the decryption result of the encrypted second verification code is consistent with the first verification code;
[0343] A second verification passed unit, configured to determine that the Bluetooth device passes the verification if they are consistent;
[0344] A second verification failed unit, configured to determine that the Bluetooth device fails the verification if they are inconsistent.
[0345] In an optional embodiment, the public key acquisition module may include:
[0346] A device information receiving sub-module, configured to receive the device information of the Bluetooth device sent by the Bluetooth device;
[0347] A Bluetooth device public key acquisition sub-module, configured to acquire the Bluetooth device public key corresponding to the device information in the server.
[0348] In an optional embodiment, based on Figure 6 the Bluetooth device pairing device shown, the device may further include:
[0349] An instruction sending module, configured to send an instruction for deleting the combined information to the server in response to the condition that the combined information is satisfied, so that the server deletes the combined information stored internally according to the instruction.
[0350] Figure 7 is another block diagram of a Bluetooth device pairing device shown according to an exemplary embodiment. The device may be applied to a Bluetooth device, and the device may include:
[0351] The second terminal verification module 61 is configured to verify the second terminal according to the Bluetooth device private key of the Bluetooth device and the terminal public key after receiving the terminal public key sent by the second terminal;
[0352] The first notification sending module 62 is configured to send a first notification to the second terminal in response to the successful verification of the second terminal. The first notification includes the MAC address of the Bluetooth device, such that after the second terminal device determines that the Bluetooth device is verified successfully according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device, it sends a Bluetooth pairing request to the Bluetooth device according to the MAC address included in the first notification. The Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code;
[0353] The terminal verification module 63 is configured to verify the second terminal according to the second verification code;
[0354] The second notification sending module 64 is configured to send a second notification to the second terminal in response to the successful verification of the second terminal. The second notification is used to trigger the second terminal to verify the Bluetooth device according to the first verification code. In response to the successful verification of the Bluetooth device, it is determined that the second terminal and the Bluetooth device are paired successfully.
[0355] In an alternative embodiment, based on Figure 7 the Bluetooth device pairing device shown, the device may further include:
[0356] The request data receiving module is configured to receive the terminal public key and the encrypted pairing request data sent by the second terminal. The encrypted pairing request data is data obtained by the second terminal generating a first key according to the terminal private key and the Bluetooth device public key and encrypting the pairing request data using the first key;
[0357] The second terminal verification module 61 may include:
[0358] The second key generation sub-module is configured to generate a second key according to the Bluetooth device private key and the terminal public key;
[0359] The request data decryption sub-module is configured to decrypt the encrypted pairing request data using the second key;
[0360] The first verification passed sub-module is configured to determine that the second terminal passes the verification in response to the successful decryption of the encrypted pairing request data;
[0361] The first verification failed sub-module is configured to determine that the second terminal fails the verification in response to the failure of decrypting the encrypted pairing request data.
[0362] In an alternative embodiment, based on Figure 6 the Bluetooth device pairing apparatus shown, the apparatus may further include:
[0363] A verification code receiving module, configured to receive the encrypted first verification code sent by the second terminal, where the encrypted first verification code is obtained by the second terminal encrypting the first verification code using the first key;
[0364] The terminal verification module 63 may include:
[0365] A verification code decryption sub-module, configured to decrypt the encrypted first verification code using the second key;
[0366] A decryption result judgment sub-module, configured to determine whether the decryption result is consistent with the second verification code;
[0367] A second verification passed sub-module, configured to determine that the second terminal passes the verification if they are consistent;
[0368] A second verification failed sub-module, configured to determine that the second terminal fails the verification if they are inconsistent.
[0369] In an alternative embodiment, based on Figure 6 the Bluetooth device pairing apparatus shown, the apparatus may further include:
[0370] An encryption key receiving module, configured to receive the encrypted key sent by the second terminal, where the encrypted key is obtained by the second terminal encrypting the key using the first key after determining that the second terminal and the Bluetooth device are paired successfully;
[0371] An encryption key decryption module, configured to decrypt the encrypted key using the second key to obtain the key;
[0372] A key storage module, configured to store the key.
[0373] Figure 8 is a schematic structural diagram of an air conditioner 1600 shown according to an exemplary embodiment. Refer to Figure 8, the air conditioner 1600 may include one or more of the following components: a processing component 1602, a memory 1604, a power supply component 1606, a multimedia component 1608, an audio component 1610, an input / output (I / O) interface 1612, a sensor component 1614, and a communication component 1616.
[0374] The processing component 1602 generally controls the overall operation of the air conditioner 1600, such as operations associated with display, phone call, data communication, camera operation, and recording operation. The processing component 1602 may include one or more processors 1620 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 1602 may include one or more modules to facilitate the interaction between the processing component 1602 and other components. For example, the processing component 1602 may include a multimedia module to facilitate the interaction between the multimedia component 1608 and the processing component 1602.
[0375] The memory 1604 is configured to store various types of data to support the operation of the air conditioner 1600. Examples of such data include instructions for any application or method operating on the air conditioner 1600, contact data, phone book data, messages, pictures, videos, etc. The memory 1604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disc.
[0376] The power supply component 1606 provides power to various components of the air conditioner 1600. The power supply component 1606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the air conditioner 1600.
[0377] The multimedia component 1608 includes a screen that provides an output interface between the above-described air conditioner 1600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The above touch sensors can sense not only the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the above touch or swipe operations. In some embodiments, the multimedia component 1608 includes a front camera and / or a rear camera. When the air conditioner 1600 is in an operation mode, such as an adjustment mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and an optical zoom capability.
[0378] The audio component 1610 is configured to output and / or input audio signals. For example, the audio component 1610 includes a microphone (MIC) that is configured to receive external audio signals when the air conditioner 1600 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 1604 or transmitted via the communication component 1616. In some embodiments, the audio component 1610 further includes a speaker for outputting audio signals.
[0379] The I / O interface 1612 provides an interface between the processing component 1602 and a peripheral interface module, and the above peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a start button, and a lock button.
[0380] The sensor component 1614 includes one or more sensors for providing a status assessment of various aspects of the air conditioner 1600. For example, the sensor component 1614 can detect the on / off state of the air conditioner 1600, the relative positioning of components, such as the display and the keypad of the above-described air conditioner 1600. The sensor component 1614 can also detect a change in the position of the air conditioner 1600 or a component of the air conditioner 1600, the presence or absence of user contact with the air conditioner 1600, the orientation or acceleration / deceleration of the air conditioner 1600, and the temperature change of the air conditioner 1600. The sensor component 1614 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 1614 can also include a light sensor, such as a CMOS or a CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 1614 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0381] The communication component 1616 is configured to facilitate communication between the air conditioner 1600 and other devices in a wired or wireless manner. The air conditioner 1600 can access a communication standard-based wireless network, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1616 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0382] In an exemplary embodiment, the air conditioner 1600 can be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.
[0383] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided. For example, a memory 1604 including instructions, when the instructions in the storage medium are executed by a processor 1620 of the air conditioner 1600, enables the air conditioner 1600 to perform a Bluetooth device pairing method, which includes: after logging in to a server using an account, obtaining connection information corresponding to the account in the server, where the connection information includes the MAC address and a key of a Bluetooth device; obtaining broadcast data sent by a Bluetooth device located around the first terminal; and in response to the broadcast data including the key, pairing the first terminal and the Bluetooth device according to the MAC address and the key.
[0384] After logging in to a server using an account, obtaining information corresponding to the account in the server, where the information includes the MAC address and a key of a Bluetooth device; after obtaining broadcast data sent by a Bluetooth device located around the first terminal via Low Energy Bluetooth, determining whether the broadcast data includes the key; and in response to the broadcast data including the key, pairing the first terminal and the Bluetooth device according to the MAC address and the key of the Bluetooth device.
[0385] The non-transitory computer-readable storage medium can be a ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0386] Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include known common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and examples are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.
[0387] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.
Claims
1. A Bluetooth device pairing method, characterized in that, Applied to a first terminal, the method includes: After logging in to the server using an account, obtaining connection information corresponding to the account in the server, where the connection information includes the MAC address and a key of a Bluetooth device; Obtaining broadcast data sent by Bluetooth devices located around the first terminal; In response to the broadcast data including the key, pairing the first terminal and the Bluetooth device according to the MAC address and the key; Wherein, the key is generated by a second terminal in the following manner and sent to the server: After logging in to the server using the account, receiving a first notification sent by the Bluetooth device, where the first notification is a notification sent by the Bluetooth device after determining that the second terminal passes verification according to the terminal public key of the second terminal and the private key of the Bluetooth device, and the first notification includes the MAC address of the Bluetooth device; Verifying the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device; In response to the Bluetooth device passing verification, sending a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device, where the Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code; Encrypting the first verification code using a first key, where the first key is generated according to the terminal private key of the second terminal and the Bluetooth device public key; Sending the encrypted first verification code to the Bluetooth device, such that the Bluetooth device decrypts the encrypted first verification code using a second key, determines whether the decryption result of the encrypted first verification code is consistent with the second verification code, if consistent, then encrypts the second verification code using the second key to obtain an encrypted second verification code, and sends a second notification including the encrypted second verification code to the second terminal, where the second key is generated according to the terminal public key of the second terminal and the Bluetooth device private key of the Bluetooth device; Receiving the second notification sent by the Bluetooth device, where the second notification is a notification sent by the Bluetooth device after determining that the second terminal passes verification according to the second verification code; Decrypting the encrypted second verification code in the second notification using the first key; Determining whether the decryption result of the encrypted second verification code is consistent with the first verification code; if consistent, then determining that the Bluetooth device passes verification; if inconsistent, then determining that the Bluetooth device fails verification; in response to the Bluetooth device passing verification, determining that the second terminal and the Bluetooth device are successfully paired; In response to successful pairing, generating the key; Sending the key to the Bluetooth device; Sending the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
2. The method according to claim 1, wherein The pairing the first terminal and the Bluetooth device according to the MAC address of the Bluetooth device and the key includes: Receiving the encrypted actual MAC address of the Bluetooth device sent by the Bluetooth device; Decrypt the encrypted actual MAC address using the key to obtain the actual MAC address; Determine whether the actual MAC address is consistent with the MAC address. If they are consistent, start pairing the first terminal and the Bluetooth device. If they are not consistent, do not pair the first terminal and the Bluetooth device.
3. The method according to claim 1, characterized in that, The method further includes: In response to the broadcast data including the key, output a confirmation notice of the Bluetooth device; Receive the confirmation information of the Bluetooth device, and start performing the operation of pairing the first terminal and the Bluetooth device according to the MAC address and the key.
4. A Bluetooth device pairing method, characterized in that, Applied to a second terminal, the method includes: After logging in to the server using an account, receive a first notice sent by a Bluetooth device. The first notice is a notice sent by the Bluetooth device after determining that the second terminal has passed the verification according to the terminal public key of the second terminal and the private key of the Bluetooth device. The first notice includes the MAC address of the Bluetooth device; Verify the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device; In response to the Bluetooth device passing the verification, send a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device. The Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code; Encrypt the first verification code using a first key, where the first key is generated according to the terminal private key of the second terminal and the Bluetooth device public key; Send the encrypted first verification code to the Bluetooth device, so that the Bluetooth device decrypts the encrypted first verification code using a second key, determines whether the decryption result of the encrypted first verification code is consistent with the second verification code. If they are consistent, encrypt the second verification code using the second key to obtain an encrypted second verification code, and send a second notice including the encrypted second verification code to the second terminal. The second key is generated according to the terminal public key of the second terminal and the Bluetooth device private key of the Bluetooth device; Receive the second notice sent by the Bluetooth device. The second notice is a notice sent by the Bluetooth device after determining that the second terminal has passed the verification according to the second verification code; Decrypt the encrypted second verification code in the second notice using the first key; Determine whether the decryption result of the encrypted second verification code is consistent with the first verification code; if they are consistent, determine that the Bluetooth device has passed the verification; if they are not consistent, determine that the Bluetooth device has not passed the verification; in response to the Bluetooth device passing the verification, determine that the second terminal and the Bluetooth device are successfully paired; In response to successful pairing, generate a key; Send the key to the Bluetooth device; Send the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
5. The method according to claim 4, wherein The method further includes: Obtain the Bluetooth device public key of the Bluetooth device; Generate the first key according to the terminal private key of the second terminal and the Bluetooth device public key; Encrypt the pairing request data using the first key; Send the encrypted pairing request data and the public key of the second terminal to the Bluetooth device, so that the Bluetooth device generates the second key according to the public key of the terminal and the private key of the Bluetooth device, decrypt the encrypted pairing request data using the second key, and in response to successfully decrypting the encrypted pairing request data, encrypt the pairing request response data using the second key to generate a first notification including the encrypted pairing request response data, where the encrypted pairing request response data includes the MAC address of the Bluetooth device, and send the first notification to the second terminal.
6. The method according to claim 5, wherein The verifying the Bluetooth device according to the private key of the second terminal and the public key of the Bluetooth device includes: Decrypt the encrypted pairing request response data in the first notification using the first key; In response to successfully decrypting the encrypted pairing request response data, determine that the Bluetooth device passes the verification; In response to failing to decrypt the encrypted pairing request response data, determine that the Bluetooth device fails to pass the verification.
7. The method according to claim 5, characterized in that, The obtaining the public key of the Bluetooth device includes: Receive the device information of the Bluetooth device sent by the Bluetooth device; Obtain the public key of the Bluetooth device corresponding to the device information in the server.
8. The method according to claim 4, characterized in that, The method further includes: In response to meeting the conditions of the combined information, send an instruction to the server to delete the combined information, so that the server deletes the combined information stored internally according to the instruction.
9. A Bluetooth device pairing method, characterized in that, Applied to a Bluetooth device, the method includes: After receiving the public key of the second terminal sent by the second terminal, verify the second terminal according to the private key of the Bluetooth device and the public key of the terminal; In response to the second terminal passing the verification, send a first notification to the second terminal, where the first notification includes the MAC address of the Bluetooth device, so that after the second terminal determines that the Bluetooth device passes the verification according to the private key of the second terminal and the public key of the Bluetooth device, send a Bluetooth pairing request to the Bluetooth device according to the MAC address included in the first notification, and the Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code; Receive the encrypted first verification code sent by the second terminal, where the encrypted first verification code is obtained by the second terminal encrypting the first verification code using the first key, and the first key is generated according to the private key of the second terminal and the public key of the Bluetooth device; Decrypt the encrypted first verification code using the second key, where the second key is generated according to the public key of the second terminal and the private key of the Bluetooth device; Determine whether the decryption result is consistent with the second verification code; If they are consistent, determine that the second terminal passes the verification; if they are not consistent, determine that the second terminal fails to pass the verification; In response to the successful verification of the second terminal, send a second notification to the second terminal. The second notification is used to trigger the second terminal to verify the Bluetooth device according to the first verification code. In response to the successful verification of the Bluetooth device, determine that the second terminal is successfully paired with the Bluetooth device. The second notification includes the encrypted second verification code, and the encrypted second verification code is obtained by encrypting the second verification code using the second key.
10. The method according to claim 9, wherein The method further includes: Receiving the terminal public key and the encrypted pairing request data sent by the second terminal. The encrypted pairing request data is data obtained by the second terminal generating the first key according to the terminal private key and the Bluetooth device public key, and encrypting the pairing request data using the first key. The verifying the second terminal according to the Bluetooth device private key and the second terminal public key includes: Generating the second key according to the Bluetooth device private key and the terminal public key; Decrypting the encrypted pairing request data using the second key; In response to the successful decryption of the encrypted pairing request data, determining that the second terminal passes the verification; In response to the failure of decrypting the encrypted pairing request data, determining that the second terminal fails to pass the verification.
11. The method according to claim 9, wherein The method further includes: Receiving the encrypted key sent by the second terminal. The encrypted key is obtained by the second terminal encrypting the key using the first key after determining that the second terminal is successfully paired with the Bluetooth device. Decrypting the encrypted key using the second key to obtain the key; Storing the key.
12. A Bluetooth device pairing apparatus, characterized in that, Applied to a first terminal, the apparatus includes: A connection information acquisition module, configured to acquire connection information corresponding to the account in the server after logging in to the server using the account. The connection information includes the MAC address and the key of the Bluetooth device; A broadcast data acquisition module, configured to acquire broadcast data sent by Bluetooth devices located around the first terminal; A device pairing module, configured to, in response to the broadcast data including the key, pair the first terminal and the Bluetooth device according to the MAC address and the key; Wherein, the key is generated by the second terminal in the following manner and sent to the server: After logging in to the server using the account, receiving a first notification sent by the Bluetooth device. The first notification is a notification sent by the Bluetooth device after determining that the second terminal passes the verification according to the second terminal public key and the Bluetooth device private key. The first notification includes the MAC address of the Bluetooth device; Verifying the Bluetooth device according to the second terminal private key and the Bluetooth device public key of the second terminal; In response to the successful verification of the Bluetooth device, sending a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device. The Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code. Encrypt the first verification code using a first key, where the first key is generated based on the terminal private key of the second terminal and the public key of the Bluetooth device; Send the encrypted first verification code to the Bluetooth device, such that the Bluetooth device decrypts the encrypted first verification code using a second key, determines whether the decryption result of the encrypted first verification code is consistent with the second verification code, and if consistent, encrypts the second verification code using the second key to obtain an encrypted second verification code, and sends a second notification including the encrypted second verification code to the second terminal, where the second key is generated based on the terminal public key of the second terminal and the Bluetooth device private key of the Bluetooth device; Receive the second notification sent by the Bluetooth device, where the second notification is a notification sent by the Bluetooth device after determining that the second terminal has passed the verification based on the second verification code; Decrypt the encrypted second verification code in the second notification using the first key; Determine whether the decryption result of the encrypted second verification code is consistent with the first verification code; if consistent, determine that the Bluetooth device has passed the verification; if inconsistent, determine that the Bluetooth device has not passed the verification; in response to the Bluetooth device passing the verification, determine that the second terminal and the Bluetooth device are successfully paired; In response to successful pairing, generate the key; Send the key to the Bluetooth device; Send the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
13. The device according to claim 12, characterized in that, The device pairing module includes: An actual MAC address receiving sub-module configured to receive the encrypted actual MAC address of the Bluetooth device sent by the Bluetooth device; An address decryption sub-module configured to decrypt the encrypted actual MAC address using the key to obtain the actual MAC address; An address determination sub-module configured to determine whether the actual MAC address is consistent with the MAC address, and if consistent, start pairing the first terminal and the Bluetooth device, and if inconsistent, not pair the first terminal and the Bluetooth device.
14. The device according to claim 12, characterized in that, The device further includes: A notification output module configured to output a confirmation notification of the Bluetooth device in response to the broadcast data including the key; A confirmation information receiving module configured to receive confirmation information of the Bluetooth device and start performing an operation of pairing the first terminal and the Bluetooth device according to the MAC address and the key.
15. A Bluetooth device pairing apparatus, characterized in that, Applied to a second terminal, the device includes: A first notification receiving sub-module configured to receive a first notification sent by a Bluetooth device after logging in to a server using an account, where the first notification is a notification sent by the Bluetooth device after determining that the second terminal has passed the verification based on the terminal public key of the second terminal and the private key of the Bluetooth device, and the first notification includes the MAC address of the Bluetooth device; The first Bluetooth device verification sub-module is configured to verify the Bluetooth device according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device; The Bluetooth pairing request sending sub-module is configured to, in response to the successful verification of the Bluetooth device, send a Bluetooth pairing request to the Bluetooth device according to the MAC address of the Bluetooth device, and the Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code; The first verification code encryption module is configured to encrypt the first verification code using a first key, and the first key is generated according to the terminal private key of the second terminal and the Bluetooth device public key; The encrypted data sending module is configured to send the encrypted first verification code to the Bluetooth device, so that the Bluetooth device decrypts the encrypted first verification code using a second key, determines whether the decryption result of the encrypted first verification code is consistent with the second verification code, and if so, encrypts the second verification code using the second key to obtain an encrypted second verification code, and sends a second notification including the encrypted second verification code to the second terminal, and the second key is generated according to the terminal public key of the second terminal and the Bluetooth device private key of the Bluetooth device; The second notification receiving sub-module is configured to receive the second notification sent by the Bluetooth device, and the second notification is a notification sent by the Bluetooth device after determining that the second terminal has passed the verification according to the second verification code; The second Bluetooth device verification sub-module includes: The second verification code decryption unit is configured to decrypt the encrypted second verification code in the second notification using the first key; The decryption result determination unit is configured to determine whether the decryption result of the encrypted second verification code is consistent with the first verification code; The second verification passed unit is configured to, if consistent, determine that the Bluetooth device has passed the verification; The second verification failed unit is configured to, if inconsistent, determine that the Bluetooth device has not passed the verification; The second Bluetooth device verification sub-module is configured to, in response to the Bluetooth device passing the verification, determine that the second terminal and the Bluetooth device are successfully paired; The key generation module is configured to generate a key in response to successful pairing; The key sending module is configured to send the key to the Bluetooth device; The combined information sending module is configured to send the combined information of the account, the Bluetooth device MAC address of the Bluetooth device, and the key to the server.
16. The device according to claim 15, characterized in that, The device further includes: The public key acquisition module is configured to acquire the Bluetooth device public key of the Bluetooth device; The first key generation module is configured to generate the first key according to the terminal private key of the second terminal and the Bluetooth device public key; The pairing request data encryption module is configured to encrypt the pairing request data using the first key; The data sending module is configured to send the encrypted pairing request data and the terminal public key of the second terminal to the Bluetooth device, so that the Bluetooth device generates the second key according to the terminal public key and the Bluetooth device private key, decrypts the encrypted pairing request data by using the second key, and in response to successfully decrypting the encrypted pairing request data, encrypts the pairing request response data by using the second key to generate a first notification including the encrypted pairing request response data, where the encrypted pairing request response data includes the MAC address of the Bluetooth device, and sends the first notification to the second terminal.
17. The device according to claim 16, wherein The first Bluetooth device verification sub-module includes: The pairing request response data decryption unit is configured to decrypt the encrypted pairing request response data in the first notification by using the first key; The first verification passed unit is configured to determine that the Bluetooth device passes the verification in response to successfully decrypting the encrypted pairing request response data; The first verification failed unit is configured to determine that the Bluetooth device fails to pass the verification in response to failing to decrypt the encrypted pairing request response data.
18. The device according to claim 16, characterized in that, The public key acquisition module includes: The device information receiving sub-module is configured to receive the device information of the Bluetooth device sent by the Bluetooth device; The Bluetooth device public key acquisition sub-module is configured to acquire the Bluetooth device public key corresponding to the device information in the server.
19. The device according to claim 15, characterized in that, The device further includes: The instruction sending module is configured to send an instruction for deleting the combined information to the server in response to meeting the condition of the combined information, so that the server deletes the combined information stored internally according to the instruction.
20. A Bluetooth device pairing apparatus, characterized in that, Applied to a Bluetooth device, the device includes: The second terminal verification module is configured to verify the second terminal according to the Bluetooth device private key of the Bluetooth device and the terminal public key after receiving the terminal public key sent by the second terminal; The first notification sending module is configured to send a first notification to the second terminal in response to the second terminal passing the verification, where the first notification includes the MAC address of the Bluetooth device, so that the second terminal, after determining that the Bluetooth device passes the verification according to the terminal private key of the second terminal and the Bluetooth device public key of the Bluetooth device, sends a Bluetooth pairing request to the Bluetooth device according to the MAC address included in the first notification, and the Bluetooth pairing request triggers the second terminal to generate a first verification code and the Bluetooth device to generate a second verification code; The verification code receiving module is configured to receive the encrypted first verification code sent by the second terminal, where the encrypted first verification code is obtained by the second terminal encrypting the first verification code by using a first key, and the first key is generated according to the terminal private key of the second terminal and the Bluetooth device public key; The verification code decryption sub-module is configured to decrypt the encrypted first verification code by using a second key, and the second key is generated according to the terminal public key of the second terminal and the Bluetooth device private key; A decryption result judgment sub-module, configured to determine whether the decryption result is consistent with the second verification code; A second verification passed sub-module, configured to determine that the second terminal passes the verification if they are consistent; A second verification failed sub-module, configured to determine that the second terminal fails the verification if they are inconsistent; A second notification sending module, configured to send a second notification to the second terminal in response to the second terminal passing the verification. The second notification is used to trigger the second terminal to verify the Bluetooth device according to the first verification code. In response to the Bluetooth device passing the verification, it is determined that the second terminal and the Bluetooth device are successfully paired. The second notification includes the encrypted second verification code, and the encrypted second verification code is obtained by encrypting the second verification code using the second key.
21. The device according to claim 20, characterized in that, The device further includes: A request data receiving module, configured to receive the terminal public key and the encrypted pairing request data sent by the second terminal. The encrypted pairing request data is data obtained by the second terminal generating the first key according to the terminal private key and the Bluetooth device public key and encrypting the pairing request data using the first key; The second terminal verification module includes: A second key generation sub-module, configured to generate the second key according to the Bluetooth device private key and the terminal public key; A request data decryption sub-module, configured to decrypt the encrypted pairing request data using the second key; A first verification passed sub-module, configured to determine that the second terminal passes the verification in response to successfully decrypting the encrypted pairing request data; A first verification failed sub-module, configured to determine that the second terminal fails the verification in response to failing to decrypt the encrypted pairing request data.
22. The device according to claim 20, wherein The device further includes: An encrypted key receiving module, configured to receive the encrypted key sent by the second terminal. The encrypted key is data obtained by the second terminal encrypting the key using the first key after determining that the second terminal and the Bluetooth device are successfully paired; An encrypted key decryption module, configured to decrypt the encrypted key using the second key to obtain the key; A key storage module, configured to store the key.
23. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the method described in any one of claims 1-3, and / or, the method described in any one of claims 4-8.
24. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the method described in any one of claims 9-11.
25. A terminal, characterized in that, Including: A processor; A memory for storing processor-executable instructions; Wherein, the processor is configured to execute the instructions to implement the method described in any one of claims 1-3, and / or, the method described in any one of claims 4-8.
26. A Bluetooth device, characterized in that, Including: A processor; A memory for storing processor-executable instructions; Wherein, the processor is configured to execute the instructions to implement the method described in any one of claims 9-11.
Citation Information
Patent Citations
Method and system for equipment connection
CN104363250A
Bluetooth device pairing method and Bluetooth device
CN105610832A
Communication pairing method and communication device
CN110022320A
Bluetooth earphone, pairing connection method and device thereof, and TWS earphone
CN111629370A
Method for providing data security of smart pot apparatus based on beacon synchronization
KR1020180023578A