Connection establishment method, electronic equipment and storage medium
By using Bluetooth broadcast information interaction and public key hash value encryption technology between devices, the problem of low security of WIFI point-to-point method and long key negotiation process of Bluetooth method is solved, and efficient and secure connection establishment is achieved.
Patent Information
- Application Number
- CN202410865527.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2020-06-30
- Filing Date
- 2021-06-23
- Publication Date
- 2024-09-03
AI Technical Summary
In the existing technology, the security of WIFI point-to-point mode is low, and the key negotiation process of Bluetooth low-power mode is long, resulting in low device connection establishment efficiency and unable to meet the demand for fast connection.
Through the interaction of Bluetooth broadcast information between the source device and the target device, the public key hash value and the preset private key are used to generate a shared key, encrypt the establishment message, and establish a secure connection.
It improves the efficiency of connection establishment between devices, enhances security, and adapts to the need for fast connection.
Smart Images

Figure CN118590883A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a connection establishment method, an electronic device, and a storage medium. Background Art
[0002] With the continuous development of wireless communication technology, there are more and more short-range wireless communication methods, including ZigBee, UWB, WIFI, Bluetooth and NFC.
[0003] At present, air transmission within a short range is usually based on Bluetooth Low Energy (BLE) and WIFI point to point (P2P). In the WIFI point to point mode, since a symmetric encryption algorithm is used between the source device and the target device in this mode, the security is very low. During the connection establishment process, an attacker can crack the service set identifier (SSID) and password, thereby obtaining data during the transmission process, causing security risks. In the BLE mode, the RSA2048 encryption algorithm is used. The RSA2048 encryption algorithm is an asymmetric algorithm. Although it can ensure the security of the connection establishment process, the key length of RSA2048 is very long, resulting in a long process for the source device and the target device to negotiate the key, which reduces the efficiency of the connection establishment and is not suitable for the current needs of quickly establishing connections between terminal devices. Summary of the invention
[0004] The embodiment of the present application provides a connection establishment method, an electronic device and a storage medium to provide a way to establish a secure connection between devices, through the interaction of Bluetooth broadcast information between the source device and the target device, so that the target device receives the connection establishment message of the source device, thereby completing the secure connection establishment between the source device and the target device. The efficiency of establishing the connection between the devices can be improved.
[0005] In a first aspect, an embodiment of the present application provides a connection establishment method, including:
[0006] The source device sends an announcement broadcast message to the terminal device, so that the terminal device discovers the source device, wherein the announcement broadcast message includes the device identification of the source device; specifically, the source device can be one of the terminal devices, which can be any one of a mobile terminal, a personal computer or a smart screen, or other terminal devices with wireless communication functions; the announcement broadcast message can be sent by broadcasting, so that other terminal devices close to the source device can receive the announcement broadcast message.
[0007] The source device receives a discovery broadcast message from the terminal device, wherein the discovery broadcast message includes a device identification of the terminal device and a public key hash value corresponding to the terminal device; specifically, the discovery broadcast message may also be sent by broadcasting.
[0008] The source device associates and stores the public key hash value with the device identification of the terminal device; specifically, the public key hash value is used to verify the public key of the terminal device to determine that the public key matches the device ID of the terminal device.
[0009] The source device sends a request broadcast message to the terminal device, so that the target device in the terminal device receives the request broadcast message, wherein the request broadcast message includes the device identification of the target device; specifically, the request broadcast message can also be sent by broadcasting, wherein the request broadcast message includes the device ID of the target device, and therefore, only the target device needs to process the request broadcast message.
[0010] The source device receives the public key of the target device, verifies the public key of the target device according to the public key hash value, and if the verification passes, encrypts the connection message according to the public key of the target device and the preset source device private key to obtain the connection ciphertext, and sends the connection ciphertext and the source device public key to the target device, so that a connection is established between the source device and the target device. Specifically, a public-private key pair can be pre-created in the source device, and the public-private key pair can include a public key and a private key. Therefore, a shared key can be generated according to the public key of the target device and the private key of the source device, and the connection message can be encrypted by the shared key to generate the connection ciphertext.
[0011] In one possible implementation, the announcement broadcast message further includes:
[0012] A public key hash value of the source device, wherein the public key hash value of the source device is used to verify the public key of the source device in the target device.
[0013] In one possible implementation, the connection message is encrypted according to the target device public key and the preset source device private key, and the connection ciphertext obtained includes:
[0014] A shared key is generated based on the target device public key and the preset source device private key, and the connection message is encrypted based on the shared key to obtain the connection ciphertext.
[0015] In one possible implementation, generating a shared key based on a target device public key and a preset source device private key includes:
[0016] Obtain a preset encrypted source device private key; specifically, after the source device creates a public-private key pair, the private key may also be encrypted to ensure the security of the private key.
[0017] The encrypted source device private key is decrypted to obtain the source device private key, and a shared key is generated based on the target device public key and the source device private key.
[0018] In one possible implementation, sending the linking ciphertext and the source device public key to the target device includes:
[0019] The linking ciphertext and the source device public key are combined into a broadcast data packet, and the broadcast data packet is broadcast to the terminal device so that the target device receives the broadcast data packet, wherein the broadcast data packet includes a device identification of the target device.
[0020] In one possible implementation, broadcasting a broadcast data packet to a terminal device so that the target device receives the broadcast data packet includes:
[0021] The broadcast data packet is divided into a plurality of broadcast data subpackets, so that the target device reassembles the broadcast data subpackets according to the device identification of the source device to obtain a broadcast data packet, wherein each broadcast data subpacket includes the device identification of the source device. Specifically, the broadcast data packet to be sent can be divided according to the maximum length of each broadcast message to obtain broadcast data subpackets, and then the broadcast data subpackets are sent to the target device by broadcasting, so that the target device can reassemble the broadcast data subpackets according to the device identification of the source device after receiving them, thereby obtaining a broadcast data packet.
[0022] In a second aspect, an embodiment of the present application provides a connection establishment device, including:
[0023] An announcement module is used for the source device to send an announcement broadcast message to the terminal device so that the terminal device can find the source device, wherein the announcement broadcast message includes a device identifier of the source device;
[0024] A discovery module, configured for a source device to receive a discovery broadcast message of a terminal device, wherein the discovery broadcast message includes a device identifier of the terminal device and a public key hash value corresponding to the terminal device;
[0025] A storage module, used for the source device to associate and store the public key hash value with the device identification of the terminal device;
[0026] A request module, configured for the source device to send a request broadcast message to the terminal device, so that the target device in the terminal device receives the request broadcast message, wherein the request broadcast message includes a device identifier of the target device;
[0027] The connection module is used for the source device to receive the public key of the target device, verify the public key of the target device according to the public key hash value, and if the verification passes, encrypt the connection message according to the public key of the target device and the preset source device private key to obtain the connection ciphertext, and send the connection ciphertext and the source device public key to the target device, so that a connection is established between the source device and the target device.
[0028] In one possible implementation, the announcement broadcast message further includes:
[0029] A public key hash value of the source device, wherein the public key hash value of the source device is used to verify the public key of the source device in the target device.
[0030] In one possible implementation, the connection module is further configured to generate a shared key according to a public key of a target device and a preset private key of a source device, and encrypt a connection message according to the shared key to obtain a connection ciphertext.
[0031] In one possible implementation, the connection module includes:
[0032] An acquisition unit, used to acquire a preset encryption source device private key;
[0033] The generating unit is used to decrypt the encrypted source device private key to obtain the source device private key, and generate a shared key according to the target device public key and the source device private key.
[0034] In one possible implementation, the connection module is also used to combine the association ciphertext and the source device public key into a broadcast data packet, broadcast the broadcast data packet to the terminal device, so that the target device receives the broadcast data packet, wherein the broadcast data packet includes a device identifier of the target device.
[0035] In one possible implementation, the connection module is also used to split the broadcast data packet into multiple broadcast data subpackets, so that the target device reassembles the broadcast data subpackets according to the device identification of the source device to obtain a broadcast data packet, wherein each broadcast data subpacket includes the device identification of the source device.
[0036] In a third aspect, an embodiment of the present application provides a source device, including:
[0037] A memory, the memory is used to store computer program code, the computer program code includes instructions, when the source device reads the instructions from the memory, so that the source device performs the following steps:
[0038] The source device sends an announcement broadcast message to the terminal device, so that the terminal device discovers the source device, wherein the announcement broadcast message includes a device identifier of the source device;
[0039] The source device receives a discovery broadcast message from the terminal device, wherein the discovery broadcast message includes a device identifier of the terminal device and a public key hash value corresponding to the terminal device;
[0040] The source device associates and stores the public key hash value with the device identification of the terminal device;
[0041] The source device sends a request broadcast message to the terminal device, so that the target device in the terminal device receives the request broadcast message, wherein the request broadcast message includes a device identifier of the target device;
[0042] The source device receives the public key of the target device and verifies the target device public key according to the public key hash value. If the verification passes, the connection message is encrypted according to the target device public key and the preset source device private key to obtain the connection ciphertext, and the connection ciphertext and the source device public key are sent to the target device, so that a connection is established between the source device and the target device.
[0043] In one possible implementation, the announcement broadcast message further includes:
[0044] A public key hash value of the source device, wherein the public key hash value of the source device is used to verify the public key of the source device in the target device.
[0045] In one possible implementation, when the instruction is executed by the source device, the source device encrypts the connection message according to the target device public key and the preset source device private key, and the step of obtaining the connection ciphertext includes:
[0046] A shared key is generated based on the target device public key and the preset source device private key, and the connection message is encrypted based on the shared key to obtain the connection ciphertext.
[0047] In one possible implementation, when the instruction is executed by the source device, the source device executes the step of generating a shared key according to the target device public key and the preset source device private key, including:
[0048] Get the private key of the pre-set encrypted source device;
[0049] The encrypted source device private key is decrypted to obtain the source device private key, and a shared key is generated based on the target device public key and the source device private key.
[0050] In one possible implementation, when the instruction is executed by the source device, the source device executes the step of sending the association ciphertext and the source device public key to the target device, including:
[0051] The linking ciphertext and the source device public key are combined into a broadcast data packet, and the broadcast data packet is broadcast to the terminal device so that the target device receives the broadcast data packet, wherein the broadcast data packet includes a device identification of the target device.
[0052] In one possible implementation, when the instruction is executed by the source device, the source device broadcasts the broadcast data packet to the terminal device, so that the target device receives the broadcast data packet, including:
[0053] The broadcast data packet is divided into a plurality of broadcast data sub-packets, so that the target device reassembles the broadcast data sub-packets according to the device identification of the source device to obtain the broadcast data packet, wherein each broadcast data sub-packet includes the device identification of the source device.
[0054] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0056] Figure 2 A schematic diagram of the software architecture of an electronic device provided in an embodiment of the present application;
[0057] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0058] Figure 4 A flow chart of a connection establishment method provided in an embodiment of the present application;
[0059] Figure 5 A schematic diagram of the structure of a connection establishment device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The technical solution in the embodiment of the present application will be described below in conjunction with the drawings in the embodiment of the present application. In the description of the embodiment of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0061] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0062] At present, air transmission within a short range is usually based on Bluetooth Low Energy (BLE) and WIFI point to point (P2P). In the WIFI point to point mode, since a symmetric encryption algorithm is used between the source device and the target device in this mode, the security is very low. During the connection establishment process, an attacker can crack the service set identifier (SSID) and password, thereby obtaining data during the transmission process, causing security risks. In the BLE mode, the RSA2048 encryption algorithm is used. The RSA2048 encryption algorithm is an asymmetric algorithm. Although it can ensure the security of the connection establishment process, the key length of RSA2048 is very long, resulting in a long process for the source device and the target device to negotiate the key, which reduces the efficiency of the connection establishment and is not suitable for the current needs of quickly establishing connections between terminal devices.
[0063] Based on the above problems, an embodiment of the present application provides a connection establishment method.
[0064] The technical solution provided in the embodiments of the present application can be applied to terminal devices. For example, the terminal device 10 can be an electronic device such as a mobile phone, a personal computer (PC) or a smart screen. The present application does not impose any special restrictions on the specific form of the terminal device 10 that executes the technical solution.
[0065] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the application scenario includes a source device 11 and a device to be connected 12. The source device 11 and the device to be connected 12 may be any one of the terminal devices 10.
[0066] Figure 2 is a system architecture diagram of the above terminal device 10. Figure 1 As shown, the terminal device 10 may include a hardware layer 101, a capability layer 102 and an application layer 103. Among them, the hardware layer 101 may provide a communication interface. For example, the above communication interface may include an interface for short-range communication methods such as Bluetooth and WIFI. The capability layer 102 provides functions related to device capabilities. For example, the above functions may include device discovery and device connection. The device discovery may be used to discover the source device or the target device, and the device connection may be used to establish a connection between the source device and the target device. The application layer 103 may provide a variety of different applications. For example, the above applications may include applications such as screen projection and file sharing.
[0067] Combine the following Figure 3 First, an exemplary electronic device provided in the following embodiments of the present application is introduced. Figure 3 A schematic structural diagram of an electronic device 100 is shown, and the electronic device 100 may be the terminal device 10 mentioned above.
[0068] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0069] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0070] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0071] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0072] The execution of the screenshot method provided in the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121 to implement the user's screenshot operation and enhance the user experience.
[0073] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0074] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0075] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0076] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0077] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0078] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0079] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be arranged in the same device as the mobile communication module 150 or other functional modules.
[0080] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0081] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0082] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0083] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0084] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0085] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0086] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0087] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0088] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0089] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0090] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0091] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0092] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0093] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0094] In the embodiment of the present application, the user's touch screen data can be acquired through the touch sensor 180K, and the touch screen data can be sent to the processor 110 for processing.
[0095] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0096] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0097] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0098] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0099] Now combined Figure 4 The connection establishment method provided in the embodiment of the present application is described as follows: Figure 4 The flowchart of an embodiment of the connection establishment method of the present application is shown, including:
[0100] Step 401 : the source device 11 sends an announcement broadcast message to the device to be connected 12 , so that the device to be connected 12 can discover the source device 11 , wherein the announcement broadcast message includes a device identifier of the source device 11 .
[0101] Specifically, the source device 11 may be any one of the terminal devices 10, and the device to be connected 12 may also be any one of the terminal devices 10. The terminal device 10 may be an electronic device such as a mobile phone, a personal computer (PC), or a smart screen. The terminal device 10 may also be other types of electronic devices with wireless communication functions, which are not limited in the embodiments of the present application. For the convenience of explanation, the terminal device 10 that initiates the connection establishment is identified as the source device 11 below.
[0102] It should be noted that all the terminal devices 10 may be in the same local area network, so that all the terminal devices 10 can perform wireless communication via WIFI; optionally, all the terminal devices 10 may also perform wireless communication via Bluetooth.
[0103] In addition, since there may be multiple devices 12 to be connected, the source device 11 may broadcast an announcement broadcast message so that multiple devices 12 to be connected may receive the announcement broadcast message. The broadcast method may be a BLE broadcast, and the announcement broadcast message may be used to announce to all other devices 12 to be connected, so that other devices to be connected may discover the source device 11 and thereby establish a connection with the source device 11.
[0104] The announcement broadcast message may include a device identification of the source device 11 .
[0105] It should be understood that the announcement broadcast message may also include the device name, version number, flag and other relevant information of the source device 11, wherein the flag can be used to identify the functional characteristics of the source device 11, for example, whether the source device 11 supports the 5G frequency band, etc.
[0106] Step 402 : the device to be connected 12 sends a discovery broadcast message to the source device 11 .
[0107] Specifically, when other devices to be connected 12 receive the above-mentioned announcement broadcast message, they can record the device identification of the source device 11 and can also broadcast it. The broadcast method can also be BLE broadcast. The broadcast message can be a discovery broadcast message. The discovery broadcast message is used to notify the source device 11 that the device to be connected 12 has discovered the source device 11 and can wait to establish a connection. Therefore, the discovery broadcast message can include the device identification of the device to be connected 12.
[0108] Furthermore, the discovery broadcast message may also include a hash value of the public key of the device to be connected, wherein the hash value of the public key of the device to be connected may be used to verify whether the source of the public key of the device to be connected is accurate. In a specific implementation, the hash value of the public key of the device to be connected may be generated by an ellipse curve cryptography (ECC) algorithm, and therefore, the hash value of the public key of the device to be connected may be an ECC public key hash value of the device to be connected. It should be noted that a pair of keys can be created in advance in the source device 11 and the device to be connected 12. The pair of keys can be created by the ECC (for example, Curve25519) encryption algorithm. The pair of keys can include a public key and a private key. In the specific implementation, taking the source device 11 as a PC as an example, the PC can generate the source device ECC public-private key pair by calling the openssl library or the boringssl library. Taking the device to be connected 12 as an Android phone as an example, the Android phone can generate the ECC public-private key pair of the device to be connected by calling the boringssl library; optionally, after the source device 11 and the device to be connected 12 each generate a public-private key pair, the source device private key and the device to be connected private key can also be encrypted and stored to improve the security of the above private keys; in the specific implementation, the PC can perform encrypted storage through the Data Protection Application Programming Interface (DPAPI), and the Android phone can perform encrypted storage through the Android Keystore.
[0109] It should be understood that the discovery broadcast message may also include the device name, version number, flag and other relevant information of the device to be connected 12, wherein the flag can be used to identify the functional characteristics of the device to be connected 12, for example, whether the device to be connected 12 supports the 5G frequency band, etc.
[0110] Step 403, the source device 11 receives a discovery broadcast message of the device to be connected 12, wherein the discovery broadcast message includes the device identification of the device to be connected 12 and the ECC public key hash value of the device to be connected; the ECC public key hash value of the device to be connected is associated with the device identification of the device to be connected 12 and stored.
[0111] Specifically, the source device 11 may receive the discovery broadcast message, and may read the device identification of the to-be-connected device 12 and the ECC public key hash value of the to-be-connected device in the discovery broadcast message.
[0112] Further, after the device identification of the device to be connected 12 and the ECC public key hash value of the device to be connected are obtained, the device identification of the device to be connected 12 and the ECC public key hash value of the device to be connected can be associated and stored.
[0113] It should be noted that, since the length of each broadcast message is limited during the broadcast process, the discovery broadcast message can be sent multiple times. For example, the discovery broadcast message can be divided into three broadcast data packets for sending. When the source device 11 receives the above three broadcast data packets, it can be reassembled into a complete broadcast data packet, and the device identification and the ECC public key hash value of the device to be connected 12 can be obtained from the complete broadcast data packet. The reassembly method can be through the Bluetooth Mac address. For example, the broadcast data packets belonging to the same Bluetooth Mac address can be reassembled.
[0114] Step 404: determine the target device, send a broadcast request message, so that the target device receives the broadcast request message, wherein the broadcast request message includes the device identification of the target device.
[0115] Specifically, after the source device 11 receives the discovery broadcast message of all the devices to be connected 12, it can select one of the devices to be connected 12 as the target device, and then send the broadcast again. The broadcast message can be a request broadcast message, which can be used to allow the target device to establish a connection with the source device 11 after receiving the request broadcast message. The request broadcast message may include the device identifier of the target device, so that the target device can identify the request broadcast message. The request broadcast message may also include the device identifier of the source device 11, so that the target device can specify to send a confirmation message to the source device 11.
[0116] Step 405 : The target device sends a public key broadcast message to the source device 11 .
[0117] Specifically, the target device can listen to the request broadcast message sent by the above-mentioned source device 11. Since the request broadcast message contains the device ID of the target device, the target device can match the request broadcast message according to the device ID. If the device ID contained in the request broadcast message matches the device ID of the target device, the target device obtains the request broadcast message and can send a confirmation message to the source device 11 according to the device ID of the source device 11 in the request broadcast message. The confirmation message can be a public key broadcast message, wherein the public key broadcast message can include the ECC public key of the target device and the device ID of the source device 11.
[0118] Step 406, receiving the ECC public key of the target device, verifying the ECC public key of the target device according to the hash value of the ECC public key of the target device, and if the verification passes, encrypting the connection message according to the ECC public key of the target device and the preset source device ECC private key to obtain the connection ciphertext.
[0119] Specifically, after sending the request broadcast message, the source device 11 can monitor the public key broadcast message of the target device. Since the public key broadcast message includes the device ID of the source device 11, the source device 11 can monitor the corresponding public key broadcast message according to the device ID, and can read the ECC public key of the target device in the public key broadcast message after receiving the public key broadcast message.
[0120] Furthermore, since the source device 11 has stored the ECC public key hash value of the device to be connected (that is, the target device ECC public key hash value) in step 402, the source device 11 can verify the ECC public key of the target device through the ECC public key hash value of the target device, thereby determining whether the ECC public key of the target device matches the target device. If the ECC public key of the target device matches the target device, a shared key can be generated based on the ECC public key of the target device and the ECC private key of the source device, and the shared key can be used to encrypt the connection message through the Curve25519 encryption algorithm to obtain the connection ciphertext. Among them, since the ECC private key of the source device is encrypted, the ECC private key of the source device can also be decrypted before forming a shared key with the ECC public key of the target device, thereby obtaining the ECC private key of the source device; the connection message can include connection-related information such as the SSID and password of the WIFI.
[0121] It should be noted that after the source device 11 encrypts the connection message using the above-mentioned shared key through the Curve25519 encryption algorithm, it can optionally also perform secondary encryption through the AES encryption algorithm.
[0122] Step 407: Send the linking ciphertext and the source device ECC public key to the target device, so that a connection is established between the source device 11 and the target device.
[0123] Specifically, after the source device 11 generates the linking ciphertext, it can send the linking ciphertext and the source device ECC public key to the target device. The sending method can also be through broadcasting, and the broadcast message can carry the device identification of the target device, and the target device can obtain the broadcast message according to the device identification.
[0124] It should be noted that the length of the linked ciphertext and the source device ECC public key may exceed the maximum length of the broadcast message. Therefore, the linked ciphertext and the source device ECC public key can be broadcast several times, that is, the linked ciphertext and the source device ECC public key can be divided into multiple broadcast data packets. The target device can group the broadcast data packets according to the Bluetooth Mac address, thereby obtaining the entire broadcast data packet.
[0125] After the target device obtains the broadcast data packet (linking ciphertext and source device ECC public key) of the source device 11, the linking ciphertext in the broadcast data packet can be decrypted. The decryption key can be a shared key composed of the source device ECC public key and the target device ECC private key. It should be noted that if the target device ECC private key is encrypted, the target device ECC private key needs to be decrypted before generating the shared key.
[0126] After the shared key is generated, the connection ciphertext can be decrypted according to the shared key to obtain the connection message; it should be noted that the decryption process can be first decrypted according to the AES decryption algorithm, and then decrypted using the above-mentioned shared key according to the Curve25519 decryption algorithm to obtain the connection message. When the target device obtains the connection message, that is, the SSID and password, the target device can establish a secure connection with the source device 11 according to the SSID and password.
[0127] Optionally, in step 401, the announcement broadcast message may also include a hash value of the ECC public key of the source device; therefore, when the target device receives the ECC public key of the source device in the broadcast data packet, it may also verify the ECC public key of the source device based on the hash value of the ECC public key of the source device, thereby determining whether the ECC public key of the source device matches the source device 11, thereby improving the security of the connection.
[0128] Figure 5 A schematic diagram of the structure of an embodiment of the connection establishment device of the present application is shown as follows: Figure 5 As shown, the connection establishment device 50 may include: an announcement module 51, a discovery module 52, a storage module 53, a request module 54 and a connection module 55;
[0129] An announcement module 51 is used for the source device to send an announcement broadcast message to the terminal device so that the terminal device can find the source device, wherein the announcement broadcast message includes a device identifier of the source device;
[0130] A discovery module 52, configured for a source device to receive a discovery broadcast message of a terminal device, wherein the discovery broadcast message includes a device identifier of the terminal device and a public key hash value corresponding to the terminal device;
[0131] Storage module 53, used for the source device to associate and store the public key hash value with the device identification of the terminal device;
[0132] A request module 54, configured for the source device to send a request broadcast message to the terminal device, so that the target device in the terminal device receives the request broadcast message, wherein the request broadcast message includes a device identifier of the target device;
[0133] The connection module 55 is used for the source device to receive the public key of the target device, verify the public key of the target device according to the public key hash value, and if the verification passes, encrypt the connection message according to the public key of the target device and the preset source device private key to obtain the connection ciphertext, and send the connection ciphertext and the source device public key to the target device, so that a connection is established between the source device and the target device.
[0134] In a possible implementation, the announcement broadcast message may further include a public key hash value of the source device, wherein the public key hash value of the source device is used to verify the public key of the source device in the target device.
[0135] In a possible implementation, the connection module 55 may also be used to generate a shared key according to a public key of a target device and a preset private key of a source device, and encrypt the connection message according to the shared key to obtain a connection ciphertext.
[0136] In a possible implementation, the connection module 55 may include: an acquisition unit 551 and a generation unit 552;
[0137] The acquisition unit 551 is used to acquire the preset encryption source device private key;
[0138] The generating unit 552 is used to decrypt the encrypted source device private key to obtain the source device private key, and generate a shared key according to the target device public key and the source device private key.
[0139] In a possible implementation, the connection module 55 can also be used to combine the association ciphertext and the source device public key into a broadcast data packet, broadcast the broadcast data packet to the terminal device, so that the target device receives the broadcast data packet, wherein the broadcast data packet includes the device identification of the target device.
[0140] In one possible implementation, the connection module 55 can also be used to split the broadcast data packet into multiple broadcast data subpackets, so that the target device reassembles the broadcast data subpackets according to the device identification of the source device to obtain a broadcast data packet, wherein each broadcast data subpacket includes the device identification of the source device.
[0141] Figure 5 The connection establishment device provided in the embodiment shown can be used to implement the present application Figure 1-Figure 4 The technical solution of the method embodiment shown, its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0142] It should be understood that the above Figure 5The division of the modules of the connection establishment device shown is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the detection module can be a separately established processing element, or it can be integrated in a chip of an electronic device. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. In the implementation process, each step of the above method or each of the above modules can be completed by an integrated logic circuit of hardware in the processor element or instructions in software form.
[0143] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0144] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0145] It is understandable that, in order to realize the above functions, the above-mentioned electronic devices, etc. include hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0146] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the present application. Figure 1-Figure 4 The method provided by the illustrated embodiment.
[0147] The embodiment of the present application can divide the functional modules of the above-mentioned terminal etc. according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0148] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0149] Each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0150] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk.
[0151] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A connection establishment method, It is characterized in that include: The source device sends an announcement broadcast message to the terminal device, so that the terminal device discovers the source device, wherein; The source device receives a discovery broadcast message from the terminal device, wherein the discovery broadcast message includes a public key hash value corresponding to the terminal device; The source device stores the public key hash value; The source device sends a request broadcast message to the terminal device, so that the target device in the terminal device receives the request broadcast message and sends the public key of the target device; The source device receives the public key of the target device, verifies the target device public key according to the public key hash value, and if the verification passes, encrypts the connection message according to the target device public key and the preset source device private key to obtain the connection ciphertext, and sends the connection ciphertext and the source device public key to the target device, so that a connection is established between the source device and the target device.
2. The method according to claim 1, It is characterized in that The announcement broadcast message includes a device identification of a source device.
3. The method according to claim 1 or 2, It is characterized in that The announcement broadcast message also includes: A public key hash value of the source device, wherein the public key hash value of the source device is used to verify the public key of the source device in the target device.
4. The method according to claim 1 or 2, It is characterized in that The linking message is encrypted according to the target device public key and the preset source device private key to obtain the linking ciphertext including: A shared key is generated according to the target device public key and the preset source device private key, and the connection message is encrypted according to the shared key to obtain the connection ciphertext.
5. The method according to claim 4, It is characterized in that Generating a shared key according to the target device public key and the preset source device private key includes: Get the private key of the pre-set encrypted source device; The encrypted source device private key is decrypted to obtain the source device private key, and a shared key is generated according to the target device public key and the source device private key.
6. The method according to claim 1 or 2, It is characterized in that The sending the association ciphertext and the source device public key to the target device comprises: The association ciphertext and the source device public key are combined into a broadcast data packet, and the broadcast data packet is broadcast to the terminal device so that the target device receives the broadcast data packet, wherein the broadcast data packet includes a device identification of the target device.
7. The method according to claim 6, It is characterized in that The broadcasting of the broadcast data packet to the terminal device so that the target device receives the broadcast data packet comprises: The broadcast data packet is divided into a plurality of broadcast data subpackets, so that the target device reassembles the broadcast data subpackets according to the device identification of the source device to obtain the broadcast data packet, wherein each of the broadcast data subpackets includes the device identification of the source device.
8. A source device, It is characterized in that include: A memory and a processor, wherein the memory is used to store computer program codes, wherein the computer program codes include instructions, and when the processor reads the instructions from the memory, the processor executes the following steps: The source device sends an announcement broadcast message to the terminal device, so that the terminal device discovers the source device, wherein; The source device receives a discovery broadcast message from the terminal device, wherein the discovery broadcast message includes a public key hash value corresponding to the terminal device; The source device stores the public key hash value; The source device sends a request broadcast message to the terminal device, so that the target device in the terminal device receives the request broadcast message and sends the public key of the target device; The source device receives the public key of the target device, verifies the target device public key according to the public key hash value, and if the verification passes, encrypts the connection message according to the target device public key and the preset source device private key to obtain the connection ciphertext, and sends the connection ciphertext and the source device public key to the target device, so that a connection is established between the source device and the target device.
9. The method according to claim 8, It is characterized in that The announcement broadcast message includes a device identification of a source device.
10. The source device according to claim 8 or 9, It is characterized in that The announcement broadcast message also includes: A public key hash value of the source device, wherein the public key hash value of the source device is used to verify the public key of the source device in the target device.
11. The source device according to claim 8 or 9, It is characterized in that When the instruction is executed by the processor, the processor executes the step of encrypting the connection message according to the target device public key and the preset source device private key to obtain the connection ciphertext, which includes: A shared key is generated according to the target device public key and the preset source device private key, and the connection message is encrypted according to the shared key to obtain the connection ciphertext.
12. The source device according to claim 11, It is characterized in that When the instruction is executed by the processor, the processor executes the step of generating a shared key according to the target device public key and the preset source device private key, including: Get the private key of the pre-set encrypted source device; The encrypted source device private key is decrypted to obtain the source device private key, and a shared key is generated according to the target device public key and the source device private key.
13. The source device according to claim 7 or 8, It is characterized in that When the instruction is executed by the processor, the processor executes the step of sending the association ciphertext and the source device public key to the target device, including: The association ciphertext and the source device public key are combined into a broadcast data packet, and the broadcast data packet is broadcast to the terminal device so that the target device receives the broadcast data packet, wherein the broadcast data packet includes a device identification of the target device.
14. The source device according to claim 13, It is characterized in that When the instruction is executed by the processor, the processor performs the step of broadcasting the broadcast data packet to the terminal device so that the target device receives the broadcast data packet, which includes: The broadcast data packet is divided into a plurality of broadcast data subpackets, so that the target device reassembles the broadcast data subpackets according to the device identification of the source device to obtain the broadcast data packet, wherein each of the broadcast data subpackets includes the device identification of the source device.
15. A computer-readable storage medium, It is characterized in that The method comprises computer instructions, which, when executed on the source device, cause the source device to execute the method according to any one of claims 1 to 7.
