Communication method and device, electronic equipment and readable storage medium
The broadcast information with the first key is published through the gateway device, the device to be configured actively sends connection requests, establishes a data link and encrypts the configuration data transmission, solving the problem of low manual pairing efficiency and achieving efficient device-gate and gateway pairing and configuration operations.
Patent Information
- Application Number
- CN202411917798.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, manual pairing equipment is inefficient and difficult to meet actual needs, especially when the number and type of equipment increase.
The gateway device publishes broadcast information with the first key on a specific channel. After the configuration device is monitored and obtained the broadcast information, it actively sends a connection request to the gateway device, establishes a data link, and encrypts the configuration data through the first key for transmission.
It realizes efficient pairing and connection and configuration operations between devices and gateways, avoids the tedious and time-consuming process of manual pairing one by one, and improves the pairing efficiency of devices and gateways.
Smart Images

Figure CN119946615A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of Internet of Things, and specifically relates to a communication method, device, electronic device and readable storage medium. Background Art
[0002] With the development of the Internet of Things, the demand for wireless communication between devices is increasing. Different devices need to be paired with gateways to establish wireless communication connections and access the Internet of Things.
[0003] In the related art, manual pairing of devices is an optional method. For example, a user manually inputs a pairing code of a target device in a gateway device, and after the target device confirms the pairing code, pairing of the gateway device and the target device is achieved.
[0004] However, with the increase in the number and types of wireless communication devices in production and life scenarios, manual pairing one by one becomes very time-consuming, and the low efficiency of manual pairing makes it difficult to meet actual needs. Summary of the invention
[0005] The present application aims to provide a communication method, apparatus, device and medium, which at least solve the problem of low efficiency of manual pairing in related technologies.
[0006] In a first aspect, an embodiment of the present application discloses a communication method, which is applied to a gateway device, and the method includes:
[0007] generating a first key in a first encryption mode;
[0008] Publishing broadcast information on a specific channel, the broadcast information including the first key; the broadcast information is used for being received by a device to be configured that monitors the specific channel, and obtaining the first key from the broadcast information, and the device to be configured is further used to send a connection request to the gateway device when the first key is obtained;
[0009] In response to the connection request, establishing a data link with the device to be configured;
[0010] The configuration data is encrypted by the first key to obtain ciphertext data, and the ciphertext data is sent to the device to be configured through the data link, so that after the device to be configured receives the ciphertext data, the ciphertext data is decrypted by the first key to obtain the configuration data, and the configuration data is used to configure the device to be configured.
[0011] Optionally, the gateway device includes a first Bluetooth module, the specific channel includes a Bluetooth channel, the first Bluetooth module is used to publish the broadcast information through the Bluetooth channel, and the second device includes a second Bluetooth module, and the second Bluetooth module is used to monitor the Bluetooth channel.
[0012] Optionally, before the step of publishing the broadcast information on a specific channel, the method further includes:
[0013] The first key is encrypted in a second encryption mode to obtain a ciphertext key, so that the to-be-configured device obtains the ciphertext key from the broadcast information, and then decrypts the ciphertext key by a second key matching the second encryption mode to obtain the first key.
[0014] Optionally, the method further includes:
[0015] The first key is updated after a preset period, and after the first key is updated, the step of publishing broadcast information through a specific channel is re-entered.
[0016] In a second aspect, an embodiment of the present application discloses a communication method, which is applied to a device to be configured, and the method includes:
[0017] Monitor a specific channel and receive broadcast information published by the gateway device through the specific channel;
[0018] Obtaining a first key from the broadcast information;
[0019] In the case of obtaining the first key, sending a connection request to the gateway device, so that the gateway device receives the connection request and establishes a data link with the device to be configured;
[0020] The ciphertext data encrypted by the first key is received from the data link, and the ciphertext data is decrypted by the first key to obtain configuration data, where the configuration data is used to configure the device to be configured.
[0021] Optionally, the acquiring the first key from the broadcast information includes:
[0022] Obtaining a ciphertext key from the broadcast information; the first key is encrypted by the second encryption method in the gateway device to obtain the ciphertext key
[0023] The ciphertext key is decrypted by using a preset second key matching the second encryption method to obtain the first key.
[0024] Optionally, before the step of acquiring the first key from the broadcast information, the step includes:
[0025] Verifying the integrity of the broadcast information by a preset verification method;
[0026] When the integrity of the broadcast information passes the verification, the process proceeds to the step of obtaining the first key from the broadcast information.
[0027] Optionally, the verification method includes:
[0028] Acquire a first verification code of the broadcast information, where the first verification code is calculated by the gateway device using a preset verification algorithm;
[0029] Calculating a second verification code of the broadcast information in the device to be configured by using the verification algorithm;
[0030] When the first verification code is consistent with the second verification code, it is confirmed that the integrity of the broadcast information has passed the verification.
[0031] In a third aspect, an embodiment of the present application discloses a communication device, which is applied to a gateway device, and the communication device includes:
[0032] A key generation module: used to generate a first key in a first encryption mode;
[0033] A broadcast publishing module: used for publishing broadcast information in a specific channel, wherein the broadcast information includes the first key; the broadcast information is used for receiving the to-be-configured device that monitors the specific channel, and obtaining the first key from the broadcast information; the to-be-configured device is also used for sending a connection request to the gateway device when obtaining the first key;
[0034] A link establishing module: used for establishing a data link with the device to be configured in response to the connection request;
[0035] The first configuration module is used to encrypt the configuration data by using the first key to obtain ciphertext data, and send the ciphertext data to the device to be configured through the data link, so that after the device to be configured receives the ciphertext data, it decrypts the ciphertext data by using the first key to obtain the configuration data, and the configuration data is used to configure the device to be configured.
[0036] In a fourth aspect, an embodiment of the present application discloses a communication device, which is applied to a device to be configured, and the communication device includes:
[0037] Monitoring module: used to monitor a specific channel and receive broadcast information released by the gateway device through the specific channel;
[0038] A key acquisition module: used to acquire a first key from the broadcast information;
[0039] A request sending module: configured to send a connection request to the gateway device when the first key is obtained, so that the gateway device receives the connection request and establishes a data link with the device to be configured;
[0040] The second configuration module is used to receive the ciphertext data encrypted by the first key from the data link, and decrypt the ciphertext data by using the first key to obtain configuration data, wherein the configuration data is used to configure the device to be configured.
[0041] In a fifth aspect, an embodiment of the present application further discloses an electronic device, comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect or the second aspect are implemented.
[0042] In a sixth aspect, an embodiment of the present application further discloses a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect or the second aspect are implemented.
[0043] In summary, in this embodiment, the gateway device publishes broadcast information with a first key through a specific channel, and the device to be configured listens to the specific channel and obtains the broadcast information, so as to realize the distribution of the first key based on broadcasting. After receiving the first key, a data link is established between the gateway device and the device to be configured, and the pairing communication between the device to be configured and the gateway device is realized. The configuration data in the data link is encrypted by the first key to ensure the security and integrity of the configuration data during the transmission process; the first key is published through the broadcast information, and the device to be configured actively sends a connection request to the gateway device after receiving the first key in the broadcast information to establish a data link for communication between the device to be configured and the gateway device, so that the same gateway device can simultaneously establish a data link with multiple devices to be configured within the range of the broadcast signal, and the gateway device can further simultaneously send configuration data to multiple devices to be configured through their respective data links to complete the configuration operation of the device to be configured. Compared with the related art, the tedious and time-consuming process of manual pairing one by one is avoided. Through the method provided in the embodiment of the present application, the pairing connection between the gateway device and the device to be configured and the configuration operation of the device to be configured can be efficiently completed, thereby improving the pairing efficiency between the device and the gateway. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In the attached picture:
[0045] Figure 1 is a flow chart of the steps of a communication method provided by an embodiment of the present application;
[0046] Figure 2 is a flowchart of another communication method provided by an embodiment of the present application;
[0047] Figure 3 It is a flow chart of the interaction steps of a communication method provided in an embodiment of the present application;
[0048] Figure 4 is a flowchart of another communication method provided by an embodiment of the present application;
[0049] Figure 5 is a block diagram of a communication device provided in an embodiment of the present application;
[0050] Figure 6 is a block diagram of another communication device provided in an embodiment of the present application;
[0051] Figure 7 is a block diagram of an electronic device according to an embodiment of the present application;
[0052] Figure 8 It is a block diagram of an electronic device of another embodiment provided by the embodiments of the present application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0055] Figure 1 This is a communication method provided by this embodiment, referring to Figure 1 , the communication method is applied to a gateway device, and the method may include the following steps:
[0056] Step 101: Generate a first key using a first encryption method.
[0057] The gateway device generates a first key through a preset first encryption method. The first key can encrypt the communication content transmitted between the gateway device and the device to be configured in subsequent steps, including configuration data used to configure the device to be configured; after startup, the gateway device will initialize the encryption module used to generate the first key, load the required encryption algorithm and data, and generate the first key, that is, generate the key through the first encryption method.
[0058] Exemplarily, the first encryption method may include: an asymmetric encryption algorithm (RSA algorithm, RSA), through which an RSA key pair can be generated based on plain text. Since the generated key is random and difficult to reverse, one of the keys can be selected as the first key; the first encryption method may also include: a cryptographic hash function, such as the Secure Hash Algorithm 256 standard (Secure Hash Algorithm 256, SHA-256). Through SHA-256, a hash value of a fixed length can be generated based on plain text, and the uniqueness and irreversibility of the hash value can be guaranteed, which can be used as an optional method for generating the first key.
[0059] After generating the first key, the gateway device stores the generated first key in a private storage area to ensure that the first key will not be accessed by unauthorized persons before the communication pairing between the gateway device and the device to be configured is performed.
[0060] Step 102: publish broadcast information on a specific channel, wherein the broadcast information includes the first key; the broadcast information is used for receiving the device to be configured that monitors the specific channel and obtaining the first key from the broadcast information; the device to be configured is also used to send a connection request to the gateway device when obtaining the first key.
[0061] In order to publish the first key, broadcast information including the first key can be published through a specific channel through the gateway device. The device to be configured can capture the broadcast information including the first key by monitoring the specific channel and extract the first key therefrom. After obtaining the first key, the device to be configured will send a connection request to the gateway device so that the gateway device can establish a pairing connection with the device to be configured.
[0062] Since the first key is released in a broadcasting manner, the process of obtaining the first key by the device to be configured is greatly simplified. Based on the one-to-many communication form of broadcasting, the broadcast information released by the gateway device can be obtained by all the devices to be configured that monitor a specific frequency band within the range of the broadcast signal. Therefore, the distribution of the first key can be achieved efficiently. After obtaining the first key, the device to be configured will actively send a connection request to the gateway device. In this way, mutual discovery between the gateway device and the device to be configured is achieved.
[0063] Before publishing broadcast information, the gateway device can configure parameters related to the broadcast information, including the device name that publishes the broadcast information, the broadcast interval, the broadcast channel, etc., and prepare the data content of the broadcast information. It can be understood that the broadcast channel is a specific channel, and the data content includes the first key.
[0064] Exemplarily, the devices to be configured may include smart home devices, such as smart light bulbs, smart thermostats, smart door locks or smart cameras. In addition to smart home scenarios, the devices to be configured may include devices in industrial automation and smart medical scenarios that need to be connected and configured with a gateway device. The number of devices to be configured may be one or more.
[0065] Step 103: In response to the connection request, establish a data link with the device to be configured.
[0066] After receiving a connection request from the device to be configured, the gateway device discovers the device to be configured and connects to the device to be configured, i.e., establishes a data link between the gateway device and the device to be configured. The data link is used to realize two-way communication between the gateway device and the device to be configured, including the transmission of relevant instruction data used to configure the device to be configured.
[0067] The connection request may include relevant information required to establish a communication connection, including the communication protocol used for the communication connection and parameters related to the communication protocol.
[0068] Exemplarily, the communication protocol may include the Advanced Encryption Standard (AES) protocol, in which case the connection request may include the length information of the encryption key used by AES, such as 128 bits, 192 bits or 256 bits, and the connection request may also include the working mode used by AES, such as Electronic Codebook Book (ECB), Cipher Block Chaining (CBC), Cipher FeedBack (CFB), Output FeedBack (OFB), Counter (CTR), etc.
[0069] Exemplarily, the communication protocol may include the Transport Layer Security (TLS) protocol, in which case the connection request may include the Certificate Authority (CA) used by TLS, load the client certificate, and the like.
[0070] The gateway device will analyze the connection request, including the communication protocol and related parameters in the connection request, to establish a data link for communication transmission with the device to be configured according to the analysis result.
[0071] Step 104: encrypt the configuration data using the first key to obtain ciphertext data, and send the ciphertext data to the device to be configured through the data link, so that after the device to be configured receives the ciphertext data, it decrypts the ciphertext data using the first key to obtain the configuration data, and the configuration data is used to configure the device to be configured.
[0072] After the data link is established, the first key is used to encrypt the data transmitted in the data link. The data in the data link may include configuration data for configuring the device to be configured. The configuration data is first encrypted into ciphertext data by the first key in the gateway device and sent to the device to be configured via the data link. In the device to be configured, the ciphertext data is decrypted by the first key obtained in the previous step to obtain the configuration data. According to the configuration data, the device to be configured will perform relevant configuration operations. Encryption with the first key ensures that the data transmission process in the data link remains private and complete.
[0073] In summary, in this embodiment, the gateway device publishes broadcast information with a first key through a specific channel, and the device to be configured listens to the specific channel and obtains the broadcast information, so as to realize the distribution of the first key based on broadcasting. After receiving the first key, a data link is established between the gateway device and the device to be configured, and the pairing communication between the device to be configured and the gateway device is realized. The configuration data in the data link is encrypted by the first key to ensure the security and integrity of the configuration data during the transmission process; the first key is published through the broadcast information, and the device to be configured actively sends a connection request to the gateway device after receiving the first key in the broadcast information to establish a data link for communication between the device to be configured and the gateway device, so that the same gateway device can simultaneously establish a data link with multiple devices to be configured within the range of the broadcast signal, and the gateway device can further simultaneously send configuration data to multiple devices to be configured through their respective data links to complete the configuration operation of the device to be configured. Compared with the related art, the tedious and time-consuming process of manual pairing one by one is avoided. Through the method provided in the embodiment of the present application, the pairing connection between the gateway device and the device to be configured and the configuration operation of the device to be configured can be efficiently completed, thereby improving the pairing efficiency between the device and the gateway.
[0074] Figure 2 Another embodiment of a communication method is provided, referring to Figure 2 The communication method is applied to the device to be configured, and the method may include the following steps:
[0075] Step 201: monitor a specific channel and receive broadcast information published by a gateway device through the specific channel.
[0076] After starting the device to be configured, it monitors a specific channel to receive broadcast information published by the gateway device through the specific channel; by monitoring and receiving broadcast information from the gateway device, the device to be configured can discover the gateway device so as to send a connection request to the gateway device in subsequent steps.
[0077] Step 201 corresponds to step 102. For related content, please refer to step 102 and will not be repeated here.
[0078] Step 202: Obtain a first key from the broadcast information.
[0079] The broadcast information includes the first key distributed by the gateway device, which can be used in subsequent steps. Therefore, when the device to be configured is started, it is configured to extract the first key from the broadcast information when receiving the broadcast information.
[0080] Exemplarily, the first key can be transmitted in the broadcast information in the form of an encrypted key to reduce the risk of plaintext leakage of the first key; for occasions where security requirements are not high, the first key can be transmitted in plaintext in the broadcast information to reduce the time required for the gateway device to prepare the broadcast information and the time required for the device to be configured to parse the broadcast information.
[0081] Step 203: When the first key is obtained, a connection request is sent to the gateway device, so that the gateway device receives the connection request and establishes a data link with the device to be configured.
[0082] After obtaining the first key, the device to be configured can send a connection request to the gateway device so that the gateway device can discover the device to be configured. The connection request can include the communication protocol required to establish a communication connection and parameters related to the communication protocol. The content related to the communication protocol can refer to step 103 and will not be repeated here.
[0083] It should be noted that in order to ensure that the data link is not interfered with, the gateway device can select other channels other than the specific channel in step 201 as the channel used for the data link. For example, the available frequency bands between the gateway device and the device to be configured include 2042 MHz and 2048 MHz. If 2042 MHz is used as the frequency band path for transmitting broadcast information, then the frequency band path of 2048 MHz can be used as the data link.
[0084] Step 204: Receive ciphertext data encrypted by the first key from the data link, and decrypt the ciphertext data by using the first key to obtain configuration data, where the configuration data is used to configure the device to be configured.
[0085] After the data link is established, the device to be configured can receive transmission data from the data link. The transmission data includes configuration data used to configure the device to be configured. In order to avoid leakage or tampering of the configuration data, the device to be configured generally receives the configuration data in the form of ciphertext data. The ciphertext data can be obtained by encrypting the configuration data in the gateway device with the first key. After the device to be configured obtains the ciphertext data, it decrypts the ciphertext data using the first key obtained from the broadcast information in the previous step to obtain the configuration data used to configure itself.
[0086] Exemplarily, the configuration data may include configuration data required for accessing the Internet, such as a user name and password for accessing a router.
[0087] In summary, in this embodiment, the gateway device publishes broadcast information with a first key through a specific channel, and the device to be configured listens to the specific channel and obtains the broadcast information, so as to realize the distribution of the first key based on broadcasting. After receiving the first key, a data link is established between the gateway device and the device to be configured, and the pairing communication between the device to be configured and the gateway device is realized. The configuration data in the data link is encrypted by the first key to ensure the security and integrity of the configuration data during the transmission process; the first key is published through the broadcast information, and the device to be configured actively sends a connection request to the gateway device after receiving the first key in the broadcast information to establish a data link for communication between the device to be configured and the gateway device, so that the same gateway device can simultaneously establish a data link with multiple devices to be configured within the range of the broadcast signal, and the gateway device can further simultaneously send configuration data to multiple devices to be configured through their respective data links to complete the configuration operation of the device to be configured. Compared with the related art, the tedious and time-consuming process of manual pairing one by one is avoided. Through the method provided in the embodiment of the present application, the pairing connection between the gateway device and the device to be configured and the configuration operation of the device to be configured can be efficiently completed, thereby improving the pairing efficiency between the device and the gateway.
[0088] Figure 3 An embodiment of the interactive steps of the communication method is provided, referring to Figure 3 , the method may include the following steps:
[0089] Step 301: The gateway device generates a first key in a first encryption mode;
[0090] This step refers to step 101 above and will not be described in detail here.
[0091] Step 302: The gateway device encrypts the first key in a second encryption manner to obtain a ciphertext key.
[0092] Before distributing the first key through broadcast information, the first key may be encrypted through a second encryption method to obtain a ciphertext key, and the first key may be protected in the form of the ciphertext key;
[0093] Exemplarily, the second encryption method may include RSA. In this case, the first key will be used as plain text to be protected. The gateway device will encrypt the first key using the public key agreed in advance with the device to be configured to obtain a ciphertext key. After the device to be configured obtains the ciphertext key, the ciphertext key will be decrypted by the private key in the device to be configured to extract the first key.
[0094] Step 303: The gateway device publishes broadcast information in a specific channel, where the broadcast information includes the ciphertext key;
[0095] This step refers to the above step 102. It should be noted that in step 303, the first key is included in the broadcast information in the form of an encrypted ciphertext key.
[0096] Step 304: the device to be configured monitors a specific channel and receives broadcast information to be published through the specific channel from the gateway device;
[0097] This step refers to step 201 above and will not be described in detail here.
[0098] Optionally, the gateway device includes a first Bluetooth module, the specific channel includes a Bluetooth channel, the first Bluetooth module is used to publish the broadcast information through the Bluetooth channel, and the second device includes a second Bluetooth module, and the second Bluetooth module is used to monitor the Bluetooth channel.
[0099] Selecting a Bluetooth module to publish broadcast information is an optional implementation method. The gateway device and the device to be configured are respectively configured with a first Bluetooth module and a second Bluetooth module when leaving the factory, wherein the first Bluetooth module can be used to publish Bluetooth broadcasts, and the second Bluetooth module can be used to receive Bluetooth broadcasts, that is, to publish broadcast information or receive broadcast information through a Bluetooth channel; when the broadcast information has been published through the first Bluetooth module, the gateway device will call the initialization function in the Bluetooth stack library and set relevant parameters for the Bluetooth broadcast, including the name of the device where the first Bluetooth module is located, the broadcast interval of the Bluetooth broadcast, the broadcast channel used for the Bluetooth broadcast, etc. After that, the gateway device will load the data content to be broadcast into the Bluetooth module to broadcast the data content to the surrounding devices listening to the broadcast channel.
[0100] Bluetooth Low Energy (BLE) broadcast is a preferred implementation method for the Bluetooth module to publish broadcast information. BLE allows devices at both ends of the Bluetooth channel to discover each other without maintaining a normal connection. Only when needed, the data link in the Bluetooth channel is opened for data transmission.
[0101] Exemplarily, the available channel range of a gateway device configured with BLE includes 2402MHz to 2480MHz. One of the frequency bands among 2402MHZ, 2426MHz, and 2480MHZ can be used as a specific channel for the BLE device to publish broadcast information. The device to be configured with BLE monitors the three frequency bands of 2402MHZ, 2426MHz, and 2480MHZ to receive broadcast information from the gateway device; the remaining frequency bands can be used to establish a data link between subsequent gateway devices and the devices to be configured.
[0102] Step 305: The device to be configured verifies the integrity of the broadcast information by a preset verification method, and proceeds to step 306 if the integrity of the broadcast information passes the verification;
[0103] After receiving the broadcast information, the device to be configured can perform a preliminary verification of the broadcast information to ensure the integrity of the broadcast information. When it is confirmed that the integrity of the broadcast information passes the verification, it can be confirmed that the broadcast information has not been damaged during the broadcast transmission process, and the required ciphertext key encrypted by the first key can be extracted from it.
[0104] Exemplarily, methods such as cyclic redundancy check (CRC) and hash-based message authentication code (HMAC) may be selected as preset verification methods to verify the integrity of the broadcast information.
[0105] Optionally, step 305 may include:
[0106] Sub-step 3051: the device to be configured obtains a first verification code of the broadcast information, where the first verification code is calculated by the gateway device using a preset verification algorithm;
[0107] Sub-step 3052: The device to be configured calculates a second verification code of the broadcast information in the device to be configured by using the verification algorithm;
[0108] Sub-step 3053: When the first verification code is consistent with the second verification code, the device to be configured confirms that the integrity of the broadcast information has passed the verification.
[0109] Sub-steps 3051 to 3053 illustrate an optional method of verifying broadcast information; before the gateway device publishes the broadcast information, based on the data content of the broadcast information, a first verification code is calculated through a preset verification algorithm, and the first verification code is broadcast synchronously with the data content of the broadcast information, that is, when the device to be configured receives the broadcast information, it also receives the first verification code synchronously; after the device to be configured receives the broadcast information, it calculates a second verification code for the data content of the received broadcast information through the same agreed verification algorithm. When the second verification code is consistent with the first verification code, it can be confirmed that the broadcast information has passed the integrity check. Otherwise, it will be confirmed that the broadcast information has not passed the integrity check. At this time, the device to be configured will abandon the broadcast information obtained this time and continue to listen to the broadcast information released in the next broadcast interval through a specific channel; by comparing the similarities and differences between the first verification code and the second verification code, it is confirmed whether the data content of the broadcast information has changed during the broadcast transmission process, thereby ensuring the integrity of the broadcast information.
[0110] Step 306: The device to be configured obtains the ciphertext key from the broadcast information, and decrypts the ciphertext key using a preset second key that matches the second encryption method to obtain the first key.
[0111] Corresponding to step 302, the ciphertext key obtained by the second encryption method needs to be decrypted by the second key matching the second encryption method to obtain the first key; it can be understood that if the second encryption method is RSA, then the second key is the private key of the device to be configured.
[0112] The second key may be pre-configured in the device to be configured to ensure the uniqueness and uniformity of the second key; illustratively, when the device to be configured is produced, multiple second keys in a unified format may be written into respective storage areas of multiple devices to be configured.
[0113] Step 307: The device to be configured sends a connection request to the gateway device when obtaining the first key;
[0114] This step may refer to the above step 203 and will not be described in detail here.
[0115] Step 308: The gateway device establishes a data link with the device to be configured in response to the connection request;
[0116] This step may refer to the above step 103 and will not be described in detail here.
[0117] Step 309: The gateway device encrypts the configuration data using the first key to obtain ciphertext data, and sends the ciphertext data to the device to be configured through the data link;
[0118] This step may refer to the above step 104 and will not be described in detail here.
[0119] Step 310: The device to be configured receives the ciphertext data encrypted by the first key from the data link, and decrypts the ciphertext data by using the first key to obtain configuration data, where the configuration data is used to configure the device to be configured.
[0120] This step may refer to the above step 204 and will not be described in detail here.
[0121] Step 311: The gateway device updates the first key after a preset period, and re-enters step 303 after updating the first key;
[0122] After establishing the data link and completing the configuration operation of the device to be configured, the gateway device can also update the first key after a preset period, and re-pair and connect with the device to be configured after updating the first key, thereby enhancing the security of the first key and further ensuring the security of data transmitted in the data link between the gateway device and the device to be configured.
[0123] For example, taking smart home as an example, for smart light bulbs, the preset period can be set to one quarter, and for smart door locks, the preset period can be set to one week.
[0124] In summary, in this embodiment, the gateway device publishes broadcast information with a first key through a specific channel, and the device to be configured listens to the specific channel and obtains the broadcast information, so as to realize the distribution of the first key based on broadcasting. After receiving the first key, a data link is established between the gateway device and the device to be configured, and the pairing communication between the device to be configured and the gateway device is realized. The configuration data in the data link is encrypted by the first key to ensure the security and integrity of the configuration data during the transmission process; the first key is published through the broadcast information, and the device to be configured actively sends a connection request to the gateway device after receiving the first key in the broadcast information to establish a data link for communication between the device to be configured and the gateway device, so that the same gateway device can simultaneously establish a data link with multiple devices to be configured within the range of the broadcast signal, and the gateway device can further simultaneously send configuration data to multiple devices to be configured through their respective data links to complete the configuration operation of the device to be configured. Compared with the related art, the tedious and time-consuming process of manual pairing one by one is avoided. Through the method provided in the embodiment of the present application, the pairing connection between the gateway device and the device to be configured and the configuration operation of the device to be configured can be efficiently completed, thereby improving the pairing efficiency between the device and the gateway.
[0125] Figure 4 It is another communication method provided in the embodiment of the present application, referring to Figure 4 , the method may include the following steps:
[0126] Step S1: The gateway device generates a password or a key.
[0127] It can be understood that the key or password is equivalent to the first key in step 101 above.
[0128] Step S2: The gateway device sends the password or key to the device to be networked via the Bluetooth module.
[0129] It can be understood that step S2 is equivalent to step 102, wherein the Bluetooth module is used to send broadcast information in the form of Bluetooth broadcast, the broadcast information includes a password or a key, and the device to be configured is equivalent to the device to be configured. For example, taking smart home devices as an example, the device to be configured indicates that the device has just been unpacked or restored to factory settings and needs to be re-configured.
[0130] Step S3: the network-to-be-connected device receives the Bluetooth broadcast signal and extracts the password or key.
[0131] It can be understood that step S3 is equivalent to step 201 and step 202.
[0132] Step S4: The network device to be configured uses the extracted password or key to perform subsequent communication configuration.
[0133] It can be understood that step S4 is equivalent to the above steps 203 and 204.
[0134] refer to Figure 5 , which shows a communication device 50 provided in an embodiment of the present application, the communication device 50 is applied to a gateway device, and the communication device 50 includes:
[0135] The key generation module 501 is used to generate a first key in a first encryption mode;
[0136] Broadcast publishing module 502: used to publish broadcast information in a specific channel, the broadcast information includes the first key; the broadcast information is used to be received by the device to be configured that monitors the specific channel, and obtain the first key from the broadcast information, and the device to be configured is also used to send a connection request to the gateway device when the first key is obtained;
[0137] Link establishing module 503: used to establish a data link with the device to be configured in response to the connection request;
[0138] The first configuration module 504 is used to encrypt the configuration data by using the first key to obtain ciphertext data, and send the ciphertext data to the device to be configured through the data link, so that after the device to be configured receives the ciphertext data, it decrypts the ciphertext data by using the first key to obtain the configuration data, and the configuration data is used to configure the device to be configured.
[0139] Optionally, the gateway device includes a first Bluetooth module, the specific channel includes a Bluetooth channel, the first Bluetooth module is used to publish the broadcast information through the Bluetooth channel, and the second device includes a second Bluetooth module, and the second Bluetooth module is used to monitor the Bluetooth channel.
[0140] Optionally, the device 50 may further include:
[0141] Key encryption module: used to encrypt the first key in a second encryption method to obtain a ciphertext key, so that after the device to be configured obtains the ciphertext key from the broadcast information, it decrypts the ciphertext key using a second key matching the second encryption method to obtain the first key.
[0142] Optionally, the device 50 may further include:
[0143] Update module: used for updating the first key after a preset period, and re-executing the broadcast publishing module 502 after updating the first key.
[0144] refer to Figure 6 , which shows another communication device 60 provided in an embodiment of the present application, the communication device 60 is applied to a device to be configured, and the device 60 includes:
[0145] Monitoring module 601: used to monitor a specific channel and receive broadcast information released by a gateway device through the specific channel;
[0146] The key acquisition module 602 is used to acquire a first key from the broadcast information;
[0147] The request sending module 603 is used to send a connection request to the gateway device when the first key is obtained, so that the gateway device receives the connection request and establishes a data link with the device to be configured;
[0148] The second configuration module 604 is configured to receive the ciphertext data encrypted by the first key from the data link, and decrypt the ciphertext data by using the first key to obtain configuration data, where the configuration data is used to configure the device to be configured.
[0149] Optionally, the key acquisition module 602 may include:
[0150] A first extraction submodule is used to obtain a ciphertext key from the broadcast information; the first key is encrypted by the second encryption method in the gateway device to obtain the ciphertext key;
[0151] The second extraction submodule is used to decrypt the ciphertext key by using a preset second key matching the second encryption method to obtain the first key.
[0152] Optionally, the device 50 may further include:
[0153] Verification module: used to verify the integrity of the broadcast information through a preset verification method;
[0154] Verification and confirmation module: used to execute the key acquisition module 602 when the integrity of the broadcast information passes the verification.
[0155] Optionally, the verification module may include:
[0156] A first verification code submodule: used to obtain a first verification code of the broadcast information, wherein the first verification code is calculated by the gateway device through a preset verification algorithm;
[0157] A second verification code submodule: used for calculating a second verification code of the broadcast information in the device to be configured by using the verification algorithm;
[0158] Comparison confirmation submodule: used to confirm that the integrity of the broadcast information has passed the verification when the first verification code is consistent with the second verification code.
[0159] In summary, in this embodiment, the gateway device publishes broadcast information with a first key through a specific channel, and the device to be configured listens to the specific channel and obtains the broadcast information, so as to realize the distribution of the first key based on broadcasting. After receiving the first key, a data link is established between the gateway device and the device to be configured, and the pairing communication between the device to be configured and the gateway device is realized. The configuration data in the data link is encrypted by the first key to ensure the security and integrity of the configuration data during the transmission process; the first key is published through the broadcast information, and the device to be configured actively sends a connection request to the gateway device after receiving the first key in the broadcast information to establish a data link for communication between the device to be configured and the gateway device, so that the same gateway device can simultaneously establish a data link with multiple devices to be configured within the range of the broadcast signal, and the gateway device can further simultaneously send configuration data to multiple devices to be configured through their respective data links to complete the configuration operation of the device to be configured. Compared with the related art, the tedious and time-consuming process of manual pairing one by one is avoided. Through the method provided in the embodiment of the present application, the pairing connection between the gateway device and the device to be configured and the configuration operation of the device to be configured can be efficiently completed, thereby improving the pairing efficiency between the device and the gateway.
[0160] Reference Figure 7 , an embodiment of the present application also discloses an electronic device; the electronic device 700 may include one or more of the following components: a processing component 702, a memory 704, a power component 706, a multimedia component 708, an audio component 710, an input / output (I / O) interface 712, a sensor component 714, and a communication component 716.
[0161] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0162] The memory 704 is used to store various types of data to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, multimedia, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0163] The power supply component 706 provides power to the various components of the electronic device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 700.
[0164] The multimedia component 708 includes an interface that provides an output interface between the electronic device 700 and the user. In some embodiments, the interface may include a liquid crystal display (LCD) and a touch panel (TP). If the interface includes a touch panel, the interface may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0165] The audio component 710 is used to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is used to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0166] The input / output I / O interface 512 provides an interface between the processing component 702 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0167] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0168] The communication component 716 is used to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0169] In an exemplary embodiment, the electronic device 700 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to implement a water outlet flow control method for a water supply device provided in an embodiment of the present application.
[0170] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0171] Figure 88 is a block diagram of an electronic device 800 according to another embodiment of the present invention. For example, the electronic device 800 may be provided as a server. Figure 8 The electronic device 800 includes a processing component 822, which further includes one or more processors, and a memory resource represented by a memory 832 for storing instructions that can be executed by the processing component 822, such as an application. The application stored in the memory 832 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 822 is configured to execute instructions to execute a water flow control method for a water supply device provided in an embodiment of the present application.
[0172] The electronic device 800 may also include a power supply component 826 configured to perform power management of the electronic device 800, a wired or wireless network interface 850 configured to connect the electronic device 800 to a network, and an input / output (I / O) interface 858. The electronic device 800 may operate based on an operating system stored in the memory 832, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0173] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0174] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A communication method, characterized in that: Applied to a gateway device, the method comprises: generating a first key in a first encryption manner; Publishing broadcast information on a specific channel, the broadcast information including the first key; the broadcast information is used for being received by a device to be configured that monitors the specific channel, and obtaining the first key from the broadcast information, and the device to be configured is further used to send a connection request to the gateway device when obtaining the first key; In response to the connection request, establishing a data link with the device to be configured; The configuration data is encrypted by the first key to obtain ciphertext data, and the ciphertext data is sent to the device to be configured through the data link, so that after the device to be configured receives the ciphertext data, the ciphertext data is decrypted by the first key to obtain the configuration data, and the configuration data is used to configure the device to be configured.
2. The method according to claim 1, characterized in that: The gateway device includes a first Bluetooth module, the specific channel includes a Bluetooth channel, the first Bluetooth module is used to publish the broadcast information through the Bluetooth channel, and the second device includes a second Bluetooth module, and the second Bluetooth module is used to monitor the Bluetooth channel.
3. The method according to claim 1, characterized in that: Before the step of publishing broadcast information on a specific channel, the method further includes: The first key is encrypted in a second encryption mode to obtain a ciphertext key, so that the to-be-configured device obtains the ciphertext key from the broadcast information, and then decrypts the ciphertext key by a second key matching the second encryption mode to obtain the first key.
4. The method according to claim 1, characterized in that: The method further comprises: The first key is updated after a preset period, and after the first key is updated, the step of publishing broadcast information through a specific channel is re-entered.
5. A communication method, characterized in that: Applied to the device to be configured, the method includes: Monitor a specific channel and receive broadcast information published by a gateway device through the specific channel; Obtaining a first key from the broadcast information; In the case of obtaining the first key, sending a connection request to the gateway device, so that the gateway device receives the connection request and establishes a data link with the device to be configured; The ciphertext data encrypted by the first key is received from the data link, and the ciphertext data is decrypted by the first key to obtain configuration data, where the configuration data is used to configure the device to be configured.
6. The method according to claim 5, characterized in that The obtaining the first key from the broadcast information comprises: Obtaining a ciphertext key from the broadcast information; the first key is encrypted by the second encryption method in the gateway device to obtain the ciphertext key The ciphertext key is decrypted by using a preset second key matching the second encryption method to obtain the first key.
7. The method according to claim 5, characterized in that Before the step of obtaining the first key from the broadcast information, the method further comprises: Verifying the integrity of the broadcast information by a preset verification method; When the integrity of the broadcast information passes the verification, the process proceeds to the step of obtaining the first key from the broadcast information.
8. The method according to claim 7, characterized in that The verification method comprises: Acquire a first verification code of the broadcast information, where the first verification code is calculated by the gateway device using a preset verification algorithm; Calculating a second verification code of the broadcast information in the device to be configured by using the verification algorithm; When the first verification code is consistent with the second verification code, it is confirmed that the integrity of the broadcast information has passed the verification.
9. A communication device, characterized in that: The communication device is applied to a gateway device, and the communication device includes: A key generation module: used to generate a first key in a first encryption mode; A broadcast publishing module: used for publishing broadcast information in a specific channel, wherein the broadcast information includes the first key; the broadcast information is used for receiving the to-be-configured device that monitors the specific channel, and obtaining the first key from the broadcast information; the to-be-configured device is also used for sending a connection request to the gateway device when obtaining the first key; A link establishing module: used for establishing a data link with the device to be configured in response to the connection request; The first configuration module is used to encrypt the configuration data by using the first key to obtain ciphertext data, and send the ciphertext data to the device to be configured through the data link, so that after the device to be configured receives the ciphertext data, it decrypts the ciphertext data by using the first key to obtain the configuration data, and the configuration data is used to configure the device to be configured.
10. A communication device, characterized in that: The communication device is applied to a device to be configured, and the communication device includes: Monitoring module: used to monitor a specific channel and receive broadcast information released by the gateway device through the specific channel; A key acquisition module: used to acquire a first key from the broadcast information; A request sending module: configured to send a connection request to the gateway device when the first key is obtained, so that the gateway device receives the connection request and establishes a data link with the device to be configured; The second configuration module is used to receive the ciphertext data encrypted by the first key from the data link, and decrypt the ciphertext data by using the first key to obtain configuration data, wherein the configuration data is used to configure the device to be configured.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.