Method and Device for Establishing Connection

A method and a device for establishing a connection. The method includes the steps of: obtaining, by a group member device of a wireless device group, information about a to-be-connected device and then sending the information to a group owner device of the wireless device group, and/or transmitting, by the group member device, information about the group owner device to the to-be-connected device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other; and enabling, by the group member device, the to-be-connected device and the group owner device to share a first password, wherein the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

Skip to: Description  ·  Claims  · Patent History  ·  Patent History
Description
CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No. PCT/CN2014/079074, filed on Jun. 3, 2014, which claims priority to Chinese Patent Application No. 201310213744.7, filed on May 31, 2013, both of which are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present disclosure relates to the field of communications technologies, and in particular, to a method and a device for establishing a connection.

BACKGROUND

Currently, with the development of communications technologies, Wireless Fidelity (WiFi) functions become increasingly popular. WiFi peer to peer (P2P) may also be referred to as WiFi direct, and is a discovery and connection protocol that belongs to social WiFi. With the use of a WiFi P2P technology, direct end-to-end discovery between friends or adjacent services can still be implemented by using a WiFi function in the absence of an infrastructure (a cellular network and a hotspot). In other words, WiFi P2P requires neither a real-time connection to a server, nor a communications infrastructure in any form; instead, a user directly implements end-to-end discovery and information interaction.

With the use of the WiFi P2P technology, discovery and connection between devices mainly include the following steps: a scanning and discovery process; a group owner (GO) negotiation process after discovery; a WiFi protected setup (WPS) authentication process; and association (a four-way handshake) and communication.

Devices scan for and discover each other by using WiFi. After the discovery, a wireless device group needs to be established for the devices. To establish the wireless device group, one device needs to act as a GO, so that a GO negotiation process is required. After the group owner is determined through negotiation, the group owner authenticates a device. After the authentication succeeds, the GO issues one credential to the device, so that the device joins the wireless device group and becomes a group member of the wireless device group. A process of issuing a credential is a process of WPS authentication.

Based on WiFi P2P, after the wireless device group is established for the devices, if a user wants to connect a new device of the user to the wireless device group, the user needs to first enable the new device to scan for and discover the GO by using WiFi, and then executes a process of WPS authentication with the GO. After the authentication is completed, the new device joins the wireless device group. However, in an established wireless device group, in addition to a GO, there are many devices that have been associated with the GO. To join the wireless device group, the new device needs to scan for and discover the GO, and then executes a process of WPS authentication. During scanning and discovery, the user needs to confirm which device is the GO and often needs to approach the GO to perform an operation. However, in many cases, the GO is unreachable by the user (for example, it is inconvenient for the user to approach the GO), or the user has no idea which specific device is the GO, so the user needs to make multiple attempts. Therefore, in the prior art, when a user connects a new device to an established wireless device group, an operating procedure is complex, and efficiency is low.

SUMMARY

Embodiments of the present disclosure provide a method and a device for establishing a connection, to simplify an operating procedure of connecting a new device to an established wireless device group, thereby improving connection efficiency.

To resolve the foregoing technical problem, the embodiments of the present disclosure disclose the following technical solutions.

According to a first aspect, a method for establishing a connection is provided, where the method includes obtaining, by a group member device of a wireless device group, information about a to-be-connected device and then sending the information about the to-be-connected device to a group owner device of the wireless device group, and/or transmitting, by the group member device, information about the group owner device to the to-be-connected device, and enabling, by the group member device, the to-be-connected device and the group owner device to share a first password, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

With reference to the first aspect, in a first possible implementation manner of the first aspect, the method further includes establishing, by the group member device in a short-distance communication manner, a communication connection to the to-be-connected device; and based on the communication connection, obtaining, by the group member device, the information about the to-be-connected device and then sending the information about the to-be-connected device to the group owner device, and/or transmitting the information about the group owner device to the to-be-connected device.

With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the enabling, by the group member device, the to-be-connected device and the group owner device to share a first password includes, based on the communication connection, obtaining, by the group member device, a password of the to-be-connected device as the first password, and sending the first password to the group owner device, or, based on the communication connection, using, by the group member device, a password shared by the group member device and the group owner device as the first password, where the password shared by the group member device and the group owner device is a password generated by the group member device and then sent to the group owner device, or, is a password generated by the group owner device and then sent to the group member device, and sending the first password to the to-be-connected device, or, based on the communication connection, performing, by the group member device, authentication configuration on the to-be-connected device, where authentication configuration is a process of WPS authentication configuration, after WPS authentication configuration succeeds, sending credential information to the to-be-connected device, where the credential information includes the first password, and sending the first password to the group owner device.

With reference to the first aspect, in a third possible implementation manner of the first aspect, the obtaining, by a group member device of a wireless device group, information about a to-be-connected device includes obtaining, by the group member device of the wireless device group, the information about the to-be-connected device by scanning a dynamic two-dimensional code pre-generated by the to-be-connected device.

With reference to the first aspect the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the enabling, by the group member device, the to-be-connected device and the group owner device to share a first password includes obtaining, by the group member device, a dynamic password of the to-be-connected device by scanning the dynamic two-dimensional code pre-generated by the to-be-connected device, and sending the dynamic password as the first password to the group owner device, or, obtaining, by the group member device, a dynamic password of the to-be-connected device by scanning the dynamic two-dimensional code pre-generated by the to-be-connected device, executing, based on the dynamic password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sending credential information to the to-be-connected device, where the credential information includes the first password, and sending the first password to the group owner device.

An implementation process of the authentication configuration is, if the dynamic password is a symmetric key, the group member device executes a configuration process in an existing WPS standard on the to-be-connected device, and sends credential information to the to-be-connected device, where the credential information includes the first password, or, the group member device newly generates a password through encryption of the dynamic password and then sends an encryption result to the to-be-connected device, and the password is used as the first password, or, the to-be-connected device newly generates a password through encryption of the dynamic password and then sends an encryption result to the group member device, and the password is used as the first password; if the dynamic password is a public key of an asymmetric key, the group member device encrypts a password by using the public key and sends the encrypted password to the to-be-connected device, the password is used as the first password, and the to-be-connected device obtains the password through decryption by using a private key corresponding to the public key, or, the group member device sends a public key of the group member device to the to-be-connected device, the group member device retains a private key of the group member device, the group member device obtains a shared key through calculation by using a public key of the to-be-connected device and the private key of the group member device and using the shared key as the first password, or uses a derivative key generated based on the shared key as the first password, and the to-be-connected device obtains the shared key through calculation by using the received public key of the group member device and a private key of the to-be-connected device and uses the shared key as the first password, or uses the derivative key generated based on the shared key as the first password.

With reference to the first aspect, in a fifth possible implementation manner of the first aspect, the group member device pre-generates a dynamic two-dimensional code to be scanned by the to-be-connected device, where the dynamic two-dimensional code includes the information about the group owner device.

With reference to the first aspect, or, with reference to the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner of the first aspect, the enabling, by the group member device, the to-be-connected device and the group owner device to share a first password includes pre-generating, by the group member device, the dynamic two-dimensional code to be scanned by the to-be-connected device, where the dynamic two-dimensional code includes a dynamic password, and the dynamic password is a dynamic key generated by the group member device, and sending, by the group member device, the dynamic password as the first password to the group owner device, or, pre-generating, by the group member device, the dynamic two-dimensional code to be scanned by the to-be-connected device, where the dynamic two-dimensional code includes a dynamic password, executing, based on the dynamic password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sending credential information to the to-be-connected device, where the credential information includes the first password, and sending the first password to the group owner device, or executing, based on the dynamic password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sending, by the to-be-connected device, credential information to the group member device, where the credential information includes the first password, and sending the first password to the group owner device.

An implementation process of the authentication configuration is, if the dynamic password is a symmetric key, the group member device executes a configuration process in an existing WPS standard on the to-be-connected device, and sends credential information to the to-be-connected device, where the credential information includes the first password, or, the group member device newly generates a password through encryption of the dynamic password and then sends an encryption result to the to-be-connected device, and the password is used as the first password, or, the to-be-connected device newly generates a password through encryption of the dynamic password and then sends an encryption result to the group member device, and the password is used as the first password; if the dynamic password is a public key of an asymmetric key, the to-be-connected device encrypts a password by using the public key and sends the encrypted password to the group member device, the password is used as the first password, and the group member device obtains the password through decryption by using a private key corresponding to the public key, or, the to-be-connected device sends a public key of the to-be-connected device to the group member device, the to-be-connected device retains a private key of the to-be-connected device, the to-be-connected device obtains a shared key through calculation by using a public key of the group member device and the private key of the to-be-connected device and uses the shared key as the first password, or uses a derivative key generated based on the shared key as the first password, and the group member device obtains the shared key through calculation by using the received public key of the to-be-connected device and a private key of the group member device as the first password, or uses the derivative key generated based on the shared key as the first password, or, the group member device pre-generates a dynamic two-dimensional code to be scanned by the to-be-connected device, where a dynamic password included in the dynamic two-dimensional code is a password generated by the group owner device, and the dynamic password is used as the first password, or, the group member device pre-generates a dynamic two-dimensional code to be scanned by the to-be-connected device, where a dynamic password included in the dynamic two-dimensional code is a password generated by the group owner device, and the to-be-connected device and the group owner device perform authentication configuration based on the dynamic password, to obtain a shared key as the first password.

An implementation process of the authentication configuration is, if the dynamic password is a symmetric key, the group member device executes a configuration process in an existing WPS standard on the to-be-connected device, and sends credential information to the to-be-connected device, where the credential information includes the first password, or, the group owner device newly generates a password through encryption of the dynamic password and then sends an encryption result to the to-be-connected device, and the password is used as the first password, or, the to-be-connected device newly generates a password through encryption of the dynamic password and then sends an encryption result to the group owner device, and the password is used as the first password; if the dynamic password is a public key of an asymmetric key, the to-be-connected device encrypts a password by using the public key and sends the encrypted password to the group owner device, the password is used as the first password, and the group owner device obtains the password through decryption by using a private key corresponding to the public key, or, the to-be-connected device sends a public key of the to-be-connected device to the group owner device, the to-be-connected device retains a private key of the to-be-connected device, the to-be-connected device obtains a shared key through calculation by using a public key of the group owner device and the private key of the to-be-connected device and uses the shared key as the first password, or uses a derivative key generated based on the shared key as the first password, and the group owner device obtains the shared key through calculation by using the received public key of the to-be-connected device and a private key of the group owner device and uses the shared key as the first password, or uses the derivative key generated based on the shared key as the first password.

With reference to the first aspect, in a seventh possible implementation manner of the first aspect, the obtaining, by a group member device of a wireless device group, information about a to-be-connected device includes collecting, by the group member device of the wireless device group, a static two-dimensional code of the to-be-connected device, and obtaining the information about the to-be-connected device from the static two-dimensional code of the to-be-connected device.

With reference to the seventh possible implementation manner of the first aspect, in an eighth possible implementation manner of the first aspect, the enabling, by the group member device, the to-be-connected device and the group owner device to share a first password includes extracting, by the group member device, a password from the static two-dimensional code as the first password, and sending the first password to the group owner device, or, extracting, by the group member device, a password from the static two-dimensional code, executing, based on the password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sending credential information to the to-be-connected device, where the credential information includes the first password, and sending the first password to the group owner device.

An implementation process of the authentication configuration is, if the password is a symmetric key, the group member device executes a configuration process in an existing WPS standard on the to-be-connected device, and sends credential information to the to-be-connected device, where the credential information includes the first password, or, the group member device newly generates a password through encryption of the password and then sends an encryption result to the to-be-connected device, and the password is used as the first password, or, the to-be-connected device newly generates a password through encryption of the password and then sends an encryption result to the group member device, and the password is used as the first password; if the password is a public key of an asymmetric key, the group owner device encrypts a password by using the public key and sends the encrypted password to the to-be-connected device, the password is used as the first password, and the to-be-connected device obtains the password through decryption by using a private key corresponding to the public key, or, the group member device sends a public key of the group member device to the to-be-connected device, the group member device retains a private key of the group member device, the group member device obtains a shared key through calculation by using a public key of the group member device and the private key of the group member device and uses the shared key as the first password, or uses a derivative key generated based on the shared key as the first password, and the to-be-connected device obtains the shared key through calculation by using the received public key of the group member device and a private key of the to-be-connected device and uses the shared key as the first password, or uses the derivative key generated based on the shared key as the first password.

With reference to the first aspect, in a ninth possible implementation manner of the first aspect, the obtaining, by a group member device of a wireless device group, information about a to-be-connected device and then sending the information about the to-be-connected device to a group owner device of the wireless device group, and/or transmitting, by the group member device, information about the group owner device to the to-be-connected device includes collecting, by the group member device of the wireless device group, a personal identification number (PIN) code of the to-be-connected device; scanning for and discovering, by the group member device, the to-be-connected device according to information about the PIN code; and after the group member device scans for and discovers the to-be-connected device, obtaining, by the group member device, the information about the to-be-connected device and sending the information about the to-be-connected device to the group owner device, and/or transmitting, by the group member device, the information about the group owner device to the to-be-connected device.

With reference to the ninth possible implementation manner of the first aspect, in a tenth possible implementation manner of the first aspect, the enabling, by the group member device, the to-be-connected device and the group owner device to share a first password includes extracting, by the group member device, a password from the PIN code as the first password, and sending the first password to the group owner device, or, extracting, by the group member device, a password from the PIN code, executing, based on the password, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, sending credential information to the to-be-connected device, where the credential information includes the first password, and sending the first password to the group owner device.

With reference to the first aspect, in an eleventh possible implementation manner of the first aspect, the obtaining, by a group member device of a wireless device group, information about a to-be-connected device and then sending the information about the to-be-connected device to a group owner device of the wireless device group, and/or transmitting, by the group member device, information about the group owner device to the to-be-connected device includes collecting, by the to-be-connected device, a static two-dimensional code or a PIN code of the group member device; scanning for and discovering, by the to-be-connected device, the group member device based on the static two-dimensional code or the PIN code; and after the to-be-connected device scans for and discovers the group member device, obtaining, by the group member device, the information about the to-be-connected device and then sending the information about the to-be-connected device to the group owner device, and/or transmitting, by the group member device, the information about the group owner device to the to-be-connected device.

With reference to the eleventh possible implementation manner of the first aspect, in a twelfth possible implementation manner of the first aspect, the enabling, by the group member device, the to-be-connected device and the group owner device to share a first password includes using, by the group member device, a password in the static two-dimensional code or a password in the PIN code as the first password, and sending the first password to the group owner device, or, executing, based on the password in the static two-dimensional code or the password in the PIN code, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sending credential information to the to-be-connected device, where the credential information includes the first password, and sending the first password to the group owner device.

An implementation process of the authentication configuration may be, if the password is a symmetric key, the group member device executes a configuration process in an existing WPS standard on the to-be-connected device, and sends credential information to the to-be-connected device, where the credential information includes the first password, or, the group member device newly generates a password through encryption of the password and then sends an encryption result to the to-be-connected device, and the password is used as the first password, or, after the to-be-connected device newly generates a password through encryption of the password and then sends an encryption result to the group member device, and the password is used as the first password; if the password is a public key of an asymmetric key, the to-be-connected device encrypts a password by using the public key and sends the encrypted password to the group member device, the password is used as the first password, and the group member device obtains the password through decryption by using a private key corresponding to the public key, or, the to-be-connected device sends a public key of the to-be-connected device to the group member device, the to-be-connected device retains a private key of the to-be-connected device, the to-be-connected device obtains a shared key through calculation by using a public key of the group member device and the private key of the to-be-connected device and uses the shared key as the first password, or uses a derivative key generated based on the shared key as the first password, and the group member device obtains the shared key through calculation by using the received public key of the to-be-connected device and a private key of the group member device and uses the shared key as the first password, or uses the derivative key generated based on the shared key as the first password.

With reference to any one of the first to the twelfth possible implementation manners of the first aspect, in a thirteenth possible implementation manner of the first aspect, the first password is used as a password required by the to-be-connected device and the group owner device to execute a process of authentication configuration, or, the first password is used as a password required by the to-be-connected device and the group owner device to execute a process of handshake communication.

With reference to any one of the first to the thirteenth possible implementation manners of the first aspect, in a fourteenth possible implementation manner of the first aspect, the method further includes the following step: enabling, by at least one another group member device, the to-be-connected device and the group owner device to share a second password, where the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of authentication configuration, or, the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of handshake communication.

According to a second aspect, a method for establishing a connection is provided, where the method includes sending, by a to-be-connected device, information about the to-be-connected device to a group owner device of a wireless device group by using a group member device of the wireless device group, and/or obtaining, by the to-be-connected device, information about the group owner device by using the group member device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other; and sharing, by the to-be-connected device, a first password with the group owner device by using the group member device, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

With reference to the second aspect, in a first possible implementation manner of the second aspect, the method further includes establishing, by the to-be-connected device in a short-distance communication manner, a communication connection to the group member device; and based on the communication connection, sending, by the to-be-connected device, the information about the to-be-connected device to the group owner device by using the group member device, and/or obtaining, by the to-be-connected device, the information about the group owner device by using the group member device.

With reference to the first implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the sharing, by the to-be-connected device, a first password with the group owner device by using the group member device includes, based on the communication connection, sending, by the to-be-connected device, a password of the to-be-connected device as the first password to the group owner device by using the group member device, or, based on the communication connection, receiving, by the to-be-connected device, a password shared by the group member device and the group owner device and sent by the group member device, and using the received password as the first password, or, based on the communication connection, executing, by the to-be-connected device, a process of authentication configuration on the group member device, and after authentication configuration succeeds, receiving credential information sent by the group member device, where the credential information includes the first password, where the first password is further sent by the group member device to the group owner device.

With reference to the first or the second implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the method further includes the following step: sharing, by the to-be-connected device, a second password with the group owner device by using at least one another group member device, where the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of authentication configuration, or, the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of handshake communication.

According to a third aspect, a device for establishing a connection is provided, where the device includes an information transmission unit and a password sharing unit, where the information transmission unit is configured to obtain information about a to-be-connected device and then send the information about the to-be-connected device to a group owner device of the wireless device group, and/or transmit information about the group owner device to the to-be-connected device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other; and the password sharing unit is configured to enable the to-be-connected device and the group owner device to share a first password, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

With reference to the third aspect, in a first possible implementation manner of the third aspect, the information transmission unit is configured to establish, in a short-distance communication manner, a communication connection to the to-be-connected device, based on the communication connection, obtain the information about the to-be-connected device and then sends the information about the to-be-connected device to the group owner device, and/or transmit the information about the group owner device to the to-be-connected device.

With reference to the first implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the password sharing unit is configured to, based on the communication connection, obtain a password of the to-be-connected device as the first password, and send the first password to the group owner device, or, based on the communication connection, use a password shared by the password sharing unit with the group owner device as the first password, and send the first password to the to-be-connected device, or, based on the communication connection, execute a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

With reference to the third aspect, in a third possible implementation manner of the third aspect, the information transmission unit is configured to obtain the information about the to-be-connected device by scanning a dynamic two-dimensional code pre-generated by the to-be-connected device.

With reference to the third implementation manner of the third aspect, in a fourth possible implementation manner of the third aspect, the information transmission unit is further configured to obtain a dynamic password of the to-be-connected device by scanning the dynamic two-dimensional code pre-generated by the to-be-connected device; and the password sharing unit is configured to send the dynamic password as the first password to the group owner device, or, execute, based on the dynamic password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

With reference to the third aspect, in a fifth possible implementation manner of the third aspect, the information transmission unit is configured to pre-generate a dynamic two-dimensional code to be scanned by the to-be-connected device, where the dynamic two-dimensional code includes the information about the group owner device.

With reference to the fifth implementation manner of the third aspect, in a sixth possible implementation manner of the third aspect, the dynamic two-dimensional code further includes a dynamic password; and the password sharing unit is configured to send the dynamic password as the first password to the group owner device, or, execute, based on the dynamic password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

With reference to the third aspect, in a seventh possible implementation manner of the third aspect, the information transmission unit is configured to collect a static two-dimensional code of the to-be-connected device, and obtain the information about the to-be-connected device from the static two-dimensional code of the to-be-connected device.

With reference to the seventh implementation manner of the third aspect, in an eighth possible implementation manner of the third aspect, the password sharing unit is configured to extract a password from the static two-dimensional code as the first password, and send the first password to the group owner device, or, extract a password from the static two-dimensional code, execute, based on the password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

With reference to the third aspect, in a ninth possible implementation manner of the third aspect, the information transmission unit is configured to collect a PIN code of the to-be-connected device, scan for and discover the to-be-connected device according to information about the PIN code, and after the information transmission unit scans for and discover the to-be-connected device, obtain the information about the to-be-connected device and then send the information about the to-be-connected device to the group owner device, and/or transmit the information about the group owner device to the to-be-connected device.

With reference to the ninth implementation manner of the third aspect, in a tenth possible implementation manner of the third aspect, the password sharing unit is configured to extract a password from the PIN code as the first password, and send the first password to the group owner device, or, execute, based on the password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

With reference to the third aspect, in an eleventh possible implementation manner of the third aspect, the information transmission unit is configured to enable the to-be-connected device to scan for and discover a proxy device by collecting, by the to-be-connected device, a static two-dimensional code or a PIN code of a proxy device, and after the to-be-connected device scans for and discovers the proxy device, obtain the information about the to-be-connected device and then send the information about the to-be-connected device to the group owner device, and/or transmit the information about the group owner device to the to-be-connected device.

With reference to the eleventh implementation manner of the third aspect, in a twelfth possible implementation manner of the third aspect, the password sharing unit is configured to use a password in the static two-dimensional code or the PIN code as the first password, and send the first password to the group owner device, or, execute, based on the password in the static two-dimensional code or the PIN code, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

According to a fourth aspect, a device for establishing a connection is provided, where the device includes a communications unit and a password sharing unit, where the communications unit is configured to send information about a to-be-connected device to a group owner device of a wireless device group by using a group member device of the wireless device group, and/or obtain information about the group owner device by using the group member device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other; and the password sharing unit is configured to share a first password with the group owner device by using the group member device, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the communications unit is configured to establish, in a short-distance communication manner, a communication connection to the group member device, based on the communication connection, send information about the communications unit to the group owner device by using the group member device, and/or obtain the information about the group owner device by using the group member device.

With reference to the first implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the password sharing unit is further configured to, based on the communication connection, send a password of the password sharing unit as the first password to the group owner device by using the group member device, or, based on the communication connection, receive a password shared by the group member device and the group owner device and sent by the group member device, and use the received password as the first password, or, based on the communication connection, execute a process of authentication configuration on the group member device, and after authentication configuration succeeds, receive credential information sent by the group member device, where the credential information includes the first password, where the first password is further sent by the group member device to the group owner device.

With reference to any one of the first and the second implementation manners of the fourth aspect, in a third possible implementation manner of the fourth aspect, the password sharing unit is further configured to share a second password with the group owner device by using at least one another group member device, where the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of authentication configuration, or, the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of handshake communication.

According to the method and the device for establishing a connection that are provided by the embodiments of the present disclosure, a group member device of a wireless device group obtains information about a to-be-connected device and then sends the information about the to-be-connected device to a group owner device of the wireless device group, and/or the group member device transmits information about the group owner device to the to-be-connected device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other, and the group member device enables the to-be-connected device and the group owner device to share a first password, where the first password is used by the to-be-connected device and the group owner device to establish a connection, so that the to-be-connected device and the group owner device more quickly complete a discovery and authentication process, which simplifies an operating procedure of connecting a new device to an established wireless device group, thereby improving connection efficiency.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description show some embodiments of the present disclosure, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.

FIG. 1 is a flowchart of a method for establishing a connection according to the present disclosure;

FIG. 2 is a sequence diagram of a method for establishing a connection according to Embodiment 1 of the present disclosure;

FIG. 3 is a sequence diagram of a method for establishing a connection according to Embodiment 2 of the present disclosure;

FIG. 4 is a sequence diagram of a method for establishing a connection according to Embodiment 3 of the present disclosure;

FIG. 5 is a sequence diagram of a method for establishing a connection according to Embodiment 4 of the present disclosure;

FIG. 6 is a schematic structural diagram of modules of a device for establishing a connection according to Embodiment 5 of the present disclosure;

FIG. 7 is a schematic structural diagram of modules of a device for establishing a connection according to Embodiment 6 of the present disclosure;

FIG. 8 is a flowchart of a method for establishing a connection according to Embodiment 11 of the present disclosure;

FIG. 9 is a schematic structural diagram of modules of a device for establishing a connection according to Embodiment 12 of the present disclosure;

FIG. 10 is a structural diagram of a proxy device based on a computer system according to an embodiment of the present disclosure; and

FIG. 11 is a structural diagram of a to-be-connected device based on a computer system according to an embodiment of the present disclosure.

DETAILED DESCRIPTION

To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the following clearly describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. The described embodiments are a part rather than all of the embodiments of the present disclosure. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.

A two-dimensional code in the present disclosure may be dynamic or static, or may be a two-dimensional code in another form, and is determined as required.

FIG. 1 is a flowchart of a method for establishing a connection according to the present disclosure, and as shown in FIG. 1, the method includes the following steps.

110: A group member device of a wireless device group obtains information about a to-be-connected device and then sends the information about the to-be-connected device to a group owner device of the wireless device group.

The wireless device group includes the group owner device and the group member device, and may be a wireless local area network with a central node, such as a basic service set (BSS) network, a P2P network, or a smart grid.

The group owner device is a central node device of the wireless local area network, and may be an access point (AP) of a BSS network, or a GO of a P2P network. For a local network formed based on configuration, a group owner device is an AP with an external registrar, the AP and the external registrar are together referred to as the group owner device, and the external registrar completes an authentication function, or, the group owner device is an AP with a built-in registrar.

The group member device is a device that has established a connection to the group owner device.

120: The group member device transmits the information about the group owner device to the to-be-connected device.

130: The group member device enables the to-be-connected device and the group owner device to share a first password, where the first password is used by the to-be-connected device and the group owner device to establish a connection.

The information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other, and step 110 and step 120 are not necessarily both performed, but at least one of step 110 and step 120 is performed.

According to the method described in the present disclosure, a group member device that has established a connection to a group owner device in a wireless device group is used as a proxy device, to send information about a to-be-connected device to the group owner device, or, send information about the group owner device to the to-be-connected device, and send the first password to the group owner device after the first password is shared with the to-be-connected device, so that the to-be-connected device and the group owner device more quickly complete discovery of each other and authentication configuration, which simplifies an operating procedure of connecting a new device to an established wireless device group, thereby improving connection efficiency.

The following further describes specific implementation manners of the present disclosure in detail with reference to the accompanying drawings and the embodiments. The following embodiments are used to describe the present disclosure, but are not used to limit the scope of the present disclosure.

Embodiment 1

FIG. 2 is a sequence diagram of a method for establishing a connection according to Embodiment 1 of the present disclosure. In this embodiment, the group member device may communicate with the to-be-connected device in a near field communication (NFC) manner. NFC is both a short-distance communication method and a short-range high frequency wireless communications technology, and allows electronic devices to exchange data with each other (within ten centimeters) by performing non-contact point-to-point data transmission. In addition, the solution in this embodiment may also be implemented in a short-distance WiFi manner, and an implementation method of the short-distance WiFi manner is basically the same as that of the NFC manner, and is not separately described again.

Referring to FIG. 2, the method includes the following steps.

200: A group member device establishes a communication connection to a to-be-connected device in an NFC manner. An NFC card is disposed in the group member device and the to-be-connected device each, and when the group member device and the to-be-connected device come in contact within a short distance, both automatically establish a communication connection by using the respective NFC cards. After the communication connection is established, the group member device first sends role information of the group member device to the to-be-connected device, and the to-be-connected device may know, according to the role information, that the currently connected device is not a group owner device, and executes the following procedure. If the device connected to the to-be-connected device is the group owner device, an existing processing procedure is executed, which is not a key point of the present disclosure, and is not described again.

201: The group member device obtains information about the to-be-connected device and then sends the information about the to-be-connected device (which corresponds to 201a and 201b in FIG. 2) to the group owner device. The information about the to-be-connected device includes a device identifier of the to-be-connected device, for example, a hardware address, that is, a Media Access Control (MAC) address. Optionally, the information about the to-be-connected device may further include one or more of the following: an interface address, a P2P capacity parameter, an operating channel, a supported authentication manner, configuration timeout (where if configuration is not completed within a time, a configuration process becomes invalid), invitation flags, a group identification (ID) (P2P Group basic service set identification (BSSID)), a channel list, P2P device information (P2P Device Info), a configuration method, a status, a public key of a device, a public key hash value (public key hash) of a device, a WiFi simple configuration (WSC) parameter (WiFi simple configuration element (WSC IE), a P2P parameter (P2P IE), and the like.

202: The group member device transmits information about the group owner device to the to-be-connected device. The information about the group owner device includes an identifier of the group owner device, for example, a hardware address, that is, a MAC address. Optionally, the information about the group owner device may further include one or more of the following: an interface address, a P2P capacity parameter, an operating channel, a supported authentication manner, configuration timeout (where if configuration is not completed within a time, a configuration process becomes invalid), invitation flags, a group ID (P2P Group BSSID), a channel list, P2P device information, a configuration method, a status, a public key of a device, a public key hash value of a device, a WSC parameter (WSC IE), a P2P parameter (P2P IE), and the like.

203: The group member device enables the to-be-connected device and the group owner device to share a first password.

In this step, the group member device may obtain, based on the communication connection, a password of the to-be-connected device as the first password, and send the first password to the group owner device; or, based on the communication connection, the group member device uses a password shared by the group member device and the group owner device as the first password, and sends the first password to the to-be-connected device, and further optionally, the group member device may send the first password to the group owner device, where the password shared by the group member device and the group owner device may be pre-generated by the group member device and then sent to the group owner device, or may be pre-generated by the group owner device and then sent to the group member device; or, based on the communication connection, the group member device executes a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sends credential information to the to-be-connected device, where the credential information includes a password used by the to-be-connected device and the group owner device to perform authentication (for example, WPS authentication or a four-way handshake or both), uses the password as the first password, and sends the first password to the group owner device, where when executing the process of authentication configuration on the to-be-connected device, the group member device may use a password shared by the group member device and the group owner device or another password as an initial password required by the configuration process.

Optionally, before the sending the first password to the group owner device, the method may further include the following steps: during the process of authentication configuration, the group member device generates a public key and a public key hash value of the group member device, sends the public key and the public key hash value of the group member device to the to-be-connected device, and receives a notification of a hash authentication result obtained by the to-be-connected device according to the public key and the public key hash value of the group member device, and if hash authentication succeeds, the group member device performs the step of sending the first password to the group owner device; if hash authentication fails, ends the procedure; or, the group member device receives a public key and a public key hash value of the to-be-connected device that are generated by the to-be-connected device during the process of authentication configuration, performs hash authentication according to the public key and the public key hash value of the to-be-connected device, and if hash authentication succeeds, the group member device performs the step of sending the first password to the group owner device; if hash authentication fails, ends the procedure.

204: The to-be-connected device scans for and discovers the group owner device based on the information about the group owner device, or the group owner device scans for and discovers the to-be-connected device based on the information about the to-be-connected device.

One of steps 201 and 202 may be selected to be performed, or both of steps 201 and 202 may be performed. When step 201 is selected to be performed, step 204 is the group owner device scans for and discovers the to-be-connected device based on the information about the to-be-connected device; when step 202 is selected to be performed, step 204 is the to-be-connected device scans for and discovers the group owner device based on the information about the group owner device; when both of steps 201 and 202 are performed, because the to-be-connected device and the group owner device already have the information about each other, and the to-be-connected device and the group owner device have discovered each other, step 204 may be omitted.

205: The group owner device executes a process of authentication configuration on the to-be-connected device.

The first password may be used as an initial password for executing the process of authentication configuration in this step, and after authentication configuration ends, a new password is obtained, where the new password is used for a four-way handshake in the following step 206. In addition, the first password may be directly used for the four-way handshake in the following step 206, and in this case, step 205 may be omitted.

206: The group owner device and the to-be-connected device perform a four-way handshake, and after the four-way handshake is completed, the group owner device and the to-be-connected device successfully establish a connection.

Embodiment 2

FIG. 3 is a sequence diagram of a method for establishing a connection according to Embodiment 2 of the present disclosure. A difference between this embodiment and Embodiment 1 includes a group member device communicates with a to-be-connected device by using a dynamic two-dimensional code. A two-dimensional barcode/two-dimensional code records data symbol information by using a pepper-and-salt pattern in which geometric patterns of a specific type are distributed on a plane (in a two-dimensional direction) according to a rule. In coding, a concept of “0” and “1” bit streams that constitute an internal logic basis of a computer is skillfully utilized, several geometric shapes corresponding to a binary system are used to represent text and numerical value information, and automatic information processing is implemented through automatic reading by using an image input device or an optoelectronic scanning device. The two-dimensional barcode/two-dimensional code has some commonalities with a barcode technology: each code system has a specific character set; each character occupies a width; the two-dimensional barcode/two-dimensional code has a check function, and so on. In addition, it further has a function of automatically identifying information in different lines, and a characteristic such as rotation and changes of a processed pattern.

A dynamic two-dimensional code, for example, a Quick Response (QR) code can store more data than a common barcode, has a very low requirement during scanning, and does not require linear alignment with a scanner like during scanning of a common barcode. A QR code may dynamically store in real time large-capacity content such as business card information, including WIFI ACCESS, a document, a number, a website, and the like. The QR code is increasingly applied in fields such as e-commerce, check-in, anti-counterfeiting, and the like. A form of the QR code may be quite different from a square box that is usually black and white colors and monotonous, and many interesting and lively QR two-dimensional codes may be produced.

Referring to FIG. 3, in this figure, a group member device obtains information about a to-be-connected device by scanning a dynamic two-dimensional code pre-generated by the to-be-connected device. The method includes the following steps.

301: A group member device of a wireless device group obtains information about a to-be-connected device by scanning a dynamic two-dimensional code pre-generated by the to-be-connected device, and sends the information about the to-be-connected device (which corresponds to 301a and 301b in FIG. 3) to a group owner device of the wireless device group.

The to-be-connected device pre-generates the dynamic two-dimensional code according to a user instruction, where the dynamic two-dimensional code may include the information about the to-be-connected device and a dynamic password.

302: The group member device enables the to-be-connected device and the group owner device to share a first password.

The group member device obtains a dynamic password of the to-be-connected device by scanning the dynamic two-dimensional code pre-generated by the to-be-connected device, and sends the dynamic password as the first password to the group owner device, or, the group member device executes, based on the dynamic password of the to-be-connected device, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sends credential information to the to-be-connected device, where the credential information includes a password used by the to-be-connected device and the group owner device to perform authentication (for example, WPS authentication and/or a four-way handshake), uses the password as the first password, and sends the first password to the group owner device.

303: The group owner device scans for and discovers the to-be-connected device.

In this step of this embodiment, the group owner device has the information about the to-be-connected device, and the to-be-connected device does not have information about the group owner device. Therefore, mainly the group owner device scans for and discovers the to-be-connected device (sends a probe response to the to-be-connected device), and finally the to-be-connected device and the group owner device discover each other.

304: The group owner device executes a process of WPS authentication configuration on the to-be-connected device.

The first password may be used as an initial password for executing the process of WPS authentication configuration in this step, and after the WPS authentication configuration ends, a new password is obtained, where the new password is used for a four-way handshake in the following step 305. In addition, the first password may be directly used for the four-way handshake in the following step 305, and in this case, step 304 may be omitted.

305: The group owner device and the to-be-connected device perform a four-way handshake.

In addition, in another embodiment of the present disclosure, when the to-be-connected device scans a dynamic two-dimensional code of the group member device, the method includes the following steps.

301′: The group member device pre-generates the dynamic two-dimensional code to be scanned by the to-be-connected device, where the dynamic two-dimensional code includes the information about the group owner device and a dynamic password.

The group member device pre-generates the dynamic two-dimensional code according to a user instruction, where the dynamic two-dimensional code includes the information about the group owner device and a dynamic password of the group member device. By using this step, the group member device transmits the information about the group owner device to the to-be-connected device.

302′: The group member device enables the to-be-connected device and the group owner device to share a first password.

The group member device sends the dynamic password of the group member device as the first password to the group owner device, or, the group member device executes, based on the dynamic password of the group member device, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, sends credential information to the to-be-connected device, where the credential information includes a password used by the to-be-connected device and the group owner device to perform authentication (for example, WPS authentication and/or a four-way handshake), uses the password as the first password, and sends the first password to the group owner device.

303′: The to-be-connected device scans for and discovers the group owner device.

In this step of this embodiment, the to-be-connected device has the information about the group owner device, but the group owner device does not have the information about the to-be-connected device. Therefore, mainly the to-be-connected device scans for and discovers the group owner device (sends a probe response to the group owner device), and finally the to-be-connected device and the group owner device discovers each other.

304′: The group owner device executes a process of WPS authentication configuration on the to-be-connected device.

The first password may be used as an initial password for executing the process of WPS authentication configuration in this step, and after the WPS authentication configuration ends, a new password is obtained, where the new password is used for a four-way handshake in the following step 305′. In addition, the first password may be directly used for the four-way handshake in the following step 305′, and in this case, step 304′ may be omitted.

305′: The group owner device and the to-be-connected device perform a four-way handshake, and after the four-way handshake is completed, the group owner device and the to-be-connected device successfully establish a connection.

Embodiment 3

FIG. 4 is a sequence diagram of a method for establishing a connection according to Embodiment 3 of the present disclosure. A difference between this embodiment and Embodiment 1 includes a group member device establishes communication with a to-be-connected device by using a static two-dimensional code. A case in which the group member device establishes communication with the to-be-connected device by using a PIN code is basically the same as steps in this embodiment. However, the PIN code generally cannot be directly scanned, and needs to be manually input, which is not separately described again.

Referring to FIG. 4, when a group member device of a wireless device group scans a to-be-connected device, the method includes the following steps.

401: A group member device of a wireless device group scans a static two-dimensional code of a to-be-connected device. The static two-dimensional code includes a password and a hardware address, that is, a MAC address, of the to-be-connected device.

402: The group member device scans for and discovers the to-be-connected device according to information about the static two-dimensional code.

This step may also be replaced with the following manner. The group member device may also directly send the information about the static two-dimensional code to a group owner device, to enable the group owner device to scan for and discover the to-be-connected device according to the information about the static two-dimensional code, that is, perform the following step 406, so that the following steps 403, 404, and 405 may be omitted. However, when the group member device establishes communication with the to-be-connected device by using a PIN code, this step needs to be performed, and the following steps 403, 404, and 405 cannot be omitted either.

403: The group member device transmits information about the group owner device to the to-be-connected device.

404: The group member device obtains information about the to-be-connected device and then sends the information about the to-be-connected device (which corresponds to 404a and 404b in the figure) to the group owner device.

405: The group member device enables the to-be-connected device and the group owner device to share a first password.

In this step, the group member device may extract a password from the static two-dimensional code as the first password, and send the first password to the group owner device, or, the group member device executes, based on the password in the static two-dimensional code, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, sends credential information to the to-be-connected device, where the credential information includes a password used by the to-be-connected device and the group owner device to perform authentication (for example, WPS authentication and/or a four-way handshake), uses the password as the first password, and sends the first password to the group owner device.

406: The to-be-connected device scans for and discovers the group owner device, or the group owner device scans for and discovers the to-be-connected device.

One of steps 403 and 404 may be selected to be performed, or both of steps 403 and 404 may be performed. When step 403 is selected to be performed, step 406 is the to-be-connected device scans for and discovers the group owner device based on the information about the group owner device; when step 404 is selected to be performed, step 406 is the group owner device scans for and discovers the to-be-connected device based on the information about the to-be-connected device; when both of steps 403 and 406 are performed, because the to-be-connected device and the group owner device already have the information about each other, step 406 may be omitted.

407: The group owner device executes a process of WPS authentication configuration on the to-be-connected device.

The first password may be used as an initial password for executing the process of WPS authentication configuration in this step, and after the WPS authentication configuration ends, a new password is obtained, where the new password is used for a four-way handshake in the following step 408. In addition, the first password may be directly used for the four-way handshake in the following step 408, and in this case, step 407 may be omitted.

408: The group owner device and the to-be-connected device perform a four-way handshake, and after the four-way handshake is completed, the group owner device and the to-be-connected device successfully establish a connection.

In another embodiment of the present disclosure, when a to-be-connected device scans for a group member device of a wireless device group, the method includes the following steps.

401′: A to-be-connected device scans a static two-dimensional code of a group member device, where the static two-dimensional code includes a hardware address and a password of the group member device.

402′: The to-be-connected device scans for and discovers the group member device based on information about the static two-dimensional code of the group member device.

403′: After the to-be-connected device scans for and discovers the group member device, the group member device obtains information about the to-be-connected device and then sends the information about the to-be-connected device to a group owner device.

404′: The group member device transmits information about the group owner device to the to-be-connected device.

405′: The group member device enables the to-be-connected device and the group owner device to share a first password.

In this step, the group member device may use a password in the static two-dimensional code of the group member device as the first password, and send the first password to the group owner device, or, the group member device executes, based on the password in the static two-dimensional code of the group member device, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, sends credential information to the to-be-connected device, where the credential information includes a password used by the to-be-connected device and the group owner device to perform authentication (for example, WPS authentication and/or a four-way handshake), uses the password as the first password, and sends the first password to the group owner device.

406′: The to-be-connected device scans for and discovers the group owner device, or the group owner device scans for and discovers the to-be-connected device.

One of steps 403′ and 404′ may be selected to be performed, or both of steps 403′ and 404′ may be performed. When step 403′ is selected to be performed, step 406′ is: the group owner device scans for and discovers the to-be-connected device based on the information about the to-be-connected device; when step 404′ is selected to be performed, step 406′ is: the to-be-connected device scans for and discovers the group owner device based on the information about the group owner device; when both of steps 403′ and 404′ are performed, because the to-be-connected device and the group owner device already have the information about each other, step 406′ may be omitted.

407′: The group owner device executes a process of WPS authentication configuration on the to-be-connected device.

The first password may be used as an initial password for executing the process of WPS authentication configuration in this step, and after the WPS authentication configuration ends, a new password is obtained, where the new password is used for a four-way handshake in the following step 408′. In addition, the first password may be directly used for the four-way handshake in the following step 408′, and in this case, step 407′ may be omitted.

408′: The group owner device and the to-be-connected device perform the four-way handshake, and after the four-way handshake is completed, the group owner device and the to-be-connected device successfully establish a connection.

Embodiment 4

FIG. 5 is a sequence diagram of a method for establishing a connection according to Embodiment 4 of the present disclosure. A difference between this embodiment and Embodiment 1 includes a to-be-connected device shares a second password with at least one another group member device, to prevent an intermediate device from learning a shared password between the to-be-connected device and a group owner device and launching an attack, thereby improving communications security.

Referring to FIG. 5, the method includes the following steps.

500: A first group member device (which corresponds to a group member device 1 in FIG. 5) transmits information about a group owner device to a to-be-connected device.

501: The first group member device obtains information about the to-be-connected device and then sends the information about the to-be-connected device (which corresponds to 501a and 501b in the figure) to the group owner device of a wireless device group.

The foregoing step 500 and step 501 may not be both performed, but at least one step is performed.

The to-be-connected device may establish a communication connection to the first group member device in an NFC/short-distance WiFi manner, and perform step 500 and/or step 501 (refer to Embodiment 1 for details). Alternatively, the first group member device transmits the information about the group owner device to the to-be-connected device by using a dynamic two-dimensional code pre-generated by the first group member device (refer to Embodiment 2 for details). Alternatively, the first group member device obtains the information about the to-be-connected device by scanning a dynamic two-dimensional code pre-generated by the to-be-connected device (refer to Embodiment 2 for details). Alternatively, after scanning a static two-dimensional code or a PIN code of the to-be-connected device, the first group member device performs scanning and discovery of the to-be-connected device, and performs step 500 and/or step 501 (refer to Embodiment 3 for details). Alternatively, after scanning a static two-dimensional code or a PIN code of the first group member device, the to-be-connected device performs scanning and discovery of the first group member device, and performs step 500 and/or step 501 (refer to Embodiment 3 for details).

502: The first group member device enables the to-be-connected device and the group owner device to share a first password.

For a specific manner in which the first group member device enables the to-be-connected device and the group owner device to share the first password, refer to the foregoing Embodiments 1 to 3.

503: A second group member device (which corresponds to a group member device 2 in FIG. 5) enables the to-be-connected device and the group owner device to share a second password.

When the second group member device communicates with the to-be-connected device in an NFC manner, the second group member device may enable the to-be-connected device and the group owner device to share the second password in a manner similar to that in step 203 of Embodiment 1; when the second group member device establishes communication with the to-be-connected device by using a static two-dimensional code, the second group member device may enable the to-be-connected device and the group owner device to share the second password in a manner similar to that in step 405′ of Embodiment 3 after the to-be-connected device is scanned for and discovered. For a manner in which the second group member device enables the to-be-connected device and the group owner device to share the second password, refer to any manner in which the group member device enables the to-be-connected device and the group owner device to share the first password in Embodiments 1 to 3, and details are not described herein again. In addition, the second group member device may not transmit the information about the group owner device to the to-be-connected device or send the information about the to-be-connected device to the group owner device.

After the foregoing steps are performed, the to-be-connected device and the group owner device have two passwords each, that is, the first password and the second password, and a password shared by the to-be-connected device and the group owner device is generated based on the first password and the second password. For example, the first password and the second password are spliced to generate the password shared by the to-be-connected device and the group owner device, or corresponding conversion is performed on the first password and the second password by using a predetermined algorithm to obtain the password shared by the to-be-connected device and the group owner device. However, the first group member device and the second group member device only know one of the passwords, and therefore it is difficult to learn the password shared by the to-be-connected device and the group owner device, thereby improving communications security.

504: The to-be-connected device scans for and discovers the group owner device.

505: The group owner device executes a process of WPS authentication on the to-be-connected device.

The first password and the second password may be used as initial passwords for executing the process of WPS authentication configuration in this step, and after the WPS authentication configuration ends, a new password is obtained, where the new password is used for a four-way handshake in the following step 506. In addition, the first password and the second password may be directly used for the four-way handshake in the following step 506, and in this case, step 505 may be omitted.

506: The group owner device and the to-be-connected device perform a four-way handshake, and after the four-way handshake is completed, the group owner device and the to-be-connected device successfully establish a connection.

In addition, when the to-be-connected device shares more passwords with the group owner device by using more group member devices, for example, three group member devices, communications security between the to-be-connected device and the group owner device becomes higher, an implementation manner thereof is similar to that in the foregoing steps, and is not described again.

Embodiment 5

FIG. 6 is a schematic structural diagram of modules of a device for establishing a connection according to Embodiment 5 of the present disclosure. The device in this embodiment is a group member device selected by a to-be-connected device to establish a connection to a group owner device, that is, a proxy device. As shown in FIG. 6, the proxy device 600 includes an information transmission unit 610 and a password sharing unit 620.

The information transmission unit 610 is configured to obtain information about a to-be-connected device and then send the information about the to-be-connected device to a group owner device of a wireless device group, and/or transmit information about the group owner device to the to-be-connected device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other.

The password sharing unit 620 is configured to enable the to-be-connected device and the group owner device to share a first password, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

Embodiment 6

This embodiment is described based on Embodiment 5.

The information transmission unit 610 is configured to establish, in a short-distance communication manner, a communication connection to the to-be-connected device, based on the communication connection, the information transmission unit obtains the information about the to-be-connected device and then sends the information about the to-be-connected device to the group owner device, and/or transmit the information about the group owner device to the to-be-connected device.

The password sharing unit 620 is configured to, based on the communication connection, obtain a password of the to-be-connected device as the first password, and send the first password to the group owner device, or, based on the communication connection, use a password shared by the password sharing unit 620 and the group owner device as the first password, and send the first password to the to-be-connected device, and further optionally, the password sharing unit 620 may send the first password to the group owner device, or, based on the communication connection, execute a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

Referring to FIG. 7, optionally, the proxy device 600 may further include a hash authentication unit 630.

The hash authentication unit 630 is configured to, during the process of WPS authentication configuration, generate a public key and a public key hash value of the group member device, send the public key and the public key hash value of the group member device to the to-be-connected device, receive a notification of a hash authentication result obtained according to the public key and the public key hash value of the group member device by the to-be-connected device, and if hash authentication succeeds, instruct the password sharing unit to send the first password to the group owner device; or, the hash authentication unit 630 is configured to receive a public key and a public key hash value of the to-be-connected device that are generated by the to-be-connected device during the process of WPS authentication configuration, perform hash authentication according to the public key and the public key hash value of the to-be-connected device, and if hash authentication succeeds, instruct the password sharing unit to send the first password to the group owner device.

Embodiment 7

This embodiment is described based on Embodiment 5.

The information transmission unit 610 is configured to obtain, by scanning a dynamic two-dimensional code pre-generated by the to-be-connected device, the information about the to-be-connected device and a dynamic password of the to-be-connected device, and send the information about the to-be-connected device to the group owner device of the wireless device group.

The password sharing unit 620 is configured to send the dynamic password as the first password to the group owner device, or, execute a process of WPS authentication configuration on the to-be-connected device based on the dynamic password, after WPS authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

Embodiment 8

This embodiment is described based on Embodiment 5.

The information transmission unit 610 is configured to pre-generate a dynamic two-dimensional code to be scanned by the to-be-connected device, where the dynamic two-dimensional code includes the information about the group owner device and a dynamic password, and transmit the information about the group owner device to the to-be-connected device; and the password sharing unit 620 is configured to send the dynamic password as the first password to the group owner device, or, execute, based on the dynamic password, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

Embodiment 9

This embodiment is described based on Embodiment 5.

The information transmission unit 610 is configured to collect a static two-dimensional code or a PIN code of the to-be-connected device, scan for and discover the to-be-connected device according to information about the static two-dimensional code or the PIN code, obtain the information about the to-be-connected device and then send the information about the to-be-connected device to the group owner device, and/or transmit the information about the group owner device to the to-be-connected device.

The password sharing unit 620 is configured to extract a password from the static two-dimensional code or the PIN code as the first password, and send the first password to the group owner device, or, execute, based on the password, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

In addition, when information is transmitted by using a static two-dimensional code, the information transmission unit 610 may be further configured to collect the static two-dimensional code of the to-be-connected device, obtain the information about the to-be-connected device from the static two-dimensional code of the to-be-connected device and then send the information about the to-be-connected device to the group owner device, so that the group owner device scans for and discovers the to-be-connected device according to information about the static two-dimensional code.

Embodiment 10

This embodiment is described based on Embodiment 5.

The information transmission unit 610 is configured to enable the to-be-connected device to scan for and discover a proxy device by collecting, by the to-be-connected device, a static two-dimensional code or a PIN code of the proxy device, and after the to-be-connected device scans for and discovers the proxy device, obtain the information about the to-be-connected device and then send the information about the to-be-connected device to the group owner device, and/or transmit the information about the group owner device to the to-be-connected device.

The password sharing unit 620 is configured to use a password in the static two-dimensional code or the PIN code as the first password, and send the first password to the group owner device, or, execute, based on the password, a process of WPS authentication configuration on the to-be-connected device, after WPS authentication configuration succeeds, send credential information to the to-be-connected device, where the credential information includes the first password, and send the first password to the group owner device.

Embodiment 11

FIG. 8 is a flowchart of a method for establishing a connection according to Embodiment 11 of the present disclosure. As shown in FIG. 8, the method is executed by a to-be-connected device, and the method includes the following steps.

810: The to-be-connected device sends information about the to-be-connected device to a group owner device of a wireless device group by using a group member device of the wireless device group, and/or the to-be-connected device obtains information about the group owner device by using the group member device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other.

The to-be-connected device sends the information about the to-be-connected device to the group owner device of the wireless device group by using the group member device of the wireless device group, and/or the to-be-connected device obtains the information about the group owner device by using the group member device. For the specific execution manner, refer to the foregoing Embodiments 1 to 4, and details are not described again.

820: The to-be-connected device shares a first password with the group owner device by using the group member device, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

The to-be-connected device shares the first password with the group owner device by using the group member device. For the specific execution manner, refer to the foregoing Embodiments 1 to 4, and details are not described again.

Embodiment 12

FIG. 9 is a schematic structural diagram of modules of a device for establishing a connection according to Embodiment 12 of the present disclosure. The device in this embodiment is a to-be-connected device, and as shown in FIG. 9, the to-be-connected device 900 includes a communications unit 910 and a password sharing unit 920.

The communications unit 910 is configured to send information about the communications unit 910 to a group owner device of a wireless device group by using a group member device of the wireless device group, and/or obtain information about the group owner device by using the group member device, where information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device 900 and the group owner device to discover each other.

The password sharing unit 920 is configured to share a first password with the group owner device by using the group member device, where the first password is used by the to-be-connected device 900 and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other. The communications unit 910 may be configured to establish, in a short-distance communication manner, a communication connection to the group member device, based on the communication connection, send information about the communications unit 910 to the group owner device by using the group member device, and/or obtain the information about the group owner device by using the group member device.

The password sharing unit 920 may be further configured to, based on the communication connection, send a password of the password sharing unit 920 as the first password to the group owner device by using the group member device, or, based on the communication connection, receive a password shared by the group member device and the group owner device and sent by the group member device, and use the received password as the first password, or, based on the communication connection, execute a process of WPS authentication configuration on the group member device, and after WPS authentication configuration succeeds, receive credential information sent by the group member device, where the credential information includes the first password, where the first password is further sent by the group member device to the group owner device.

In addition, the password sharing unit 920 is further configured to share a second password with the group owner device by using at least one another group member device, where the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of WPS authentication configuration, or, the first password and the second password are both used as passwords required by the to-be-connected device and the group owner device to execute a process of handshake communication.

A proxy device for establishing a connection provided by the embodiments of the present disclosure may be implemented based on a computer system, and the methods shown in FIG. 1, FIG. 2, FIG. 3, FIG. 4, and FIG. 5 may all be implemented by the proxy device that is based on the computer system. FIG. 10 shows an embodiment of a proxy device that is implemented based on a computer system. The proxy device in this embodiment may include a processor 1010, a memory 1020, and a communications interface 1030, where the communications interface 1030 is configured to communicate with a to-be-connected device and a group owner device. The communications interface 1030 may be configured to receive information about the to-be-connected device that is sent by the to-be-connected device, send information about the group owner device to the to-be-connected device, or send the information about the to-be-connected device and the first password to the group owner device.

The memory 1020 is configured to store a program instruction, the information about the group owner device, and the like.

The processor 1010 is configured to invoke the program instruction stored in the memory 1020, and perform the steps in the foregoing method embodiments. For details, refer to the foregoing method embodiments, such as Embodiments 1, 2, 3, and 4.

The processor 1010 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), and the like. The proxy device in this embodiment may include a bus 1040. The processor 1010, the memory 1020, and the communications interface 1030 may be connected to and communicate with each other by using the bus 1040. The memory 1020 may include an entity with a storage function, such as a random access memory (RAM), a read-only memory (ROM), or a magnetic disk.

