CN113301542B - Pairing connection method and device, storage medium and electronic equipment - Google Patents
Pairing connection method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN113301542B CN113301542B CN202010108239.6A CN202010108239A CN113301542B CN 113301542 B CN113301542 B CN 113301542B CN 202010108239 A CN202010108239 A CN 202010108239A CN 113301542 B CN113301542 B CN 113301542B
- Authority
- CN
- China
- Prior art keywords
- pairing
- bluetooth
- connection
- bluetooth device
- pairing function
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/06—Authentication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/11—Allocation or use of connection identifiers
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
Description
技术领域technical field
本申请涉及计算机技术领域,尤其涉及一种配对连接方法、装置、存储介质及电子设备。The present application relates to the field of computer technology, and in particular, to a pairing connection method, device, storage medium and electronic device.
背景技术Background technique
目前电子设备在与蓝牙设备第一次配对连接时,电子设备会通过所创建的临时异步面向连接(Asynchronous Connection-oriented,ACL)链路向蓝牙设备获取对方蓝牙设备支持的功能和设备名称,并在此时根据对方蓝牙设备的回复记录对方蓝牙设备是否支持SSP功能,成功获取到这些信息后再将临时ACL链路断开,即完成第一次(Remote NameRequest,RNR)RNR操作。At present, when an electronic device is paired and connected with a Bluetooth device for the first time, the electronic device will obtain the functions and device names supported by the other party's Bluetooth device from the Bluetooth device through the created temporary Asynchronous Connection-oriented (ACL) link, and At this time, record whether the other party's Bluetooth device supports the SSP function according to the reply of the other party's Bluetooth device, and then disconnect the temporary ACL link after successfully obtaining the information, that is, the first (Remote NameRequest, RNR) RNR operation is completed.
紧接着,电子设备与蓝牙设备创建正式的ACL链路,并通过该正式ACL链路再次向蓝牙设备获取对方支持的功能和设备名称,即再次执行RNR操作。并在此时根据对方蓝牙设备的回复对所记录的是否支持SSP功能进行更新,然后根据获取到对方蓝牙设备支持的功能以及更新结果来进行配对认证,在成功认证后,才会进行相应服务的连接,最终完成整个配对连接操作。Next, the electronic device and the Bluetooth device create a formal ACL link, and through the formal ACL link, obtain the functions and device names supported by the other party from the Bluetooth device again, that is, perform the RNR operation again. And at this time, according to the reply of the other party's Bluetooth device, the record whether the SSP function is supported is updated, and then the pairing authentication is performed according to the functions supported by the other party's Bluetooth device and the update result, and the corresponding service will only be performed after successful authentication. Connect, and finally complete the entire pairing connection operation.
上述配对连接过程中会进行两次RNR操作,而两次RNR所获取的信息相同,事实上,每次执行RNR操作会需要一定的时间,尤其是第一次RNR操作有时会需要1s以上才能完成,从而影响配对连接速度。In the above pairing connection process, two RNR operations will be performed, and the information obtained by the two RNRs is the same. In fact, each RNR operation will take a certain amount of time, especially the first RNR operation sometimes takes more than 1s to complete. , which affects the pairing connection speed.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种配对连接方法、装置、存储介质及电子设备,可以减少一次执行RNR操作所需要的时间,从而可以提升配对连接速度。所述技术方案如下:Embodiments of the present application provide a pairing connection method, apparatus, storage medium, and electronic device, which can reduce the time required to perform an RNR operation once, thereby improving the pairing connection speed. The technical solution is as follows:
第一方面,本申请实施例提供了一种配对连接方法,所述方法包括:In a first aspect, an embodiment of the present application provides a pairing connection method, the method comprising:
在所述电子设备与蓝牙设备首次通信时,基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;When the electronic device communicates with the Bluetooth device for the first time, obtain the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the created asynchronous connection-oriented link;
对所述电子设备与所述蓝牙设备进行安全认证,并在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述标识指示的蓝牙设备完成配对连接。Perform security authentication on the electronic device and the Bluetooth device, and after the security authentication is passed, when it is determined that the pairing function includes a secure and simple pairing function, based on the pairing connection mode corresponding to the secure and simple pairing function and the The pairing function completes the pairing connection with the Bluetooth device indicated by the identification.
第二方面,本申请实施例提供了一种配对连接装置,所述装置包括:In a second aspect, an embodiment of the present application provides a pairing connection device, the device comprising:
信息获取模块,用于在所述电子设备与蓝牙设备首次通信时,基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;an information acquisition module, configured to acquire the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the created asynchronous connection-oriented link when the electronic device communicates with the Bluetooth device for the first time;
设备配对模块,用于对所述电子设备与所述蓝牙设备进行安全认证,并在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述标识指示的蓝牙设备完成配对连接。A device pairing module is used to perform security authentication on the electronic device and the Bluetooth device, and after the security authentication is passed, when it is determined that the pairing function includes a secure and simple pairing function, based on the corresponding security and simple pairing function The pairing connection mode and the pairing function complete the pairing connection with the Bluetooth device indicated by the identifier.
第三方面,本申请实施例提供一种计算机存储介质,所述计算机存储介质存储有多条指令,所述指令适于由处理器加载并执行上述的方法步骤。In a third aspect, an embodiment of the present application provides a computer storage medium, where the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above method steps.
第四方面,本申请实施例提供一种电子设备,可包括:处理器和存储器;其中,所述存储器存储有计算机程序,所述计算机程序适于由所述处理器加载并执行上述的方法步骤。In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded by the processor and execute the above method steps .
本申请一些实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by some embodiments of the present application include at least:
在本申请实施例中,在所述电子设备与蓝牙设备首次通信时,基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识,并对所述电子设备与所述蓝牙设备进行安全认证,在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述标识指示的蓝牙设备完成配对连接。通过将创建正式ACL之前执行的RNR操作与创建正式ACL之后执行的RNR操作整合成一次,删除冗余的操作,可以减少一次执行RNR操作所需要的时间,从而可以提升配对连接速度。In the embodiment of the present application, when the electronic device communicates with the Bluetooth device for the first time, the pairing function supported by the Bluetooth device and the identity of the Bluetooth device are acquired based on the created asynchronous connection-oriented link, and the identification of the Bluetooth device is obtained. The electronic device and the Bluetooth device perform security authentication. After the security authentication is passed, when it is determined that the pairing function includes a secure and simple pairing function, based on the pairing connection mode corresponding to the secure and simple pairing function and the pairing function and all The Bluetooth device indicated by the above identifier completes the pairing connection. By integrating the RNR operation performed before the formal ACL is created and the RNR operation performed after the formal ACL is created into one, and removing redundant operations, the time required to perform the RNR operation once can be reduced, thereby improving the pairing connection speed.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1是本申请实施例提供的一种配对连接方法的流程示意图;1 is a schematic flowchart of a pairing connection method provided by an embodiment of the present application;
图2是本申请实施例提供的一种配对连接系统的架构示意图;2 is a schematic structural diagram of a pairing connection system provided by an embodiment of the present application;
图3是本申请实施例提供的一种安全认证过程的流程示意图;3 is a schematic flowchart of a security authentication process provided by an embodiment of the present application;
图4是本申请实施例提供的一种配对连接方法的流程示意图;4 is a schematic flowchart of a pairing connection method provided by an embodiment of the present application;
图5是本申请实施例提供的一种RNR前搜索界面的举例示意图;5 is a schematic diagram of an example of a pre-RNR search interface provided by an embodiment of the present application;
图6是本申请实施例提供的一种RNR后搜索界面的举例示意图;6 is a schematic diagram of an example of a post-RNR search interface provided by an embodiment of the present application;
图7是本申请实施例提供的一种配对连接装置的结构示意图;7 is a schematic structural diagram of a pairing connection device provided by an embodiment of the present application;
图8是本申请实施例提供的一种配对连接装置的结构示意图;8 is a schematic structural diagram of a pairing connection device provided by an embodiment of the present application;
图9是本申请实施例提供的一种电子设备的结构示意图。FIG. 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施例方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application, as recited in the appended claims.
在本申请的描述中,需要理解的是,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。此外,在本申请的描述中,除非另有说明,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In the description of the present application, it should be understood that the terms "first", "second" and the like are used for descriptive purposes only, and should not be construed as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood in specific situations. Also, in the description of the present application, unless otherwise specified, "a plurality" means two or more. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. The character "/" generally indicates that the associated objects are an "or" relationship.
下面将结合附图1-附图6,对本申请实施例提供的配对连接方法进行详细介绍。该方法可依赖于计算机程序实现,可运行于基于冯诺依曼体系的配对连接装置上。该计算机程序可集成在应用中,也可作为独立的工具类应用运行。其中,本申请实施例中的配对连接装置可以为电子设备。The pairing connection method provided by the embodiment of the present application will be described in detail below with reference to FIG. 1 to FIG. 6 . The method can be implemented by relying on a computer program, and can be run on a paired connection device based on the von Neumann system. The computer program can be integrated into an application or run as a stand-alone utility application. Wherein, the pairing and connecting device in the embodiment of the present application may be an electronic device.
请参见图1,为本申请实施例提供的一种配对连接方法的流程示意图。如图1所示,本申请实施例的所述方法可以包括以下步骤:Please refer to FIG. 1 , which is a schematic flowchart of a pairing connection method provided by an embodiment of the present application. As shown in FIG. 1 , the method of the embodiment of the present application may include the following steps:
S101,在所述电子设备与蓝牙设备首次通信时,基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;S101, when the electronic device communicates with a Bluetooth device for the first time, obtain a pairing function supported by the Bluetooth device and an identifier of the Bluetooth device based on the created asynchronous connection-oriented link;
为了保证使用的方便性,以配对的形式完成两个蓝牙设备之间的首次通信认证。经过配对,设备之间以PIN码建立约定的链路密钥,经配对之后,后续的通信连接就不必每次都要配对,只需要认证就可以根据该链路密钥建立连接。所以不配对,两个设备之间便无法建立认证关系,无法进行连接及其之后的操作,通过配对在一定程度上保证了蓝牙通信的安全。In order to ensure the convenience of use, the first communication authentication between two Bluetooth devices is completed in the form of pairing. After pairing, a PIN code is used to establish an agreed link key between devices. After pairing, the subsequent communication connection does not need to be paired every time, and only requires authentication to establish a connection based on the link key. Therefore, without pairing, the authentication relationship cannot be established between the two devices, and the connection and subsequent operations cannot be performed. The security of Bluetooth communication is guaranteed to a certain extent through pairing.
在本申请实施例中,其中一个设备为电子设备,另一个设备为蓝牙设备。两设备均具有蓝牙功能,且可完成配对连接连接。In this embodiment of the present application, one of the devices is an electronic device, and the other device is a Bluetooth device. Both devices have Bluetooth function and can complete the pairing connection.
如图2所示,系统架构100可以包括电子设备101、102、103中的一种或多种,蓝牙网络104和蓝牙设备105。蓝牙网络104用以在电子设备101、102、103和蓝牙设备105之间提供通信链路的介质。As shown in FIG. 2 , the
其中,蓝牙是一种支持设备短距离通信(一般10m内)的无线电技术,能在包括移动电话、PDA、无线耳机、笔记本电脑、相关外设等众多设备之间进行无线信息交换。利用蓝牙技术,能够有效地简化终端设备之间的通信,也能够成功地简化设备与因特网Internet之间的通信,从而使得数据传输变得更加迅速高效,为无线通信拓宽道路。Among them, Bluetooth is a radio technology that supports short-distance communication (generally within 10m) of devices, and can exchange wireless information among many devices including mobile phones, PDAs, wireless headsets, notebook computers, and related peripherals. The use of Bluetooth technology can effectively simplify the communication between terminal devices, and can also successfully simplify the communication between the device and the Internet, so that data transmission becomes more rapid and efficient, and the road for wireless communication is widened.
应该理解,图2中的电子设备、蓝牙网络和蓝牙设备的数目仅仅是示意性的。根据实现需要,可以具有任意数目的电子设备、蓝牙网络和蓝牙设备。比如蓝牙设备105可以是多个蓝牙设备组成的蓝牙设备集群或多个独立的在一定距离范围内的蓝牙设备等。It should be understood that the numbers of electronic devices, Bluetooth networks and Bluetooth devices in FIG. 2 are merely illustrative. There may be any number of electronic devices, Bluetooth networks, and Bluetooth devices depending on the implementation needs. For example, the
用户可以使用电子设备101、102、103通过蓝牙网络104与蓝牙设备105交互,以接收或发送消息等。电子设备101、102、103可以是具有显示屏的各种电子设备,包括但不限于智能手机、平板电脑、便携式计算机、台式计算机、蓝牙耳机、蓝牙车载、蓝牙耳机、蓝牙MP3、蓝牙闪存盘、蓝牙适配器、蓝牙网关、蓝牙CF卡等等。所述蓝牙设备可以包括但不限于蓝牙耳机、蓝牙车载、蓝牙耳机、蓝牙MP3、蓝牙闪存盘、蓝牙适配器、蓝牙网关、蓝牙CF卡等等。The user may use the
在电子设备与蓝牙设备配对时,首先需要创建ACL链路。在ACL链路创建完成后,电子设备通过该链路向蓝牙设备获取所述蓝牙设备所支持的配对功能,并通过该链路获取所述蓝牙设备的标识,以便后续基于所支持的配对功能以及设备标识完成认证及配对。所述标识用于唯一识别蓝牙设备,可以为设备名称等。可以理解的是,该标识基于蓝牙地址得到,用于展示给用户。When an electronic device is paired with a Bluetooth device, an ACL link needs to be created first. After the ACL link is created, the electronic device obtains the pairing function supported by the Bluetooth device from the Bluetooth device through the link, and obtains the identity of the Bluetooth device through the link, so as to follow-up based on the supported pairing function and The device ID is authenticated and paired. The identifier is used to uniquely identify the Bluetooth device, and may be a device name or the like. It can be understood that the identifier is obtained based on the Bluetooth address and used for displaying to the user.
其中,ACL链路是一种面向连接的蓝牙异步传输的逻辑链路。通过该链路定向发送数据包,它既支持对称连接,也支持不对称连接(即可以一对一,也可以一对多)。主设备(电子设备)负责控制链路带宽,并决定每个从设备(蓝牙设备)可以占用多少带宽和连接的对称性。从设备只有被选中时才能传送数据。ACL链路也支持接收主设备发给所有从设备的广播消息。此外,ACL链路主要用于分组数据的传送。Among them, the ACL link is a logical link of connection-oriented Bluetooth asynchronous transmission. Data packets are sent directionally through this link, which supports both symmetric and asymmetric connections (that is, one-to-one or one-to-many). The master device (electronic device) is responsible for controlling the link bandwidth and deciding how much bandwidth each slave device (Bluetooth device) can occupy and the symmetry of the connection. A slave can only transmit data when it is selected. The ACL link also supports receiving broadcast messages from the master device to all slave devices. In addition, the ACL link is mainly used for the transmission of packet data.
S102,对所述电子设备与所述蓝牙设备进行安全认证,并在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述标识指示的蓝牙设备完成配对连接。S102: Perform security authentication on the electronic device and the Bluetooth device, and after the security authentication is passed, when it is determined that the pairing function includes a secure and simple pairing function, based on the pairing connection mode corresponding to the secure and simple pairing function and The pairing function completes the pairing connection with the Bluetooth device indicated by the identification.
由于任何无线通信技术都存在被监听和破解的可能,为了保证蓝牙通信的安全性,通过认证的方式进行数据交互。Since any wireless communication technology has the possibility of being monitored and cracked, in order to ensure the security of Bluetooth communication, data exchange is carried out by means of authentication.
双向认证通过challenge-response(挑战-应答)方式。如图3所示,电子设备A为应答方,蓝牙设备B为请求方。作为应答方的A设备产生一个128位的随机数AU_RANDA,并以明文方式传送至B设备。A、B设备都用E1算法将各自得到的AU_RANDA、Kab和BD_ANDRB加密运算分别生成32位的SRESA和SRESB。B设备将结果SRESB传送给A设备,A设备比较SRESA和SRESB,如果相等,此次认证通过,否则认证不通过。执行完此次认证后,A设备和B设备的角色对换,即A设备作为请求方,B设备作为应答方,采用同样的方式进行认证。在双方认证均通过后,则确认安全认证通过。Two-way authentication is through the challenge-response (challenge-response) method. As shown in FIG. 3 , the electronic device A is the responder, and the Bluetooth device B is the requester. The A device as the responder generates a 128-bit random number AU_RANDA and transmits it to the B device in clear text. Devices A and B both use the E1 algorithm to encrypt AU_RANDA, Kab and BD_ANDRB to generate 32-bit SRESA and SRESB respectively. Device B transmits the result SRESB to device A. Device A compares SRESA and SRESB. If they are equal, the authentication passes this time, otherwise the authentication fails. After the authentication is performed, the roles of device A and device B are reversed, that is, device A is the requester and device B is the responder, and the authentication is performed in the same way. After both authentications are passed, the security authentication is confirmed.
在认证通过后,判断蓝牙设备所支持的配对功能中是否包括安全简易配对(Secure Simple Pairing,SSP)功能,若包括,则按照SSP功能对应的配对连接模式,在所支持的配对功能中确定所需的功能,与所述标识指示的蓝牙设备完成配对连接。After the authentication is passed, determine whether the pairing functions supported by the Bluetooth device include the Secure Simple Pairing (SSP) function. If so, determine the supported pairing functions according to the pairing connection mode corresponding to the SSP function. To complete the pairing connection with the bluetooth device indicated by the identifier.
SSP使用一种更加精细的机制,称为椭圆曲线密码术,避免使用PIN码作为链路密钥计算过程的一部分,而是使用极大的随机数来给链路密钥计算做种子。因此,可能的链路密钥的数量不再限于小于2^128的可能性,这远远超出了任何现实的攻击者能力,安全性较高。SSP uses a more elaborate mechanism, called elliptic curve cryptography, that avoids using a PIN code as part of the link key calculation process, and instead uses a very large random number to seed the link key calculation. Therefore, the number of possible link keys is no longer limited to the possibility of less than 2^128, which is far beyond the capabilities of any realistic attacker, and the security is high.
为了实现这一点,SSP过程开始于在两个设备之间建立不同种类的共享秘密。这个共享秘密被称为Diffie-Hellman密钥,是一个192位随机数。作为先决条件,两个设备每个都具有私钥和公钥。公共密钥是通过空中传播的,任何人都可以知道,但私钥永远不会被披露。将这两个Key称为SSP公钥/私钥对,但这些也称为Diffie-Hellman公钥/私钥对。To achieve this, the SSP process begins by establishing a different kind of shared secret between the two devices. This shared secret is called the Diffie-Hellman key and is a 192-bit random number. As a prerequisite, both devices each have a private and public key. The public key is spread over the air and can be known by anyone, but the private key is never revealed. Call these two keys SSP public/private key pairs, but these are also called Diffie-Hellman public/private key pairs.
在本申请实施例中,在电子设备与蓝牙设备第一次配对连接时,电子设备在创建ACL链路之前不再执行RNR操作,而是直接先创建ACL链路,ACL创建成功后执行获取对方蓝牙设备支持功能和RNR操作,并记录对方蓝牙设备是否支持SSP功能,然后就进行配对认证和连接服务的操作。通过将创建正式ACL之前执行的RNR操作与创建正式ACL之后执行的RNR操作整合成一次,删除冗余的操作,可以减少一次执行RNR操作所需要的时间,从而可以提升配对连接速度。In the embodiment of the present application, when the electronic device is paired and connected with the Bluetooth device for the first time, the electronic device does not perform the RNR operation before creating the ACL link, but directly creates the ACL link first. The Bluetooth device supports functions and RNR operations, and records whether the other party's Bluetooth device supports the SSP function, and then performs pairing authentication and connection service operations. By integrating the RNR operation performed before the formal ACL is created and the RNR operation performed after the formal ACL is created into one, and removing redundant operations, the time required to perform the RNR operation once can be reduced, thereby improving the pairing connection speed.
请参见图2,为本申请实施例提供的一种配对连接方法的流程示意图。该配对连接方法可以包括以下步骤:Please refer to FIG. 2 , which is a schematic flowchart of a pairing connection method provided by an embodiment of the present application. The pairing connection method may include the following steps:
S201,在所述电子设备与蓝牙设备首次通信时,在不建立临时异步面向连接链路的情况下,向所述蓝牙设备发起连接请求以创建异步面向连接链路;S201, when the electronic device communicates with the Bluetooth device for the first time, without establishing a temporary asynchronous connection-oriented link, initiate a connection request to the Bluetooth device to create an asynchronous connection-oriented link;
首先,电子设备(master,即发起连接的设备)会寻呼(page)蓝牙设备(slave,接收连接的设备),master以跳频的方式去寻呼slave,slave固定间隔地去扫描(page scan)外部寻呼,当scan到外部page时便会响应该page,这样电子设备与蓝牙设备之间便建立链路的连接,即ACL链路的连接。First, the electronic device (master, the device that initiates the connection) will page (page) the Bluetooth device (slave, the device that receives the connection), the master will page the slave by frequency hopping, and the slave will scan at regular intervals (page scan). ) external paging, when scan to an external page, it will respond to the page, so that a link connection is established between the electronic device and the Bluetooth device, that is, the connection of the ACL link.
page的超时时间最大是40.9秒,最小是0.625ms。当蓝牙设备在未超时时间内没有返回Page Response时,则返回Page Timeout事件。The maximum timeout of page is 40.9 seconds and the minimum is 0.625ms. When the Bluetooth device does not return the Page Response within the time-out period, the Page Timeout event is returned.
其中,蓝牙设备开启page scan模式,才能够相应其他蓝牙设备的连接请求。pagescan是一个状态,只有蓝牙设备处于page scan状态,电子设备才有可能连接成功。Among them, only when the Bluetooth device turns on the page scan mode, it can respond to the connection requests of other Bluetooth devices. Pagescan is a state, and only when the Bluetooth device is in the page scan state can the electronic device be connected successfully.
Page Scan包括:Page Scan Interval(寻呼扫描间隔)、Page Scan Windows(寻呼扫描窗口)和Page Scan Type(类型)三个参数。Page Scan includes: Page Scan Interval (paging scan interval), Page Scan Windows (paging scan window) and Page Scan Type (type) three parameters.
其中,Page Scan Interval表示相当于间隔多久scan一次,最大值是2560ms。Among them, the Page Scan Interval indicates how often the scan interval is equivalent, and the maximum value is 2560ms.
Page Scan Windows表示scan一次持续多长时间,这个值要小于等于Interval的值。Page Scan Windows indicates how long the scan lasts. This value should be less than or equal to the value of Interval.
Page Scan Type有两种类型,一个是强制的标准类型,另外一个是可选的Interlace(隔行扫描)类型。There are two types of Page Scan Type, one is the mandatory standard type, and the other is the optional Interlace (interlace) type.
其中,在不建立临时异步面向连接链路的情况下,不需要基于临时异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识,基于所述所支持的配对功能记录是否支持安全简易配对功能并断开所述临时异步面向连接链路。In the case where a temporary asynchronous connection-oriented link is not established, it is not necessary to obtain the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the temporary asynchronous connection-oriented link. Records whether the secure easy pairing function is supported and disconnects the temporary asynchronous connection-oriented link.
可选的,在所述电子设备与蓝牙设备首次通信时之后,还需要获取环境干扰值,当所述环境干扰值大于或者等于干扰阈值时,触发所述基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识。当所述环境干扰值小于干扰阈值时,则需要建立临时异步面向连接链路,基于所述临时异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识,基于所述所支持的配对功能记录是否支持安全简易配对功能并断开所述临时异步面向连接链路,然后再触发执行所述基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识。Optionally, after the electronic device communicates with the Bluetooth device for the first time, it is also necessary to obtain the environmental interference value, and when the environmental interference value is greater than or equal to the interference threshold, trigger the acquisition based on the asynchronous connection-oriented link created. The pairing function supported by the Bluetooth device and the identity of the Bluetooth device. When the environmental interference value is less than the interference threshold, a temporary asynchronous connection-oriented link needs to be established, and the pairing function supported by the Bluetooth device and the identity of the Bluetooth device are obtained based on the temporary asynchronous connection-oriented link. The supported pairing function records whether it supports the safe and simple pairing function and disconnects the temporary asynchronous connection-oriented link, and then triggers the execution of the acquisition of the pairing function supported by the Bluetooth device based on the created asynchronous connection-oriented link. and the identity of the Bluetooth device.
也就是说,在环境干扰较大时,采用S101-102的步骤来进行连接,由于不建立临时异步面向连接链路可以获得更快的连接速度,从而可以降低因环境干扰较大导致的连接缓慢问题。That is to say, when the environmental interference is large, the steps of S101-102 are used for connection. Since a temporary asynchronous connection-oriented link is not established, a faster connection speed can be obtained, which can reduce the slow connection caused by the large environmental interference. question.
S202,通过所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能;S202, obtain the pairing function supported by the Bluetooth device through the created asynchronous connection-oriented link;
电子设备通过所创建的ACL链路向所述蓝牙设备发送功能获取请求,并接收所述蓝牙设备基于所述功能获取请求反馈的响应消息,所述响应消息携带所述蓝牙设备所支持的配对功能。The electronic device sends a function acquisition request to the Bluetooth device through the created ACL link, and receives a response message fed back by the Bluetooth device based on the function acquisition request, where the response message carries the pairing function supported by the Bluetooth device .
S203,判断所述配对功能中是否包括安全简易配对功能并进行记录;S203, determine whether the pairing function includes a safe and simple pairing function and record it;
即遍历所接收到的配对功能,确认是否存在SSP功能,若存在,则记录为是,否则,记录为否。That is, it traverses the received pairing functions to confirm whether there is an SSP function. If it exists, it is recorded as yes, otherwise, it is recorded as no.
S204,通过所述异步面向连接链路获取所述蓝牙设备的标识;S204, obtaining the identity of the Bluetooth device through the asynchronous connection-oriented link;
通过所创建的ACL链路向所述蓝牙设备发送标识获取请求,并接收所述蓝牙设备基于所述标识获取请求反馈的所述蓝牙设备的标识。Send an identity acquisition request to the Bluetooth device through the created ACL link, and receive the identity of the Bluetooth device fed back by the Bluetooth device based on the identity acquisition request.
所述标识为设备名称。The identifier is the device name.
可以理解为,电子设备通过ACL链路基于蓝牙设备的蓝牙地址向蓝牙设备请求获取该蓝牙设备的名称,蓝牙设备接收请求后,将名称返回给电子设备进行展示,完成一次RNR(Remote Name Request)操作。用户通过该名称可以更友好地区别不同的蓝牙设备。It can be understood that the electronic device requests the Bluetooth device to obtain the name of the Bluetooth device based on the Bluetooth address of the Bluetooth device through the ACL link. After the Bluetooth device receives the request, it returns the name to the electronic device for display, completing an RNR (Remote Name Request) operate. Users can distinguish different Bluetooth devices more friendly by this name.
例如,如图5所示,电子设备向蓝牙地址为10:4E:89:9D:3B:C8的蓝牙设备请求获取设备名称,该蓝牙设备反馈至电子设备的名称为“我的耳机”,如图6所示。For example, as shown in Figure 5, the electronic device requests the device name from the Bluetooth device whose Bluetooth address is 10:4E:89:9D:3B:C8, and the name of the Bluetooth device fed back to the electronic device is "my headset", such as shown in Figure 6.
S205,基于所述标识对所述蓝牙设备进行安全认证,并在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述蓝牙设备完成配对连接;S205, perform security authentication on the Bluetooth device based on the identifier, and after the security authentication is passed, when it is determined that the pairing function includes a secure and simple pairing function, based on the pairing connection mode corresponding to the secure and simple pairing function and all The pairing function completes the pairing connection with the Bluetooth device;
双向认证采用challenge-response(挑战-应答)方式。具体认证过程可参见S102,此处不再赘述。The two-way authentication adopts the challenge-response (challenge-response) method. For the specific authentication process, reference may be made to S102, which will not be repeated here.
在认证通过后,判断蓝牙设备所支持的配对功能中是否包括SSP功能,若包括,则按照SSP功能对应的配对连接模式,在所支持的配对功能中确定所需的功能,与所述标识指示的蓝牙设备完成配对连接。After the authentication is passed, it is judged whether the pairing function supported by the Bluetooth device includes the SSP function. the Bluetooth device to complete the pairing connection.
当然,若安全认证失败,则无法完成配对连接。Of course, if the security authentication fails, the pairing connection cannot be completed.
安全配对连接模式大体上可分为两种Legacy Security Modes(1、2、3,也称Legacy Pairing)和Security Mode 4(即SSP)。设备可能同时支持Security Mode 2和Security Mode 4。The secure pairing connection mode can be roughly divided into two Legacy Security Modes (1, 2, 3, also known as Legacy Pairing) and Security Mode 4 (ie SSP). A device may support both Security Mode 2 and Security Mode 4.
这几种模式具体为:Security Mode 1:Non-secure;Security Mode 2:Servicelevel enforced security;Security Mode 3:Link level enforced security;SecurityMode 4:Service level enforced security。These modes are specifically: Security Mode 1: Non-secure; Security Mode 2: Service level enforced security; Security Mode 3: Link level enforced security; Security Mode 4: Service level enforced security.
SSP使用一种更加精细的机制,称为椭圆曲线密码术,避免使用PIN码作为链路密钥计算过程的一部分,而是使用极大的随机数来给链路密钥计算做种子。因此,可能的链路密钥的数量不再限于小于2^128的可能性,这远远超出了任何现实的攻击者能力,安全性较高。SSP是蓝牙2.0之后配对方式,一共有四种,其中Out of Band很少使用到,具体如下:SSP uses a more elaborate mechanism, called elliptic curve cryptography, that avoids using a PIN code as part of the link key calculation process, and instead uses a very large random number to seed the link key calculation. Therefore, the number of possible link keys is no longer limited to the possibility of less than 2^128, which is far beyond the capabilities of any realistic attacker, and the security is high. SSP is a pairing method after Bluetooth 2.0. There are four kinds of them. Out of Band is rarely used. The details are as follows:
Numeric Comparison:配对双方都显示一个6位的数字,由用户来核对数字是否一致,并输入Yes/No,两端Yes表示一致即可配对,可以防止中间人攻击。Numeric Comparison: Both sides of the pairing display a 6-digit number, and the user checks whether the numbers are consistent, and input Yes/No. Yes at both ends means the pairing can be done, which can prevent man-in-the-middle attacks.
使用场景:两端设备可以弹出6位十进制数,并且有yes和no按钮。Usage scenarios: Devices at both ends can pop up 6-digit decimal numbers, and have yes and no buttons.
Passkey Entry:配对目标输入一个在本地设备上显示的6位数字,输入正确即可配对,并可以防止中间人攻击。Passkey Entry: The pairing target enters a 6-digit number displayed on the local device, and the input is correct to pair and prevent man-in-the-middle attacks.
使用场景:一端设备可以显示,另一端设备可以输入。Usage scenario: One end device can display, and the other end device can input.
Just Works:不会进行鉴权,不能防止中间人攻击用于配对没有显示没有输入的设备,主动发起连接即可配对,用户看不到配对过程,不可以防止中间人攻击,例如连接蓝牙耳机。Just Works: No authentication is performed, and man-in-the-middle attacks cannot be prevented. It is used to pair devices that do not display no input. It can be paired by actively initiating a connection. The user cannot see the pairing process. It cannot prevent man-in-the-middle attacks, such as connecting a Bluetooth headset.
使用场景:用于既不能显示6位随机数,也不能输入的设备。Usage scenario: Used for devices that can neither display 6-bit random numbers nor input them.
Out of Band:两设备的通过别的途径交换配对信息,例如一些NFC蓝牙音箱。Out of Band: The two devices exchange pairing information through other means, such as some NFC Bluetooth speakers.
在本申请实施例中,当记录结果为所述配对功能中包括安全简易配对功能时,基于电子设备与蓝牙设备的具体使用场景选择配对方式。In the embodiment of the present application, when the recording result is that the pairing function includes a safe and simple pairing function, the pairing method is selected based on the specific usage scenario of the electronic device and the Bluetooth device.
S206,当确定所述配对功能中不包括所述安全简易配对功能时,基于默认配对连接模式以及所述配对功能与所述蓝牙设备完成配对连接。S206, when it is determined that the pairing function does not include the safe and simple pairing function, complete a pairing connection with the Bluetooth device based on a default pairing connection mode and the pairing function.
当不包含SSP时,则采用电子设备所支持(即Security Mode 1、Security Mode 2或Security Mode 3)的任一种配对方式进行配对。当然,若设备支持多种配对连接模式,则可按照各模式优先级的高低顺序进行选择,从而与所述蓝牙设备完成配对连接。When the SSP is not included, any pairing method supported by the electronic device (ie,
Legacy Security Modes用于蓝牙v2.0及更早版本,设备需要输入Pin Code,当双方Pin Code相同时配对成功。Pin Code通常为4个字节,如0000和1234。Legacy Security Modes are used for Bluetooth v2.0 and earlier versions. The device needs to enter the Pin Code. When the Pin Code of both parties is the same, the pairing is successful. Pin Code is usually 4 bytes, such as 0000 and 1234.
需要说明的是,通过验证,一般情况下,采用本方案,可以将第一次配对连接的速度会提升大概300ms~800ms;在极端情况下,即当周围环境干扰比较强时,采用本方案,可以将连接的速度会提升大概4s,甚至更多。It should be noted that, through verification, in general, using this solution, the speed of the first pairing connection can be increased by about 300ms to 800ms; in extreme cases, that is, when the surrounding environment interference is strong, using this solution, The speed of the connection can be increased by about 4s, or even more.
在本申请实施例中,在电子设备与蓝牙设备第一次配对连接时,电子设备在创建ACL链路之前不再执行RNR操作,而是直接先创建ACL链路,ACL创建成功后执行获取对方蓝牙设备支持功能和RNR操作,并记录对方蓝牙设备是否支持SSP功能,然后就进行配对认证和连接服务的操作。通过将创建正式ACL之前执行的RNR操作与创建正式ACL之后执行的RNR操作整合成一次,删除冗余的操作,可以减少一次执行RNR操作所需要的时间,尤其是当电子设备与蓝牙设备处于干扰比较强的环境时,可以提升配对连接速度,给用户带来更好地使用体验。In the embodiment of the present application, when the electronic device is paired and connected with the Bluetooth device for the first time, the electronic device does not perform the RNR operation before creating the ACL link, but directly creates the ACL link first. The Bluetooth device supports functions and RNR operations, and records whether the other party's Bluetooth device supports the SSP function, and then performs pairing authentication and connection service operations. By integrating the RNR operation performed before the formal ACL is created and the RNR operation performed after the formal ACL is created into one, and removing redundant operations, the time required to perform an RNR operation can be reduced, especially when the electronic device is in interference with the Bluetooth device. In a relatively strong environment, the pairing connection speed can be improved, bringing a better user experience to the user.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following are apparatus embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
请参见图7,其示出了本申请一个示例性实施例提供的配对连接装置的结构示意图。该配对连接装置可以通过软件、硬件或者两者的结合实现成为电子设备的全部或一部分。该装置1包括信息获取模块10和设备配对模块20。Please refer to FIG. 7 , which shows a schematic structural diagram of a pairing connection device provided by an exemplary embodiment of the present application. The paired connection device can be implemented as a whole or a part of the electronic device through software, hardware or a combination of the two. The
信息获取模块10,用于在所述电子设备与蓝牙设备首次通信时,基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;an
设备配对模块20,用于基于所述标识对所述蓝牙设备进行安全认证,并在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述蓝牙设备完成配对连接。The
可选的,如图8所示,所述装置还包括:Optionally, as shown in Figure 8, the device further includes:
链路建立模块30,用于在不建立临时异步面向连接链路的情况下,向所述蓝牙设备发起连接请求以创建所述异步面向连接链路。The
可选的,如图8所示,所述装置还包括:Optionally, as shown in Figure 8, the device further includes:
功能记录模块40,用于判断所述配对功能中是否包括安全简易配对功能并进行记录。The
可选的,所述信息获取模块10,具体用于:Optionally, the
通过所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能;Obtain the pairing function supported by the Bluetooth device through the created asynchronous connection-oriented link;
通过所述异步面向连接链路获取所述蓝牙设备的标识。The identity of the Bluetooth device is acquired through the asynchronous connection-oriented link.
可选的,所述信息获取模块10,具体用于:Optionally, the
通过所创建的异步面向连接链路向所述蓝牙设备发送功能获取请求;Send a function acquisition request to the Bluetooth device through the created asynchronous connection-oriented link;
接收所述蓝牙设备基于所述功能获取请求反馈的响应消息,所述响应消息携带所述蓝牙设备所支持的配对功能。A response message fed back by the Bluetooth device based on the function acquisition request is received, where the response message carries the pairing function supported by the Bluetooth device.
可选的,所述信息获取模块10,具体用于:Optionally, the
通过所创建的异步面向连接链路向所述蓝牙设备发送标识获取请求;Send an identity acquisition request to the Bluetooth device through the created asynchronous connection-oriented link;
接收所述蓝牙设备基于所述标识获取请求反馈的所述蓝牙设备的标识。The identification of the Bluetooth device that is fed back by the Bluetooth device based on the identification acquisition request is received.
可选的,所述设备配对模块20,还包括:Optionally, the
当确定所述配对功能中不包括所述安全简易配对功能时,基于默认配对连接模式以及所述配对功能与所述蓝牙设备完成配对连接。When it is determined that the pairing function does not include the secure and simple pairing function, a pairing connection is completed with the Bluetooth device based on a default pairing connection mode and the pairing function.
可选的,所述装置还包括:Optionally, the device further includes:
干扰值获取模块50,用于获取环境干扰值,当所述环境干扰值大于或者等于干扰阈值时,触发所述信息获取模块10基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;The interference
当所述环境干扰值小于干扰阈值时,建立临时异步面向连接链路,基于所述临时异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;When the environmental interference value is less than the interference threshold, establish a temporary asynchronous connection-oriented link, and obtain the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the temporary asynchronous connection-oriented link;
基于所述所支持的配对功能记录是否支持安全简易配对功能并断开所述临时异步面向连接链路,触发所述信息获取模块10基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识。Based on the supported pairing function, record whether the secure and simple pairing function is supported and disconnect the temporary asynchronous connection-oriented link, triggering the
需要说明的是,上述实施例提供的令牌验证装置在执行令牌验证方法时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的令牌验证装置与令牌验证处理方法实施例属于同一构思,其体现实现过程详见方法实施例,这里不再赘述。It should be noted that, when the token verification apparatus provided in the above embodiment executes the token verification method, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions may be allocated to different functions as required Module completion means dividing the internal structure of the device into different functional modules to complete all or part of the functions described above. In addition, the token verification apparatus and the token verification processing method embodiments provided by the above embodiments belong to the same concept, and the embodiment and implementation process thereof are detailed in the method embodiments, which will not be repeated here.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
在本申请实施例中,在电子设备与蓝牙设备第一次配对连接时,电子设备在创建ACL链路之前不再执行RNR操作,而是直接先创建ACL链路,ACL创建成功后执行获取对方蓝牙设备支持功能和RNR操作,并记录对方蓝牙设备是否支持SSP功能,然后就进行配对认证和连接服务的操作。通过将创建正式ACL之前执行的RNR操作与创建正式ACL之后执行的RNR操作整合成一次,删除冗余的操作,可以减少一次执行RNR操作所需要的时间,尤其是当电子设备与蓝牙设备处于干扰比较强的环境时,可以提升配对连接速度,给用户带来更好地使用体验。In the embodiment of the present application, when the electronic device is paired and connected with the Bluetooth device for the first time, the electronic device does not perform the RNR operation before creating the ACL link, but directly creates the ACL link first. The Bluetooth device supports functions and RNR operations, and records whether the other party's Bluetooth device supports the SSP function, and then performs pairing authentication and connection service operations. By integrating the RNR operation performed before the formal ACL is created and the RNR operation performed after the formal ACL is created into one, and removing redundant operations, the time required to perform an RNR operation can be reduced, especially when the electronic device is in interference with the Bluetooth device. In a relatively strong environment, the pairing connection speed can be improved, bringing a better user experience to the user.
本申请实施例还提供了一种计算机存储介质,所述计算机存储介质可以存储有多条指令,所述指令适于由处理器加载并执行如上述图1-图6所示实施例的方法步骤,具体执行过程可以参见图1-图6所示实施例的具体说明,在此不进行赘述。Embodiments of the present application further provide a computer storage medium, where the computer storage medium may store multiple instructions, and the instructions are suitable for being loaded by a processor and executing the method steps of the embodiments shown in the foregoing FIG. 1 to FIG. 6 . , and the specific execution process may refer to the specific description of the embodiments shown in FIG. 1 to FIG. 6 , which will not be repeated here.
请参见图9,为本申请实施例提供了一种电子设备的结构示意图。如图9所示,所述电子设备1000可以包括:至少一个处理器1001,至少一个网络接口1004,用户接口1003,存储器1005,至少一个通信总线1002。Referring to FIG. 9 , a schematic structural diagram of an electronic device is provided in an embodiment of the present application. As shown in FIG. 9 , the
其中,通信总线1002用于实现这些组件之间的连接通信。Among them, the
其中,用户接口1003可以包括显示屏(Display)、摄像头(Camera),可选用户接口1003还可以包括标准的有线接口、无线接口。The
其中,网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。Wherein, the
其中,处理器1001可以包括一个或者多个处理核心。处理器1001利用各种借口和线路连接整个电子设备1000内的各个部分,通过运行或执行存储在存储器1005内的指令、程序、代码集或指令集,以及调用存储在存储器1005内的数据,执行电子设备1000的各种功能和处理数据。可选的,处理器1001可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1001可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示屏所需要显示的内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1001中,单独通过一块芯片进行实现。The
其中,存储器1005可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。可选的,该存储器1005包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1005可用于存储指令、程序、代码、代码集或指令集。存储器1005可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现上述各个方法实施例的指令等;存储数据区可存储上面各个方法实施例中涉及到的数据等。存储器1005可选的还可以是至少一个位于远离前述处理器1001的存储装置。如图9所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及配对连接应用程序。The
在图9所示的电子设备1000中,用户接口1003主要用于为用户提供输入的接口,获取用户输入的数据;而处理器1001可以用于调用存储器1005中存储的配对连接应用程序,并具体执行以下操作:In the
在所述电子设备与蓝牙设备首次通信时,基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;When the electronic device communicates with the Bluetooth device for the first time, obtain the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the created asynchronous connection-oriented link;
基于所述标识对所述蓝牙设备进行安全认证,并在安全认证通过后,当确定所述配对功能中包括安全简易配对功能时,基于所述安全简易配对功能对应的配对连接模式以及所述配对功能与所述蓝牙设备完成配对连接。Perform security authentication on the Bluetooth device based on the identifier, and after the security authentication is passed, when it is determined that the pairing function includes a secure and simple pairing function, based on the pairing connection mode corresponding to the secure and simple pairing function and the pairing The function completes the pairing connection with the Bluetooth device.
在一个实施例中,所述处理器1001在执行基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识之前,还执行以下操作:In one embodiment, before executing the acquisition of the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the created asynchronous connection-oriented link, the
在不建立临时异步面向连接链路的情况下,向所述蓝牙设备发起连接请求以创建异步面向连接链路。Without establishing a temporary asynchronous connection-oriented link, a connection request is initiated to the Bluetooth device to create an asynchronous connection-oriented link.
在一个实施例中,所述处理器1001在执行基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识之后,还执行以下操作:In one embodiment, after the
判断所述配对功能中是否包括安全简易配对功能并进行记录。Determine whether the pairing function includes a safe and simple pairing function and record it.
在一个实施例中,所述处理器1001在执行基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识时,具体执行以下操作:In one embodiment, when the
通过所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能;Obtain the pairing function supported by the Bluetooth device through the created asynchronous connection-oriented link;
通过所述异步面向连接链路获取所述蓝牙设备的标识。The identity of the Bluetooth device is acquired through the asynchronous connection-oriented link.
在一个实施例中,所述处理器1001在执行通过所创建的异步面向连接链路获取蓝牙设备所支持的配对功能时,具体执行以下操作:In one embodiment, when the
通过所创建的异步面向连接链路向所述蓝牙设备发送功能获取请求;Send a function acquisition request to the Bluetooth device through the created asynchronous connection-oriented link;
接收所述蓝牙设备基于所述功能获取请求反馈的响应消息,所述响应消息携带所述蓝牙设备所支持的配对功能。A response message fed back by the Bluetooth device based on the function acquisition request is received, where the response message carries the pairing function supported by the Bluetooth device.
在一个实施例中,所述处理器1001在执行通过所述异步面向连接链路获取所述蓝牙设备的标识时,具体执行以下操作:In one embodiment, when the
通过所创建的异步面向连接链路向所述蓝牙设备发送标识获取请求;Send an identity acquisition request to the Bluetooth device through the created asynchronous connection-oriented link;
接收所述蓝牙设备基于所述标识获取请求反馈的所述蓝牙设备的标识。The identification of the Bluetooth device that is fed back by the Bluetooth device based on the identification acquisition request is received.
在一个实施例中,所述处理器1001还执行以下操作:In one embodiment, the
当确定所述配对功能中不包括所述安全简易配对功能时,基于默认配对连接模式以及所述配对功能与所述蓝牙设备完成配对连接。When it is determined that the pairing function does not include the secure and simple pairing function, a pairing connection is completed with the Bluetooth device based on a default pairing connection mode and the pairing function.
在一个实施例中,所述处理器1001还执行以下操作:In one embodiment, the
获取环境干扰值;Get the environmental interference value;
当所述环境干扰值大于或者等于干扰阈值时,触发所述基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;When the environmental interference value is greater than or equal to the interference threshold, triggering the acquisition of the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the created asynchronous connection-oriented link;
当所述环境干扰值小于干扰阈值时,建立临时异步面向连接链路,基于所述临时异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识;When the environmental interference value is less than the interference threshold, establish a temporary asynchronous connection-oriented link, and obtain the pairing function supported by the Bluetooth device and the identity of the Bluetooth device based on the temporary asynchronous connection-oriented link;
基于所述所支持的配对功能记录是否支持安全简易配对功能并断开所述临时异步面向连接链路,触发执行所述基于所创建的异步面向连接链路获取所述蓝牙设备所支持的配对功能以及所述蓝牙设备的标识。Based on the supported pairing function record whether the secure and simple pairing function is supported and disconnect the temporary asynchronous connection-oriented link, triggering the execution of obtaining the pairing function supported by the Bluetooth device based on the created asynchronous connection-oriented link and the identity of the Bluetooth device.
在本申请实施例中,在电子设备与蓝牙设备第一次配对连接时,电子设备在创建ACL链路之前不再执行RNR操作,而是直接先创建ACL链路,ACL创建成功后执行获取对方蓝牙设备支持功能和RNR操作,并记录对方蓝牙设备是否支持SSP功能,然后就进行配对认证和连接服务的操作。通过将创建正式ACL之前执行的RNR操作与创建正式ACL之后执行的RNR操作整合成一次,删除冗余的操作,可以减少一次执行RNR操作所需要的时间,尤其是当电子设备与蓝牙设备处于干扰比较强的环境时,可以提升配对连接速度,给用户带来更好地使用体验。In the embodiment of the present application, when the electronic device is paired and connected with the Bluetooth device for the first time, the electronic device does not perform the RNR operation before creating the ACL link, but directly creates the ACL link first. The Bluetooth device supports functions and RNR operations, and records whether the other party's Bluetooth device supports the SSP function, and then performs pairing authentication and connection service operations. By integrating the RNR operation performed before the formal ACL is created and the RNR operation performed after the formal ACL is created into one, and removing redundant operations, the time required to perform an RNR operation can be reduced, especially when the electronic device is in interference with the Bluetooth device. In a relatively strong environment, the pairing connection speed can be improved, bringing users a better experience.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体或随机存储记忆体等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. During execution, the processes of the embodiments of the above-mentioned methods may be included. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only storage memory or a random storage memory, and the like.
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。The above disclosures are only the preferred embodiments of the present application, and of course, the scope of the rights of the present application cannot be limited by this. Therefore, equivalent changes made according to the claims of the present application are still within the scope of the present application.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010108239.6A CN113301542B (en) | 2020-02-21 | 2020-02-21 | Pairing connection method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010108239.6A CN113301542B (en) | 2020-02-21 | 2020-02-21 | Pairing connection method and device, storage medium and electronic equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113301542A CN113301542A (en) | 2021-08-24 |
| CN113301542B true CN113301542B (en) | 2022-07-12 |
Family
ID=77317565
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010108239.6A Active CN113301542B (en) | 2020-02-21 | 2020-02-21 | Pairing connection method and device, storage medium and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113301542B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119516755B (en) * | 2024-11-21 | 2025-12-02 | 珠海格力电器股份有限公司 | WiFi remote control pairing methods, devices and electronic devices |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN202524388U (en) * | 2011-12-21 | 2012-11-07 | 国民技术股份有限公司 | Bluetooth pairing system and terminal |
| EP2725834A1 (en) * | 2012-10-29 | 2014-04-30 | Souffiane Houti | Method for providing a device ID of a short distance communication device to an authentication process, computer programme at short distance communication receiver |
| CN105144826A (en) * | 2013-03-27 | 2015-12-09 | 环汇系统有限公司 | System and method for secure pairing of bluetooth devices |
| WO2016108646A1 (en) * | 2014-12-30 | 2016-07-07 | 엘지전자(주) | Method and apparatus for controlling device using bluetooth le technique |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9363108B2 (en) * | 2008-06-05 | 2016-06-07 | Cisco Technology, Inc. | System for utilizing identity based on pairing of wireless devices |
| WO2016159678A1 (en) * | 2015-04-01 | 2016-10-06 | 엘지전자(주) | Method and device for controlling device using bluetooth low-power energy technology |
-
2020
- 2020-02-21 CN CN202010108239.6A patent/CN113301542B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN202524388U (en) * | 2011-12-21 | 2012-11-07 | 国民技术股份有限公司 | Bluetooth pairing system and terminal |
| EP2725834A1 (en) * | 2012-10-29 | 2014-04-30 | Souffiane Houti | Method for providing a device ID of a short distance communication device to an authentication process, computer programme at short distance communication receiver |
| CN105144826A (en) * | 2013-03-27 | 2015-12-09 | 环汇系统有限公司 | System and method for secure pairing of bluetooth devices |
| WO2016108646A1 (en) * | 2014-12-30 | 2016-07-07 | 엘지전자(주) | Method and apparatus for controlling device using bluetooth le technique |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113301542A (en) | 2021-08-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12413952B2 (en) | Method and apparatus for low energy discovery | |
| KR101697414B1 (en) | Shared network access via a peer-to-peer link | |
| US10298398B2 (en) | Peer discovery, connection, and data transfer | |
| CN108353076B (en) | Method and apparatus for Internet Key Exchange (IKE) | |
| US8601135B2 (en) | Supporting WPS sessions using TCP-based connections | |
| JP2013535860A (en) | Indirect device communication | |
| EP3275118B1 (en) | Asset authentication in a dynamic, proximity-based network of communication devices | |
| US12137094B2 (en) | Method and apparatus for secure interaction between terminals | |
| EP3794852B1 (en) | Secure methods and systems for identifying bluetooth connected devices with installed application | |
| US11212276B2 (en) | Single pairing for multiple technologies | |
| CN115669022A (en) | Method for providing ranging-based service by electronic equipment and electronic equipment | |
| CN115696323A (en) | A vehicle key update method, device and system | |
| CN113301542B (en) | Pairing connection method and device, storage medium and electronic equipment | |
| KR20230041746A (en) | Bluetooth node pairing method and related device | |
| CN110602693B (en) | Networking method and equipment of wireless network | |
| TWI641271B (en) | Access authentication method, UE and access equipment | |
| CN114793178B (en) | Distribution network method, device, equipment and storage medium | |
| WO2019011328A1 (en) | Wireless access method and device | |
| CN116847319A (en) | Device authentication networking method, communication device and readable storage medium | |
| CN110460567B (en) | A kind of identity authentication method and device | |
| WO2016165429A1 (en) | Service processing method and apparatus, and terminal | |
| CN115174062B (en) | Cloud service authentication method, device, equipment and storage medium | |
| CN120730278A (en) | Bluetooth communication method, terminal device and readable storage medium | |
| WO2023179137A1 (en) | Device communication method and related product | |
| CN106416337B (en) | Method, device and terminal for acquiring authentication information |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |