A pairing method and device of a vehicle-mounted Bluetooth module and a medium
By randomly generating and encrypting pairing keys in the vehicle's Bluetooth module, and using broadcast or BLE data packets to transmit and decrypt to verify identity, the problems of the vehicle's Bluetooth module being vulnerable to attacks and being affected by poor signals are solved, thereby improving security and user experience.
Patent Information
- Application Number
- CN202211625619.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-16
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2042-12-16
AI Technical Summary
The existing pairing method of the vehicle Bluetooth module can be easily cracked by attackers, resulting in low vehicle security. In addition, the network transmission method cannot transmit the pairing password in areas with poor signal, which reduces the user experience.
By randomly generating and encrypting a pairing key, adding it to a broadcast data packet or a BLE data packet and transmitting it to the terminal for decryption, authentication is performed based on the decryption result to establish Bluetooth pairing, avoiding the need to transmit the key over the network.
It improves the pairing security of the vehicle's Bluetooth module, improves vehicle safety and user experience, saves costs and resources, and avoids pairing failures caused by signal environment influences.
Smart Images

Figure CN116017433B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of Bluetooth technology, in particular to a pairing method and device of a vehicle-mounted Bluetooth module and a medium. BACKGROUND
[0002] Bluetooth Low Energy (BLE) technology is a low-cost, short-range, and interoperable robust wireless technology widely used in earphones, mobile phones, and automobiles. In the automotive field, in order to avoid the loss of the vehicle-mounted key leading to the vehicle unable to be used normally, the function of unlocking the vehicle door is realized by relying on Bluetooth technology.
[0003] Currently, the vehicle-mounted Bluetooth module usually realizes BLE pairing connection based on the Passkey Entry pairing mode, and uses a fixed pairing password to perform BLE connection and data interaction with other devices. However, such a mode is easy to be cracked by attackers, thereby leading to low vehicle use safety. If the pairing password is transmitted by using network transmission or other modes, although the safety can be improved, the vehicle-mounted system needs to additionally increase a communication module, thereby leading to an increase in cost. In addition, the network transmission mode has certain requirements on the quality of network signals, and in places where the signals are poor, the transmission cannot be performed, thereby leading to the vehicle door unable to be unlocked, and thereby reducing the user experience.
[0004] Therefore, how to improve the pairing safety of the vehicle-mounted Bluetooth module, thereby improving the vehicle use safety and improving the user experience, is a problem to be solved by those skilled in the art. SUMMARY
[0005] The purpose of the present application is to provide a pairing method, device and medium of a vehicle-mounted Bluetooth module, to improve the pairing safety of the vehicle-mounted Bluetooth module, thereby improving the vehicle use safety and improving the user experience.
[0006] To solve the above technical problems, the present application provides a pairing method of a vehicle-mounted Bluetooth module, comprising:
[0007] After generating a pairing key randomly, the pairing key is encrypted to obtain an encrypted key;
[0008] The encrypted key is added to a target data packet; wherein the target data packet is a broadcast data packet or a BLE data packet;
[0009] The target data packet is sent to a terminal, so that the terminal decrypts the encrypted key to obtain a pairing-to-be key;
[0010] After initiating a pairing request to the terminal, the terminal is authenticated based on the pairing-to-be key returned by the terminal, so as to establish Bluetooth pairing with the terminal according to the authentication result.
[0011] Preferably, after randomly generating the pairing key, encrypting the pairing key to obtain the encryption key includes:
[0012] Randomly generate a first set of random numbers with a first preset number of bits as a pairing key;
[0013] Performing an exclusive OR operation on the pairing key from low to high bits with the corresponding bits of the vehicle MAC address to obtain first feature data;
[0014] After adding the first feature data to the vehicle identification code according to a first preset rule to obtain second feature data, extracting the first preset number of digits from the second feature data as third feature data according to a preset extraction rule;
[0015] Randomly generating a second set of random numbers having the first preset number of digits, and combining the second set of random numbers with the third characteristic data according to a second preset rule to obtain fourth characteristic data;
[0016] After performing CRC check on the fourth characteristic data, a target check result of a second preset number of bits is selected and combined with the fourth characteristic data to obtain the encryption key.
[0017] Preferably, the terminal decrypting the encryption key to obtain the key to be paired includes:
[0018] Determining whether a target verification result exists in a verification result obtained by performing a CRC verification on the fourth characteristic data in the encryption key;
[0019] If so, deleting the target verification result from the fourth feature data and extracting the third feature data based on the second preset rule;
[0020] Based on the first preset rule and the preset extraction rule, subtracting the vehicle identification code from the third feature data to obtain the second feature data;
[0021] The second characteristic data is subjected to an exclusive OR operation with the corresponding bits of the vehicle MAC address from low to high bits to obtain the key to be paired.
[0022] Preferably, the performing identity authentication on the terminal based on the key to be paired returned by the terminal includes:
[0023] Determining whether the key to be paired is the same as the pairing key;
[0024] If they are the same, the terminal identity is determined to be legal;
[0025] If they are not the same, it is determined that the terminal identity is illegal, and the process proceeds to the step of randomly generating a pairing key and then encrypting the pairing key to obtain an encryption key.
[0026] Preferably, when the target data packet is a BLE data packet, before sending the target data packet to the terminal, the method further includes:
[0027] The broadcast data packet is sent to the terminal to establish a Bluetooth connection with the terminal.
[0028] Preferably, establishing Bluetooth pairing with the terminal according to the identity authentication result includes:
[0029] When the terminal identity is legitimate, generating a long-term key;
[0030] The long-term key is sent to the terminal to encrypt the communication link.
[0031] Preferably, the step of sending the long-term key to the terminal so as to encrypt the communication link further comprises:
[0032] After receiving the control instruction sent by the terminal, parsing the control instruction to obtain a parsing result;
[0033] The analysis result is sent to the vehicle system to control the vehicle.
[0034] In order to solve the above technical problems, the present application also provides a pairing device for a vehicle-mounted Bluetooth module, comprising:
[0035] An encryption module, configured to encrypt a randomly generated pairing key to obtain an encryption key;
[0036] A processing module, configured to add the encryption key to a target data packet; wherein the target data packet is a broadcast data packet or a BLE data packet;
[0037] A sending module, configured to send the target data packet to a terminal so that the terminal decrypts the encryption key to obtain a key to be paired;
[0038] The verification module is configured to, after initiating a pairing request to the terminal, authenticate the terminal based on the to-be-paired key returned by the terminal, so as to establish Bluetooth pairing with the terminal according to the authentication result.
[0039] In order to solve the above technical problems, the present application also provides a vehicle, comprising a memory for storing a computer program;
[0040] The processor is used to implement the steps of the vehicle-mounted Bluetooth module pairing method when executing the computer program.
[0041] To solve the above technical problems, the application also provides a computer readable storage medium, which stores a computer program, and the computer program realizes the steps of the pairing method of the vehicle-mounted Bluetooth module when executed by a processor.
[0042] The pairing method of the vehicle-mounted Bluetooth module provided by the application comprises the following steps: after generating a pairing key randomly, the pairing key is encrypted to obtain an encrypted key, and the encrypted key is added to a target data packet, wherein the target data packet is a broadcast data packet or a BLE data packet. Then, the target data packet is sent to a terminal, so that the terminal decrypts the encrypted key to obtain a pairing key to be paired, and after initiating a pairing request to the terminal, the terminal is authenticated based on the pairing key to be paired returned by the terminal, so as to establish a Bluetooth connection with the terminal according to the authentication result. As can be seen, the technical solution provided by the application improves the pairing security by randomly generating a pairing key each time the vehicle-mounted Bluetooth module is connected to the terminal, and encrypting the pairing key. In addition, the pairing key is added to the broadcast data packet or the BLE data packet and transmitted to the terminal for decryption, without the need to additionally increase network equipment for key transmission, thereby saving cost and resources, avoiding the influence of environmental signals on the network transmission of the pairing key, and thus improving the pairing security of the vehicle-mounted Bluetooth module, the pairing success rate, and the user experience.
[0043] In addition, the application also provides a pairing device and medium of a vehicle-mounted Bluetooth module, which corresponds to the pairing method of the vehicle-mounted Bluetooth module described above, and has the same effect. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0045] Figure 1 The flowchart of the pairing method of the vehicle-mounted Bluetooth module provided by the embodiments of the application;
[0046] Figure 2 The schematic diagram of the pairing method of the vehicle-mounted Bluetooth module provided by the embodiments of the application;
[0047] Figure 3 The schematic diagram of another pairing method of the vehicle-mounted Bluetooth module provided by the embodiments of the application;
[0048] Figure 4A structural diagram of a pairing device of a vehicle-mounted Bluetooth module provided by an embodiment of the present application is shown in the figure.
[0049] Figure 5 A structural diagram of a pairing device of a vehicle-mounted Bluetooth module provided by another embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0050] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, any other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0051] The core of the present application is to provide a pairing method, device and medium of a vehicle-mounted Bluetooth module. Each time the vehicle-mounted Bluetooth module is paired, a pairing key is randomly generated, the randomly generated pairing key is encrypted, and then the encrypted pairing key is added to a broadcast data packet or a BLE data packet and transmitted to a terminal, so that the terminal can decrypt and realize Bluetooth pairing. In this way, the transmission of the pairing key does not need to increase network equipment, avoiding the influence of signal exchange on the transmission of the pairing key, improving the transmission security of the pairing key, saving resources and costs.
[0052] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0053] BLE technology is a low-cost, short-range, and interoperable robust wireless technology, widely used in earphones, mobile phones, and automotive fields. In the automotive field, in order to avoid the loss of the vehicle-mounted key leading to the vehicle unable to be used normally, the function of unlocking the vehicle door is realized by relying on Bluetooth technology.
[0054] Currently, the vehicle-mounted Bluetooth module usually realizes BLE pairing connection based on the Passkey Entry pairing mode. When used, a fixed pairing password is used to perform BLE connection and data interaction with other devices. However, such a mode is easy to be cracked by attackers, thereby leading to low use safety of the vehicle. If the pairing password is transmitted by using network transmission or other ways, although the safety can be improved, the vehicle-mounted system needs to additionally increase a communication module, thereby leading to an increase in cost. In addition, the network transmission mode has certain requirements on the quality of network signals. In places where the signals are poor, the transmission cannot be performed, leading to the vehicle door unable to be unlocked, thereby reducing the user experience.
[0055] In order to solve the above technical problems, improve the pairing security of the vehicle-mounted Bluetooth module, and further improve the vehicle use safety and user experience, the embodiment of the application provides a pairing method of a vehicle-mounted Bluetooth module. When the vehicle-mounted Bluetooth module and the terminal are paired through Bluetooth, the pairing key is randomly generated, the pairing key is encrypted to improve the security of the vehicle-mounted Bluetooth use, then the encrypted pairing key is added to the broadcast data packet or the BLE data packet and transmitted to the terminal, so as to avoid the pairing failure caused by the influence of environmental signals on the transmission of the pairing key through the network, and the network equipment does not need to be additionally installed, thereby improving the Bluetooth pairing security while saving resources and costs.
[0056] Figure 1 The flowchart of the pairing method of the vehicle-mounted Bluetooth module provided by the embodiment of the application is shown in Figure 1 The method comprises the following steps:
[0057] S10: After the pairing key is randomly generated, the pairing key is encrypted to obtain an encrypted key;
[0058] In specific embodiments, the vehicle-mounted Bluetooth module is installed in the vehicle and is in a broadcast state. When the terminal is close to the vehicle and scans the broadcast signal, the target vehicle can be determined, and a request for Bluetooth pairing is initiated to the target vehicle. It should be noted that the terminal can be a mobile phone, a tablet or other equipment, and the application does not limit this, and the terminal is installed with an APP for Bluetooth pairing.
[0059] After receiving the request, the vehicle-mounted Bluetooth module randomly generates a set of pairing keys for Bluetooth pairing. It should be noted that the pairing method provided by the application is a pairing method based on Passkey Entry, therefore, the generated pairing key is a random number of a first preset number of bits. In order to avoid the pairing key being obtained by an attacker, the pairing key is encrypted by a pre-set pairing rule to obtain an encrypted key.
[0060] S11: Add the encrypted key to the target data packet; wherein the target data packet is a broadcast data packet or a BLE data packet;
[0061] S12: Send the target data packet to the terminal, so that the terminal decrypts the encrypted key to obtain a to-be-paired key;
[0062] After the encryption key is obtained through step S10, the encryption key is added to the target data packet, and the target data packet is transmitted to the terminal, wherein the target data packet is a broadcast data packet or a BLE data packet. Of course, the encryption key can also be packaged into a data packet separately, and the encryption key is transmitted to the terminal through the network. However, the network transmission needs to additionally set up a network device, thereby increasing the cost. In addition, when the vehicle-mounted Bluetooth module is located in a place with poor signal such as an underground garage, the network transmission will be affected, thereby causing the Bluetooth pairing to fail. Therefore, the encryption key is preferably added to the target data packet, and the target data packet is transmitted.
[0063] It should be noted that when the encryption key is added to the broadcast data packet, the encryption key is transmitted to the terminal in the form of a broadcast data packet when the vehicle-mounted Bluetooth module establishes a Bluetooth connection with the terminal. When the terminal receives the broadcast data packet to establish a Bluetooth connection, the encryption key can be decrypted to obtain the pairing key. When the encryption key is added to the BLE data packet for transmission, the BLE data packet needs to be sent to the terminal for decryption to obtain the pairing key after the vehicle-mounted Bluetooth module establishes a Bluetooth connection with the terminal.
[0064] S13: After initiating the pairing request to the terminal, the terminal is authenticated based on the pairing key returned by the terminal, so as to establish a Bluetooth pairing with the terminal according to the authentication result.
[0065] After the vehicle-mounted Bluetooth module establishes a Bluetooth connection with the terminal, the vehicle-mounted Bluetooth module initiates a pairing request to the terminal according to the BLE specification, and exchanges pairing characteristics when requesting, that is, determines the Bluetooth pairing method used by both parties. The pairing method used in the present application is a pairing method based on Passkey Entry. At the same time, the vehicle-mounted Bluetooth module generates a pairing key as a pairing password for identity authentication in step S10.
[0066] After initiating the pairing request, the vehicle-mounted Bluetooth module receives the pairing key returned by the terminal, that is, the result of decrypting the encryption key by the terminal. Whether the pairing password and the pairing key are the same is determined to determine whether the terminal identity is legal. When they are the same, it is determined that the terminal identity is legal, and the Bluetooth pairing is allowed to be established.
[0067] Further, after the identity authentication is passed, the vehicle-mounted Bluetooth module generates a long-term key and transmits the long-term key to the terminal, so as to encrypt the communication link, thereby realizing the whole process of Bluetooth pairing.
[0068] The pairing method of the vehicle-mounted Bluetooth module provided in the embodiments of the present application comprises: after a pairing key is randomly generated, the pairing key is encrypted to obtain an encrypted key, and the encrypted key is added to a target data packet, wherein the target data packet is a broadcast data packet or a BLE data packet. Then, the target data packet is sent to a terminal, so that the terminal decrypts the encrypted key to obtain a pairing key to be paired, and after a pairing request is initiated to the terminal, the terminal is authenticated based on the pairing key to be paired returned by the terminal, so that a Bluetooth connection is established with the terminal according to the authentication result. As can be seen, in the technical solution provided in the present application, the vehicle-mounted Bluetooth module randomly generates a pairing key each time a Bluetooth connection is established with the terminal, and the pairing key is encrypted to improve the pairing security. In addition, the pairing key is added to the broadcast data packet or the BLE data packet and transmitted to the terminal for decryption, without the need for additional network equipment for key transmission, thereby saving costs and resources, avoiding the influence of environmental signals on the network transmission of the pairing key, and thus improving the pairing security of the vehicle-mounted Bluetooth module, the pairing success rate, and the user experience.
[0069] As a preferred embodiment, after the pairing key is randomly generated, the pairing key is encrypted to obtain an encrypted key, comprising:
[0070] S20: a first group of random numbers of a first preset number of bits are randomly generated as a pairing key;
[0071] The vehicle-mounted Bluetooth module is paired with the terminal based on the Passkey Entry pairing mode, and therefore, when the vehicle-mounted Bluetooth module generates a pairing key, a random number is used as the pairing key. That is, a first group of random numbers of a first preset number of bits are randomly generated as a pairing key. For example, assuming that the first preset number of bits is 6 bits, and the randomly generated 6-bit random numbers K1-K6 are 0, 8, 2, 7, 9, and 2, respectively.
[0072] S21: the pairing key is subjected to an exclusive OR operation with the corresponding bits of the vehicle MAC address from low bits to high bits to obtain first feature data;
[0073] After the random numbers K1-K6 are obtained based on step S20, the pairing key is subjected to an exclusive OR operation with the corresponding bits of the vehicle MAC address from low bits to high bits to obtain first feature data A1-A6, that is, the sequence from K1 to K6 is subjected to an exclusive OR operation with the vehicle MAC address. For example, when the vehicle MAC address is 0x11:0x22:0x33:0x44:0x55:0x66, the first feature data A1-A6 obtained after the exclusive OR operation with the random numbers K1-K6: 0, 8, 2, 7, 9, and 2 is: 0x11, 0x2A, 0x31, 0x43, 0x5C, and 0x64.
[0074] S22: after the first feature data is added to the vehicle identification code according to the first preset rule to obtain second feature data, a number with a first preset number of digits is extracted from the second feature data as third feature data according to a preset extraction rule;
[0075] Further, after the first feature data A1-A6 is obtained, the first feature data A1-A6 is added to the vehicle identification code according to the first preset rule to obtain second feature data. It should be noted that the number of digits of the vehicle identification code is usually more than six digits, so the first preset rule can be to add the low six digits of the vehicle identification code to the first feature data A1-A6, or to add the high six digits to the first feature data A1-A6, or to add the six digits of the odd or even digits to the first feature data A1-A6. The first preset rule is not limited in the present application. In addition, it should be noted that when adding, the first feature data and the vehicle identification code are added according to the corresponding digits, for example, A1 is added to the first digit of the vehicle identification code, A2 is added to the second digit of the vehicle identification code, and so on.
[0076] It can be understood that the data after addition may overflow, so when obtaining the third feature data, a number with a first preset number of digits of 6 digits is extracted from the second feature data as the third feature data according to a preset extraction rule. Since the addition of two numbers may overflow, the preset extraction rule is to take the low bits after adding each first feature data and each vehicle identification code corresponding bit. In order to facilitate understanding, the following will be illustrated by examples.
[0077] For example, the first feature data A1 and A2 are 6 and 7 respectively, and the first digit and the second digit of the vehicle identification code are 8 and 5 respectively, so 6+8=14, take the low bit 4, 7+5=12, take the low bit 2, then the first digit B1 and the second digit B6 of the third feature data are 4 and 2 respectively.
[0078] Further, in order to facilitate understanding, another example is given. If the low six digits of the vehicle identification code are: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, then the first feature data A1-A6: 0x11, 0x2A, 0x31, 0x43, 0x5C, 0x64 is added to obtain the second feature data, and the six digits in the second feature data are selected to obtain the third feature data B1-B6, that is, the third feature data B1-B6 is: 0x12, 0x2C, 0x34, 0x47, 0x61, 0x6A.
[0079] In fact, the first feature data obtained by performing XOR processing on the random number and the vehicle MAC address, and the processing of adding the first feature data to the vehicle identification code, is essentially to disorder the randomly generated random numbers in sequence in order to improve the encryption security of the pairing key.
[0080] S23: randomly generating a second set of random numbers having a first preset number of digits, and combining the second set of random numbers with the third characteristic data according to a second preset rule to obtain fourth characteristic data;
[0081] Then, a second set of random numbers R1-R6 with a first preset number of 6 digits is generated, and the second set of random numbers R1-R6 is combined with the third characteristic data according to a second preset rule to obtain fourth characteristic data. The second preset rule can be that the third characteristic data B1-B6 are sequentially placed in odd-numbered positions, and the random numbers R1-R6 are sequentially placed in even-numbered positions, and the fourth characteristic data is combined and sorted as follows: B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6. The second preset rule may also be that the third feature data B1-B6 are sequentially placed on even-numbered positions, and the random numbers R1-R6 are sequentially placed on odd-numbered positions, and the resulting fourth feature data is: R1, B1, R2, B2, R3, B3, R4, B4, R5, B5, R6, B6. Alternatively, the third feature data B1-B6 and the random numbers R1-R6 may be cross-combined in pairs to obtain the fourth feature data: B1, B2, R1, R2, B3, B4, R3, R4, B5, B6, R5, R6. This application does not specifically limit the second preset rule.
[0082] S24: After performing CRC check on the fourth characteristic data, a target check result of a second preset number of bits is selected and combined with the fourth characteristic data to obtain an encryption key.
[0083] If step S23 uses the second preset rule to place the third feature data B1-B6 on odd bits in sequence, and the random numbers R1-R6 on even bits in sequence for combination and sorting to obtain the 12-bit fourth feature data: B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6, after performing CRC check on the 12-bit fourth feature data, the target check result of the second preset number of bits is selected and combined with the fourth feature data to obtain the encryption key.
[0084] For example, when the second preset number of bits is 4 bits, the 16-bit encryption key obtained by combining the 4-bit target check results CRC1, CRC2, CRC3, CRC4 with the fourth characteristic data B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6 is: B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6, CRC1, CRC2, CRC3, CRC4.
[0085] It should be noted that when the target check result of the second preset number of bits is combined with the fourth feature data, the fourth feature data can be in the front, or the target check result can be in the front, or the target check result can be combined in cross, and the present application does not make specific limitations.
[0086] The pairing method of the vehicle-mounted Bluetooth module provided in the embodiments of the present application improves the security of Bluetooth pairing and the security of vehicle control and improves the user experience by encrypting the pairing key after generating the pairing key at random to obtain an encrypted key.
[0087] On the basis of the above embodiments, as a preferred embodiment, the terminal decrypts the encrypted key to obtain the pairing key, which includes:
[0088] S30: determining whether a target check result exists in a check result obtained by performing CRC check on the fourth feature data in the encrypted key, and if the target check result exists, proceeding to step S31;
[0089] S31: deleting the target check result from the fourth feature data and extracting the third feature data based on the second preset rule;
[0090] In specific embodiments, after the terminal receives the encrypted key sent by the vehicle-mounted Bluetooth module, for example, in the above embodiments, the 16-bit encrypted key is B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6, CRC1, CRC2, CRC3, CRC4, and after analysis, it can be known that the 16-bit encrypted key contains 12-bit fourth feature data B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6, and contains four-bit target check results CRC1, CRC2, CRC3, CRC4, the terminal checks the 12-bit fourth feature data after analysis to obtain a check result, and determines whether the target check result CRC1, CRC2, CRC3, CRC4 in the encryption process exists in the current check result, if the target check result exists, then proceeding to step S31.
[0091] That is, the target check result CRC1, CRC2, CRC3, CRC4 is deleted from the fourth feature data first, and the third feature data is extracted based on the second preset rule in the above embodiments. For example, when the second preset rule is that the third feature data B1-B6 is sequentially placed on the odd-numbered bits, and the random number R1-R6 is sequentially placed on the even-numbered bits to obtain 12-bit fourth feature data B1, R1, B2, R2, B3, R3, B4, R4, B5, R5, B6, R6, after deleting the target check result, the number combination on the odd-numbered bits is extracted to obtain the third feature data B1-B6.
[0092] S32: subtract the vehicle identification code from the third feature data to obtain second feature data based on the first preset rule and the preset extraction rule;
[0093] After obtaining the third feature data B1-B6, subtract the vehicle identification code from the third feature data B1-B6 to obtain the second feature data based on the first preset rule. For example, in the above embodiment, the third feature data B1-B6 is: 0x12, 0x2C, 0x34, 0x47, 0x61, 0x6A, and the first preset rule is to add the low six bits of the vehicle identification code to the second feature data. At this time, subtracting the low six bits of the vehicle identification code from the third feature data B1-B6, i.e., 0x12, 0x2C, 0x34, 0x47, 0x61, 0x6A, can obtain the second feature data.
[0094] It can be understood that when the first feature data is added to the vehicle identification code and the addition result is extracted according to the preset extraction rule to obtain the third feature data, the result overflow may occur. Therefore, when decrypting, if the result is negative when subtracting the vehicle identification code based on the preset extraction rule, automatically borrow one from the ten to perform subtraction operation. In order to facilitate understanding, examples will be given below.
[0095] For example, the first feature data A1 is 6, and the first digit of the vehicle identification code is 8. When adding 6+8=14, the low bit is 4, and the first bit B1 of the third feature data is 4. When decrypting, the first bit B1 of the third feature data is subtracted from the first bit of the vehicle identification code, i.e., 4-8=-4, the result is negative, which is incorrect, so borrow one from the ten to get 14, and then perform subtraction operation, i.e., 14-8=6, and further obtain the first feature data A1=6.
[0096] S33: XOR operation is performed between the second feature data from low bit to high bit and the corresponding bits of the vehicle MAC address to obtain the pairing key to be paired.
[0097] After obtaining the second feature data based on step S32, XOR operation is performed between the second feature data from low bit to high bit and the corresponding bits of the vehicle MAC address to obtain the pairing key to be paired. For example, in the above embodiment, the vehicle MAC address is 0x11:0x22:0x33:0x44:0x55:0x66, and the second feature data is XORed with the vehicle MAC address to obtain the random number K1-K6: 0, 8, 2, 7, 9, 2, i.e., the pairing key to be paired is 0, 8, 2, 7, 9, 2.
[0098] Further, after the terminal analyzes the pairing key to be paired, the user can manually input the pairing key 0, 8, 2, 7, 9, 2 for identity verification, or the terminal can automatically input the pairing key 0, 8, 2, 7, 9, 2. In general, in order to further improve security, the user input pairing key is preferred.
[0099] The pairing method of the vehicle-mounted Bluetooth module provided in the embodiments of the present application is used to decrypt the encryption key after the terminal receives the encryption key sent by the vehicle-mounted Bluetooth module to obtain the pairing key, so as to facilitate subsequent identity verification, thereby improving the Bluetooth pairing security and ensuring the vehicle use safety.
[0100] On the basis of the above embodiments, after the terminal decrypts the encryption key, the obtained pairing key is transmitted to the vehicle-mounted Bluetooth module. At this time, the vehicle-mounted Bluetooth module judges whether the pairing key and the pairing key are the same. If they are the same, it is determined that the terminal identity is legal. If they are not the same, it is determined that the terminal identity is illegal, which may be due to the user's input error of the pairing key. Therefore, when it is determined that the terminal identity is illegal, the vehicle-mounted Bluetooth module randomly generates a pairing key again to re-perform Bluetooth pairing.
[0101] The pairing method of the vehicle-mounted Bluetooth module provided in the embodiments of the present application is used to decrypt the encryption key after the terminal receives the encryption key sent by the vehicle-mounted Bluetooth module to obtain the pairing key, so as to facilitate subsequent identity verification, thereby improving the Bluetooth pairing security and ensuring the vehicle use safety.
[0102] In specific embodiments, after it is determined that the terminal identity is legal, the vehicle-mounted Bluetooth module generates a long-term key, and the terminal and the vehicle-mounted Bluetooth module encrypt the communication link based on the long-term key. Thus, the Bluetooth pairing with the vehicle-mounted Bluetooth module is interrupted. At this time, if the user needs to control the vehicle, the terminal, such as a mobile phone, sends a control instruction to the vehicle-mounted Bluetooth module. After the vehicle-mounted Bluetooth module receives the control instruction, it analyzes the control instruction and sends the analysis result to the vehicle-mounted system to realize the control of the vehicle.
[0103] The pairing method of the vehicle-mounted Bluetooth module provided in the embodiments of the present application is used to decrypt the encryption key after the terminal receives the encryption key sent by the vehicle-mounted Bluetooth module to obtain the pairing key, so as to facilitate subsequent identity verification, thereby improving the Bluetooth pairing security and ensuring the vehicle use safety.
[0104] In specific embodiments, the encryption key can be added to the broadcast data packet and transmitted to the terminal, or can be added to the BLE data packet and transmitted to the terminal. The present application does not make any limitation in this regard.
[0105] Figure 2 A schematic diagram of a pairing method of a vehicle-mounted Bluetooth module provided in the embodiments of the present application is shown in FIG. 1. Figure 2 As shown in FIG. 1, when the encryption key is added to the broadcast data packet, the pairing method of the vehicle-mounted Bluetooth module provided in the present application includes the following steps:
[0106] S1: randomly generate a pairing key, and encrypt the generated pairing key to obtain an encrypted key;
[0107] In an implementation, the vehicle-mounted Bluetooth module is in a broadcast state, a pairing key is randomly generated based on a Passkey Entry pairing mode, and the pairing key is encrypted to obtain an encrypted key. Since the process of encrypting the encrypted key is described in detail in the above embodiment, the process is not described here.
[0108] S2: send the broadcast data packet;
[0109] S3: parse the broadcast data packet to obtain the pairing key;
[0110] In an implementation, the terminal approaches the vehicle and turns on the Bluetooth to scan the broadcast signal of the vehicle-mounted Bluetooth module. After scanning the broadcast data, the terminal sends the broadcast data packet to the terminal. At this time, the terminal decrypts the encrypted key to obtain the pairing key. The process of decrypting the encrypted key has been described in detail in the above embodiment, and is not described here.
[0111] S4: initiate a pairing request and use the randomly generated pairing key as a pairing password;
[0112] S5: exchange pairing characteristic values;
[0113] In fact, the terminal can achieve the preliminary connection of Bluetooth by parsing the broadcast data packet after receiving the broadcast data packet. At this time, the identity of the terminal needs to be further verified. The vehicle-mounted Bluetooth module initiates a pairing request and uses the randomly generated pairing key as a pairing password.
[0114] It can be understood that after initiating the pairing request, the two parties need to determine the pairing mode to be used. Therefore, after initiating the pairing request, the two parties exchange pairing characteristic values to determine the pairing mode to be used. This process is a standard process of the Bluetooth protocol, and is not described in detail in the present application.
[0115] S6: after obtaining the pairing key input by the user, send the pairing key;
[0116] S7: identity verification;
[0117] S8: send the generated long-term key;
[0118] After the two parties determine the pairing mode, and the terminal analyzes the to-be-paired key, the user inputs the to-be-paired key, at which time the terminal transmits the to-be-paired key input by the user to the vehicle-mounted Bluetooth module, so as to perform identity verification. In implementation, the terminal needs to determine whether the currently unlocked vehicle is the target vehicle, and the vehicle-mounted Bluetooth module also needs to verify whether the currently paired terminal is the target user, and when performing identity verification, the vehicle-mounted Bluetooth module determines whether the identity is legal by judging whether the set encryption key and the received to-be-paired key are the same, and if so, it is determined that the identity is legal, otherwise, it is determined that the identity is not legal.
[0119] Further, after determining that the identities of the two parties are legal, the vehicle-mounted Bluetooth module generates a long-term key and transmits the long-term key to the terminal, so as to encrypt the communication link, thereby ensuring the security of data transmission after the Bluetooth pairing is completed.
[0120] It should be noted that the vehicle-mounted Bluetooth module and the terminal perform Bluetooth pairing only the first time, after the first pairing is successful, the two parties will generate a long-term key, and in subsequent use, as long as the terminal and the vehicle-mounted Bluetooth module are both turned on the Bluetooth function when the terminal is within the preset range, that is, within the range of the broadcast signal of the vehicle-mounted Bluetooth module, automatic connection can be achieved. In fact, Bluetooth pairing is essentially encryption of the communication link, thereby ensuring that data communication between the terminal and the vehicle-mounted Bluetooth module is not monitored by a third party. After the communication link is encrypted, the terminal can control the vehicle by sending a control signal to the vehicle-mounted Bluetooth module.
[0121] Of course, when the user inputs the to-be-paired key, if the input is incorrect, that is, the identity verification fails, the long-term key cannot be generated, the Bluetooth protocol stack will automatically prompt that the Bluetooth pairing fails and the preliminary connection of Bluetooth is disconnected, at which time the user can choose to reinitiate the pairing request, and at the same time, the vehicle-mounted Bluetooth module will automatically generate a new pairing key for pairing.
[0122] Figure 3 Another pairing method of a vehicle-mounted Bluetooth module provided by an embodiment of the present application is shown in the schematic diagram. In specific embodiments, in addition to adding the encryption key to the broadcast data packet, the encryption key can also be added to the BLE data packet and transmitted to the terminal for decryption. As shown in Figure 3 The pairing method of the vehicle-mounted Bluetooth module includes the following steps:
[0123] S100: randomly generating a pairing key and encrypting the generated pairing key to obtain an encryption key;
[0124] S101: sending a broadcast data packet;
[0125] S102: sending a BLE data packet;
[0126] S103: analyzing the broadcast data packet to obtain a to-be-paired key;
[0127] S104: Initiating a pairing request and sending a randomly generated pairing key as a pairing password;
[0128] S105: Exchanging pairing feature values;
[0129] S106: After obtaining the user input with the pairing key, sending the to-be-paired key;
[0130] S107: Identity verification;
[0131] S108: Sending the generated long-term key;
[0132] Comparison Figure 2 and Figure 3 It can be seen that when the target data packet is a BLE data packet, the vehicle-mounted Bluetooth module sends a broadcast data packet to the terminal to initially establish a Bluetooth connection, and then sends a BLE data packet with an added encryption key to the terminal, so that the terminal can analyze the BLE data packet and decrypt the encryption key based on the analysis result, further perform identity verification, and implement the final Bluetooth pairing process. Since the other steps are the same as when the target data packet is a broadcast data packet, they will not be described here.
[0133] The pairing method of the vehicle-mounted Bluetooth module provided by the embodiments of the present application is based on a randomly generated pairing key, and the pairing key is encrypted and transmitted to the terminal for decryption to improve the safety of vehicle-mounted use. In addition, the pairing key is added to the broadcast data packet or the BLE data packet and transmitted to the terminal for decryption, without the need for additional network equipment for key transmission, saving cost and resources, thereby improving the pairing safety of the vehicle-mounted Bluetooth module, improving the pairing success rate, and improving the user experience.
[0134] In the above embodiments, the pairing method of the vehicle-mounted Bluetooth module is described in detail, and the present application also provides an embodiment of a pairing device of a vehicle-mounted Bluetooth module. It should be noted that the embodiments of the device part are described from two angles, one based on the functional modules and the other based on the hardware structure.
[0135] Figure 4 The structure diagram of a pairing device of a vehicle-mounted Bluetooth module provided by the embodiments of the present application is shown in Figure 4 The device comprises:
[0136] An encryption module 10 for encrypting the pairing key to obtain an encryption key after generating the pairing key randomly;
[0137] A processing module 11 for adding the encryption key to the target data packet; wherein the target data packet is a broadcast data packet or a BLE data packet;
[0138] The sending module 12 is configured to send the target data packet to the terminal, so that the terminal decrypts the encryption key to obtain the pairing key to be paired;
[0139] The verification module 13 is configured to, after initiating the pairing request to the terminal, verify the identity of the terminal based on the pairing key to be paired returned by the terminal, so as to establish the Bluetooth pairing with the terminal according to the identity verification result.
[0140] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part are described in the description of the embodiments of the method part, and are not described here.
[0141] The pairing device of the vehicle-mounted Bluetooth module provided in the embodiments of the present application comprises: after generating a pairing key randomly, the pairing key is encrypted to obtain an encryption key, and the encryption key is added to a target data packet, wherein the target data packet is a broadcast data packet or a BLE data packet. Then, the target data packet is sent to the terminal, so that the terminal decrypts the encryption key to obtain the pairing key to be paired, and after initiating the pairing request to the terminal, the identity of the terminal is verified based on the pairing key to be paired returned by the terminal, so as to establish the Bluetooth connection with the terminal according to the identity verification result. As can be seen, the technical scheme provided in the present application, the vehicle-mounted Bluetooth module generates a pairing key randomly each time the Bluetooth connection is established with the terminal, and the pairing key is encrypted to improve the pairing security. In addition, the pairing key is added to the broadcast data packet or the BLE data packet and transmitted to the terminal for decryption, without the need to increase additional network equipment for key transmission, saving cost and resources, avoiding the influence of environmental signals on the Bluetooth connection when the pairing key is transmitted through the network, thereby improving the pairing security of the vehicle-mounted Bluetooth module, improving the pairing success rate, and improving the user experience.
[0142] Figure 5 The structure diagram of a pairing device of a vehicle-mounted Bluetooth module provided in another embodiment of the present application is shown in Figure 5 The pairing device of the vehicle-mounted Bluetooth module comprises: a memory 20 for storing a computer program;
[0143] The processor 21 is configured to execute the computer program to realize the steps of the pairing method of the vehicle-mounted Bluetooth module mentioned in the above embodiments.
[0144] The pairing device of the vehicle-mounted Bluetooth module provided in the embodiments can include but is not limited to a smart phone, a tablet computer, a notebook computer or a desktop computer, etc.
[0145] The processor 21 can include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one of a hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), a programmable logic array (PLA), etc. The processor 21 can also include a main processor and a coprocessor. The main processor is a processor for processing data in a wake-up state, also referred to as a central processing unit (CPU). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 can be integrated with a graphics processor (GPU) for rendering and drawing content to be displayed by the display screen. In some embodiments, the processor 21 can further include an artificial intelligence (AI) processor for processing machine learning-related computing operations.
[0146] The memory 20 can include one or more computer-readable storage media, which can be non-transitory. The memory 20 can further include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein the computer program is loaded and executed by the processor 21, and can implement the related steps of the pairing method of the vehicle-mounted Bluetooth module disclosed in any of the preceding embodiments. In addition, the resources stored by the memory 20 can further include an operating system 202 and data 203, etc., and the storage mode can be temporary storage or permanent storage. The operating system 202 can include Windows, Unix, Linux, etc. The data 203 can include but is not limited to related data designed in the pairing method of the vehicle-mounted Bluetooth module, etc.
[0147] In some embodiments, the pairing apparatus of the vehicle-mounted Bluetooth module can further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0148] Those skilled in the art can understand that the structure shown in the above embodiments does not constitute a limitation on the pairing apparatus of the vehicle-mounted Bluetooth module, and can include more or fewer components than those shown in the drawings. Figure 5 The structure shown in the above embodiments does not constitute a limitation on the pairing apparatus of the vehicle-mounted Bluetooth module, and can include more or fewer components than those shown in the drawings.
[0149] The pairing device of the vehicle-mounted Bluetooth module provided in the embodiment of the present application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: a pairing method of the vehicle-mounted Bluetooth module.
[0150] The pairing device of the vehicle-mounted Bluetooth module provided in the embodiment of the present application randomly generates a pairing key each time the vehicle-mounted Bluetooth module establishes a Bluetooth connection with the terminal, and encrypts the pairing key to improve the pairing security. In addition, the pairing key is added to the broadcast data packet or BLE data packet and transmitted to the terminal for decryption. There is no need to add additional network equipment for key transmission, which saves costs and resources and avoids the failure of Bluetooth connection caused by environmental signals when the pairing key is transmitted over the network. This can improve the pairing security of the vehicle-mounted Bluetooth module while improving the pairing success rate and user experience.
[0151] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiment.
[0152] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium and executes all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program code.
[0153] The above is a detailed introduction to the pairing method, device and medium of a vehicle-mounted Bluetooth module provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0154] It also needs to be explained that in the present specification, the relational terms such as first and second and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
Claims
1. A method for pairing a vehicle-mounted Bluetooth module, characterized in that: include: Randomly generate a first set of random numbers with a first preset number of bits as a pairing key; Performing an exclusive OR operation on the pairing key from low to high bits with the corresponding bits of the vehicle MAC address to obtain first feature data; After adding the first characteristic data to the vehicle identification code according to a first preset rule to obtain second characteristic data, extracting the first preset number of digits from the second characteristic data as third characteristic data according to a preset extraction rule; Randomly generating a second set of random numbers having the first preset number of digits, and combining the second set of random numbers with the third characteristic data according to a second preset rule to obtain fourth characteristic data; After performing a CRC check on the fourth characteristic data, selecting a target check result of a second preset number of bits and combining it with the fourth characteristic data to obtain an encryption key; Adding the encryption key to a target data packet; wherein the target data packet is a broadcast data packet or a BLE data packet; Sending the target data packet to a terminal so that the terminal decrypts the encryption key to obtain a key to be paired; After initiating a pairing request to the terminal, the terminal is authenticated based on the to-be-paired key returned by the terminal, so as to establish Bluetooth pairing with the terminal according to the authentication result.
2. The method for pairing a vehicle-mounted Bluetooth module according to claim 1, wherein: The terminal decrypting the encryption key to obtain the key to be paired includes: Determining whether a target verification result exists in a verification result obtained by performing a CRC verification on the fourth characteristic data in the encryption key; If so, deleting the target verification result from the fourth feature data and extracting the third feature data based on the second preset rule; Based on the first preset rule and the preset extraction rule, subtracting the vehicle identification code from the third feature data to obtain the second feature data; The second characteristic data is subjected to an exclusive OR operation with the corresponding bits of the vehicle MAC address from low to high bits to obtain the key to be paired.
3. The method for pairing a vehicle-mounted Bluetooth module according to claim 1, wherein: The authenticating the terminal based on the to-be-paired key returned by the terminal includes: Determining whether the key to be paired is the same as the pairing key; If they are the same, the terminal identity is determined to be legal; If they are not the same, it is determined that the terminal identity is illegal, and the process proceeds to the step of randomly generating a pairing key and then encrypting the pairing key to obtain an encryption key.
4. The method for pairing a vehicle-mounted Bluetooth module according to claim 1, wherein: When the target data packet is a BLE data packet, before sending the target data packet to the terminal, the method further includes: The broadcast data packet is sent to the terminal to establish a Bluetooth connection with the terminal.
5. The method for pairing a vehicle-mounted Bluetooth module according to claim 3, wherein: Establishing Bluetooth pairing with the terminal according to the identity authentication result includes: When the terminal identity is legitimate, generating a long-term key; The long-term key is sent to the terminal to encrypt the communication link.
6. The method for pairing a vehicle-mounted Bluetooth module according to claim 5, wherein: After sending the long-term key to the terminal so as to encrypt the communication link, the method further includes: After receiving the control instruction sent by the terminal, parsing the control instruction to obtain a parsing result; The analysis result is sent to the vehicle system to control the vehicle.
7. A pairing device for a vehicle-mounted Bluetooth module, characterized in that: include: An encryption module, configured to randomly generate a first set of random numbers having a first preset number of bits as a pairing key; Performing an exclusive OR operation on the pairing key from low to high bits with the corresponding bits of the vehicle MAC address to obtain first feature data; After adding the first feature data to the vehicle identification code according to a first preset rule to obtain second feature data, extracting the first preset number of digits from the second feature data according to a preset extraction rule as third feature data; randomly generating a second set of random numbers of the first preset number of digits, and combining the second set of random numbers with the third feature data according to a second preset rule to obtain fourth feature data; after performing a CRC check on the fourth feature data, selecting a target check result of the second preset number of digits and combining it with the fourth feature data to obtain an encryption key; A processing module, configured to add the encryption key to a target data packet; wherein the target data packet is a broadcast data packet or a BLE data packet; A sending module, configured to send the target data packet to a terminal so that the terminal decrypts the encryption key to obtain a key to be paired; The verification module is configured to, after initiating a pairing request to the terminal, authenticate the terminal based on the to-be-paired key returned by the terminal, so as to establish Bluetooth pairing with the terminal according to the authentication result.
8. A pairing device for a vehicle-mounted Bluetooth module, characterized in that: including a memory for storing a computer program; A processor, configured to implement the steps of the method for pairing a vehicle-mounted Bluetooth module according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for pairing the in-vehicle Bluetooth module according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Vehicle, terminal communicating with the vehicle, and method of controlling the vehicle
CN112652093A