A to-be-connected device for establishing a connection provided by the embodiments of the present disclosure may be implemented based on a computer system, and the method shown in FIG. 8 may be implemented by the to-be-connected device based on the computer system. FIG. 11 shows an embodiment of a to-be-connected device that is implemented based on a computer system. The to-be-connected device in this embodiment may include a processor 1110, a memory 1120, and a communications interface 1130, where the communications interface 1130 is configured to communicate with a group member device and a group owner device. Messages for a to-be-connected device and the group owner device to interact with the group member device (as shown in FIG. 8 of the method embodiment) are all sent and received through the communications interface 1130. The communications interface 1130 may be configured to receive information about the group owner device and a password that are sent by the group member device, or send information about the to-be-connected device to the group member device.

The memory 1120 is configured to store a program instruction.

The processor 1110 is configured to invoke the program instruction stored in the memory 1120, and perform the steps in the foregoing method embodiments. For details, refer to the foregoing method Embodiment 11.

The processor 1110 may be a CPU, an ASIC, and the like. The to-be-connected device in this embodiment may include a bus 1140. The processor 1110, the memory 1120, and the communications interface 1130 may be connected to and communicate with each other by using the bus 1140. The memory 1120 may include an entity with a storage function, such as a RAM, a ROM, or a magnetic disk.

According to the method and the device for establishing a connection in the embodiments of the present disclosure, a group member device of a wireless device group obtains information about a to-be-connected device and then sends the information about the to-be-connected device to a group owner device of the wireless device group, and/or the group member device transmits information about the group owner device to the to-be-connected device, where the information about the to-be-connected device and/or the information about the group owner device is used by the to-be-connected device and the group owner device to discover each other, and the group member device enables the to-be-connected device and the group owner device to share a first password, where the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other, so that the to-be-connected device and the group owner device more quickly complete a discovery and authentication process, which simplifies an operating procedure of connecting a new device to an established wireless device group, thereby improving connection efficiency.

In addition, for an existing security issue, the embodiments provided by the present disclosure include setting a key shared between the group member device and the to-be-connected device to a public key in a public and private key system, and generating, by the two parties based on the public key, a shared key, and using the shared key as the first password. If a device inside a group launches an attack, because the device inside the group can obtain only the public key, and a private key is stored by the device and not sent, an attacker cannot generate the shared key, cannot implement eavesdropping and a man-in-the-middle attack, and therefore cannot obtain privacy information between the group member device and the to-be-connected device, or attack communication between the to-be-connected device and the group owner device. Therefore, after the group member device and the to-be-connected device securely share the key, the to-be-connected device and the group owner device are securely connected to each other.

A person of ordinary skill in the art may understand that, each aspect of the present disclosure or a possible implementation manner of each aspect may be implemented as a system, a method, or a computer program product. Therefore, each aspect of the present disclosure or a possible implementation manner of each aspect may use forms of hardware only embodiments, software only embodiments (including firmware, resident software, and the like), or forms of embodiments that combine software and hardware, which are generally referred to as a “circuit”, a “module”, or a “system” herein. In addition, each aspect of the present disclosure or the possible implementation manner of each aspect may take a form of a computer program product, where the computer program product refers to computer-readable program code stored in a computer-readable medium.

The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any appropriate combination thereof, such as a RAM, a ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, and a compact disc read-only memory (CD-ROM).

A processor in a computer reads computer-readable program code stored in a computer-readable medium, so that the processor can perform a function and an action specified in each step or a combination of steps in a flowchart; an apparatus is generated to implement a function and an action specified in each block or a combination of blocks in a block diagram.

All computer-readable program code may be executed on a computer of a user, or some may be executed as a standalone software package on a computer of a user, or some may be executed on a computer of a user while some is executed on a remote computer, or all the code may be executed on a remote computer or a server. It should also be noted that, in some alternative implementation solutions, each step in the flowcharts or functions specified in each block in the block diagrams may not occur in the illustrated order. For example, two consecutive steps or two blocks in the illustration, which are dependent on an involved function, may in fact be executed substantially at the same time, or these blocks may sometimes be executed in a reverse order.

Obviously, a person skilled in the art can make various modifications and variations to the present disclosure without departing from the spirit and scope of the present disclosure. The present disclosure is intended to cover these modifications and variations provided that these modifications and variations of the present disclosure fall within the scope of scope defined by the following claims of the present disclosure and their equivalent technologies.

Claims

1. A method for establishing a connection, comprising:

executing at least one of the steps: obtaining, by a group member device of a wireless device group, information about a to-be-connected device and then sending the information about the to-be-connected device to a group owner device of the wireless device group, and transmitting, by the group member device, information about the group owner device to the to-be-connected device, and
enabling, by the group member device, the to-be-connected device and the group owner device to share a first password, wherein the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

2. The method according to claim 1, wherein the method further comprises:

establishing, by the group member device in a short-distance communication manner, a communication connection to the to-be-connected device; and
executing at least one of the following steps: obtaining, by the group member device, the information about the to-be-connected device based on the communication connection and then sending the information about the to-be-connected device to the group owner device, and transmitting the information about the group owner device to the to-be-connected device.

3. The method according to claim 2, wherein enabling, by the group member device, the to-be-connected device and the group owner device to share the first password comprises:

obtaining, by the group member device, a password of the to-be-connected device as the first password based on the communication connection, and sending the first password to the group owner device; or
using, by the group member device, a password shared by the group member device and the group owner device as the first password based on the communication connection, and sending the first password to the to-be-connected device; or
executing, by the group member device, a process of authentication configuration on the to-be-connected device based on the communication connection after the authentication configuration succeeds, sending credential information to the to-be-connected device, wherein the credential information comprises the first password, and sending the first password to the group owner device.

4. The method according to claim 1, wherein obtaining, by the group member device of the wireless device group, the information about the to-be-connected device comprises:

obtaining, by the group member device of the wireless device group, the information about the to-be-connected device by scanning a two-dimensional code of the to-be-connected device; or
collecting, by the group member device, a personal identification number (PIN) code of the to-be-connected device, scanning for and discovering, according to information about the PIN code, the to-be-connected device, and then obtaining the information about the to-be-connected device; or
obtaining, by the group member device, the information about the to-be-connected device after the to-be-connected device obtains a two-dimensional code or a PIN code of the group member device, and after the to-be-connected device scans for and discovers the group member device based on the two-dimensional code or the PIN code.

5. The method according to claim 4, wherein enabling, by the group member device, the to-be-connected device and the group owner device to share the first password comprises:

extracting, by the group member device, a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device, and sending the password as the first password to the group owner device; or
extracting, by the group member device, a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device, executing, based on the password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, sending credential information to the to-be-connected device, wherein the credential information comprises the first password, and sending the first password to the group owner device.

6. The method according to claim 1, wherein transmitting, by the group member device, the information about the group owner device to the to-be-connected device comprises:

pre-generating, by the group member device, a dynamic two-dimensional code to be scanned by the to-be-connected device, wherein the dynamic two-dimensional code comprises the information about the group owner device; or
collecting, by the to-be-connected device, a static two-dimensional code or a PIN code of the group member device, and scanning for and discovering, by the to-be-connected device, the group member device based on the static two-dimensional code or the PIN code; and
transmitting, by the group member device, the information about the group owner device to the to-be-connected device after the to-be-connected device scans for and discovers the group member device.

7. The method according to claim 6, wherein the dynamic two-dimensional code further comprises a dynamic password, and wherein enabling, by the group member device, the to-be-connected device and the group owner device to share the first password comprises:

sending, by the group member device, the dynamic password as the first password to the group owner device when the dynamic password is a dynamic key generated by the group member device; or
executing, based on the dynamic password, by the group member device, a process of authentication configuration on the to-be-connected device when the dynamic password is the dynamic key generated by the group member device, after authentication configuration succeeds, sending, by the group member device, credential information to the to-be-connected device, wherein the credential information comprises the first password, and sending the first password to the group owner device; or
using the dynamic password as the first password when the dynamic password is a password generated by the group owner device; or
performing, by the to-be-connected device and the group owner device, authentication configuration based on the dynamic password, to obtain a shared key as the first password when the dynamic password is the password generated by the group owner device.

8. A method for establishing a connection, comprising:

executing at least one of the following steps: sending, by a to-be-connected device, information about the to-be-connected device to a group owner device of a wireless device group by using a group member device of the wireless device group, and obtaining, by the to-be-connected device, information about the group owner device by using the group member device; and
sharing, by the to-be-connected device, a first password with the group owner device by using the group member device, wherein the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

9. The method according to claim 8, wherein the method further comprises:

establishing, by the to-be-connected device in a short-distance communication manner, a communication connection to the group member device; and
executing at least one of the following steps: sending, by the to-be-connected device, the information about the to-be-connected device to the group owner device by using the group member device based on the communication connection, and obtaining, by the to-be-connected device, the information about the group owner device by using the group member device.

10. The method according to claim 9, wherein sharing, by the to-be-connected device, the first password with the group owner device by using the group member device comprises:

sending, by the to-be-connected device, a password of the to-be-connected device as the first password to the group owner device by using the group member device based on the communication connection; or
receiving, by the to-be-connected device, a password shared by the group member device and the group owner device and sent by the group member device based on the communication connection, and using the received password as the first password; or
executing, by the to-be-connected device, a process of authentication configuration on the group member device based on the communication connection, after authentication configuration succeeds, receiving credential information sent by the group member device, wherein the credential information comprises the first password, wherein the first password is further sent by the group member device to the group owner device.

11. The method according to claim 8, wherein sending, by the to-be-connected device, the information about the to-be-connected device to the group owner device of the wireless device group by using the group member device of the wireless device group comprises:

scanning, by the group member device of the wireless device group, a two-dimensional code of the to-be-connected device such that the group member device obtains the information about the to-be-connected device; or
collecting, by the group member device, a personal identification number (PIN) code of the to-be-connected device such that the group member device obtains the information about the to-be-connected device after scanning for and discovering the to-be-connected device according to information about the PIN code; or
obtaining, by the group member device, the information about the to-be-connected device after the to-be-connected device obtains a two-dimensional code or a PIN code of the group member device, and after the to-be-connected device scans for and discovers the group member device based on the two-dimensional code or the PIN code.

12. The method according to claim 11, wherein sharing, by the to-be-connected device, the first password with the group owner device by using the group member device comprises:

extracting, by the group member device, a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device, and sending, by the group member device, the password as the first password to the group owner device; or
extracting, by the group member device, a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device, executing, by the group member device based on the password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, receiving, by the to-be-connected device, credential information sent by the group member device, wherein the credential information comprises the first password, and sending, by the group member device, the first password to the group owner device.

13. The method according to claim 8, wherein obtaining, by the to-be-connected device, the information about the group owner device by using the group member device comprises:

scanning, by the to-be-connected device, a dynamic two-dimensional code pre-generated by the group member device, wherein the dynamic two-dimensional code comprises the information about the group owner device; or
collecting, by the to-be-connected device, a static two-dimensional code or a PIN code of the group member device, and after the to-be-connected device scans for and discovers the group member device based on the static two-dimensional code or the PIN code, receiving, by the to-be-connected device, the information about the group owner device transmitted by the group member device.

14. The method according to claim 13, wherein the dynamic two-dimensional code further comprises a dynamic password, and wherein sharing, by the to-be-connected device, the first password with the group owner device by using the group member device comprises:

sending, by the group member device, the dynamic password as the first password to the group owner device when the dynamic password is a dynamic key generated by the group member device; or
executing, by the group member device based on the dynamic password, a process of authentication configuration on the to-be-connected device when the dynamic password is the dynamic key generated by the group member device, after authentication configuration succeeds, receiving, by the to-be-connected device, credential information sent by the group member device, wherein the credential information comprises the first password, and sending, by the group member device, the first password to the group owner device; or
using the dynamic password as the first password when the dynamic password is a password generated by the group owner device; or
performing, by the to-be-connected device and the group owner device, authentication configuration based on the dynamic password, to obtain a shared key as the first password when the dynamic password is the password generated by the group owner device.

15. A device for establishing a connection, comprising:

a computer processor configured to: execute at least one of the following steps: obtain information about a to-be-connected device and then send the information about the to-be-connected device to a group owner device of a wireless device group, and transmit information about the group owner device to the to-be-connected device; and enable the to-be-connected device and the group owner device to share a first password, wherein the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

16. The device according to claim 15, wherein the computer processor is configured to execute at least one of the following steps: establish, in a short-distance communication manner, a communication connection to the to-be-connected device, based on the communication connection, obtain the information about the to-be-connected device and then send the information about the to-be-connected device to the group owner device, and transmit the information about the group owner device to the to-be-connected device.

17. The device according to claim 16, wherein the computer processor is configured to:

obtain a password of the to-be-connected device as the first password based on the communication connection, and send the first password to the group owner device; or
use a password shared by the computer processor with the group owner device as the first password based on the communication connection, and send the first password to the to-be-connected device; or
execute a process of authentication configuration on the to-be-connected device based on the communication connection, after authentication configuration succeeds, send credential information to the to-be-connected device, wherein the credential information comprises the first password, and send the first password to the group owner device.

18. The device according to claim 15, wherein the computer processor is configured to:

obtain the information about the to-be-connected device by scanning a two-dimensional code of the to-be-connected device and then send the information about the to-be-connected device to the group owner device of the wireless device group; or
collect a personal identification number (PIN) code of the to-be-connected device, scan for and discover the to-be-connected device according to information about the PIN code, obtain the information about the to-be-connected device, and send the information about the to-be-connected device to the group owner device of the wireless device group; or
obtain the information about the to-be-connected device after the to-be-connected device obtains a two-dimensional code or a PIN code of the group member device, and after the to-be-connected device scans for and discovers the group member device based on the two-dimensional code or the PIN code, and send the information about the to-be-connected device to the group owner device of the wireless device group.

19. The device according to claim 18, wherein the computer processor is configured to:

extract a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device, and send the password as the first password to the group owner device; or
extract a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device, execute, based on the password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, wherein the credential information comprises the first password, and send the first password to the group owner device.

20. The device according to claim 15, wherein the computer processor is configured to:

pre-generate a dynamic two-dimensional code to be scanned by the to-be-connected device, wherein the dynamic two-dimensional code comprises the information about the group owner device; or
collect a static two-dimensional code or a PIN code of the group member device, and scan for and discover, based on the static two-dimensional code or the PIN code, the group member device, and after the to-be-connected device scans for and discovers the group member device, transmit the information about the group owner device to the to-be-connected device.

21. The device according to claim 20, wherein the dynamic two-dimensional code further comprises a dynamic password, and wherein the computer processor is configured to:

send the dynamic password as the first password to the group owner device, wherein the dynamic password is a dynamic key generated by the group member device; or
execute, based on the dynamic password, a process of authentication configuration on the to-be-connected device, after authentication configuration succeeds, send credential information to the to-be-connected device, wherein the credential information comprises the first password, and send the first password to the group owner device, wherein the dynamic password is a dynamic key generated by the group member device; or
use the dynamic password as the first password when the dynamic password is a password generated by the group owner device; or
enable the to-be-connected device and the group owner device to perform authentication configuration based on the dynamic password, to obtain a shared key as the first password when the dynamic password is the password generated by the group owner device.

22. A device for establishing a connection, comprising:

a computer processor configured to: execute at least one of the following steps: send information about a to-be-connected device to a group owner device of a wireless device group by using a group member device of the wireless device group, and obtain information about the group owner device by using the group member device; and share a first password with the group owner device by using the group member device, wherein the first password is used by the to-be-connected device and the group owner device to establish a connection after the to-be-connected device and the group owner device discover each other.

23. The device according to claim 22, wherein the computer processor is configured to execute at least one of the following steps: establish, in a short-distance communication manner, a communication connection to the group member device, based on the communication connection, send information about the computer processor to the group owner device by using the group member device, and obtain the information about the group owner device by using the group member device.

24. The device according to claim 23, wherein the computer processor is configured to:

send a password of the password sharing unit as the first password to the group owner device by using the group member device based on the communication connection; or
receive a password shared by the group member device and the group owner device and sent by the group member device based on the communication connection, and use the received password as the first password; or
execute a process of authentication configuration on the group member device based on the communication connection, and after authentication configuration succeeds, receive credential information sent by the group member device, wherein the credential information comprises the first password, wherein the first password is further sent by the group member device to the group owner device.

25. The device according to claim 22, wherein the computer processor is configured to:

scan a two-dimensional code of the to-be-connected device by using the group member device of the wireless device group such that the group member device obtains the information about the to-be-connected device; or
collect a personal identification number PIN code of the to-be-connected device by using the group member device such that the group member device obtains the information about the to-be-connected device after scanning for and discovering the to-be-connected device according to information about the PIN code; or
obtain a two-dimensional code or a PIN code of the group member device, scan for and discover the group member device based on the two-dimensional code or the PIN code, and obtain the information about the to-be-connected device by using the group member device.

26. The device according to claim 25, wherein the computer processor is configured to:

extract a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device by using the group member device, and send the password as the first password to the group owner device by using the group member device; or
extract a password from the two-dimensional code or the PIN code of the to-be-connected device or the group member device by using the group member device, execute, based on the password, a process of authentication configuration on the to-be-connected device by using the group member device, after authentication configuration succeeds, receive credential information sent by the group member device, wherein the credential information comprises the first password, and send the first password to the group owner device by using the group member device.

27. The device according to claim 22, wherein the computer processor is configured to:

scan a dynamic two-dimensional code pre-generated by the group member device, wherein the dynamic two-dimensional code comprises the information about the group owner device; or
collect a static two-dimensional code or a PIN code of the group member device, and after the group member device is scanned for and discovered based on the static two-dimensional code or the PIN code, receive the information about the group owner device transmitted by the group member device.

28. The device according to claim 27, wherein the dynamic two-dimensional code further comprises a dynamic password, and wherein the computer processor is configured to:

send the dynamic password as the first password to the group owner device by using the group member device when the dynamic password is a dynamic key generated by the group member device; or
execute, based on the dynamic password, a process of authentication configuration on the to-be-connected device by using the group member device when the dynamic password is the dynamic key generated by the group member device, after authentication configuration succeeds, receive credential information sent by the group member device, wherein the credential information comprises the first password, and send the first password to the group owner device by using the group member device; or
use the dynamic password as the first password when the dynamic password is a password generated by the group owner device; or
enable the to-be-connected device and the group owner device to perform authentication configuration based on the dynamic password, to obtain a shared key as the first password when the dynamic password is the password generated by the group owner device.
Patent History
Publication number: 20160087967
Type: Application
Filed: Nov 30, 2015
Publication Date: Mar 24, 2016
Patent Grant number: 10419424
Inventors: Gaokun Pang (Shenzhen), Zhiming Ding (Shenzhen)
Application Number: 14/953,828
Classifications
International Classification: H04L 29/06 (20060101); H04W 76/02 (20060101);