Data transmission packet assembly method, device, electronic device and storage medium
By adopting a unified SDK encapsulation interface and encryption processing between mobile terminals and smart devices, the problem of inconsistent data formats among different smart device manufacturers is solved, achieving compatibility and confidentiality in information transmission.
Patent Information
- Application Number
- CN202011593838.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-29
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2040-12-29
AI Technical Summary
The inconsistent structure and length of device fields and binding information fields among different smart device manufacturers make it difficult for mobile terminals to handle them in a compatible manner, and also pose data confidentiality issues during information exchange.
A unified SDK is used to encapsulate the interface for transmitting device identification and binding information between mobile terminals and smart devices. The encryption is performed using a symmetric key and an initialization vector to generate data packets of the same standard.
It achieves compatibility of device data formats from different smart device manufacturers, ensures the confidentiality of information transmission, and avoids mobile terminals directly processing device fields and bound information fields.
Smart Images

Figure CN114697410B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a data transmission packet assembly method, device, electronic equipment and storage medium. Background Art
[0002] With the vigorous development of Internet of Things technology, smart devices have become popular. Users can not only remotely control devices and check the status of devices through mobile phones, but also enjoy a series of intelligent scenarios brought about by device linkage, giving users a rich intelligent experience.
[0003] Connecting devices to the Internet is the first step towards intelligence. Currently, there are two common ways to configure the network: smart devices and routers establish wireless communication to directly obtain network configuration information and device binding information; smart devices and smart mobile terminals directly establish communication to obtain network configuration information and device binding information. Since these two methods involve the interaction of sensitive information such as device information and network configuration binding information, data confidentiality between different manufacturers has become an urgent problem to be solved.
[0004] Since the smart device manufacturer and the mobile terminal or router manufacturer are not the same, in order to realize the packaging of network configuration information and device binding information: the mobile terminal manufacturer and the smart device manufacturer need to communicate specific details such as the device field and the binding information field, but sometimes the smart device manufacturer does not want to disclose this information; since the device field and binding information field structure and length of each smart device manufacturer are different, the whole package is encrypted and decrypted, and the mobile terminal manufacturer needs to process different device fields and binding information fields, and compatibility cannot be achieved. Summary of the invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a data transmission packaging method, so that the mobile terminal and the smart device have a unified SDK packaging interface, and the device identification and device binding information can be transmitted between the mobile terminal and the smart device through the same standard interface, so as to avoid the mobile terminal from obtaining and processing the device field and binding information field of each smart device, and achieve compatibility with the device data format requirements of different smart device manufacturers, and also keep the device field and binding information field of the smart device manufacturer confidential.
[0006] The invention also provides a data transmission packet assembly device, electronic equipment and storage medium.
[0007] The data transmission packet assembly method according to the first aspect of the present invention is applied to a mobile terminal, comprising:
[0008] Acquire a first data packet sent by a smart device, where the first data packet is generated based on a device identification of the smart device;
[0009] Calling a first SDK encapsulation interface to parse the first data packet to obtain a device identifier of the smart device;
[0010] Call the second SDK encapsulation interface to encapsulate the device identifier to obtain device binding information;
[0011] Generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device;
[0012] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0013] The data transmission packet assembly method provided by the present invention also has the following additional technical features:
[0014] Furthermore, the calling of the second SDK encapsulation interface to encapsulate the device identifier to obtain the device binding information includes:
[0015] Generate a binding information structure according to the device identifier;
[0016] Generate a first ciphertext according to a first symmetric key, a first initialization vector and a binding information structure; wherein the first symmetric key is randomly configured by the smart device, and the first initialization vector is randomly generated in a symmetric encryption algorithm;
[0017] The device binding information is obtained by encapsulating the first ciphertext and the first initialization vector.
[0018] Further, generating a second data packet according to the device binding information and the network configuration information includes:
[0019] Generate a shared key based on the first symmetric key and the first public key;
[0020] Generate a combined data packet based on device binding information and network configuration information;
[0021] generating a second ciphertext according to the shared secret key, the second initialization vector and the combined data packet;
[0022] The second data packet is obtained by encapsulating the second ciphertext, the first public key and the second initialization vector.
[0023] Furthermore, the calling of the first SDK encapsulation interface to parse the first data packet to obtain the device identification of the smart device includes:
[0024] The first data packet is processed by packetization to obtain a device field and a mobile terminal definition field;
[0025] Perform a reverse concatenation process on the device field to obtain a third ciphertext and a third initialization vector;
[0026] Decrypting the third ciphertext to obtain the first symmetric key, the third initialization vector, and the first plaintext;
[0027] Performing a reverse concatenation process on the first plaintext to obtain a second public key and a device identification structure;
[0028] Get the device ID according to the device ID structure.
[0029] The data transmission packet assembly method according to the second aspect of the present invention is applied to a smart device and comprises:
[0030] Encapsulating the device identification of the smart device using a first SDK encapsulation interface to generate a first data packet, and sending the first data packet to the mobile terminal;
[0031] Obtain a second data packet sent by the mobile terminal, and parse the second data packet using a second SDK encapsulation interface to obtain network configuration information and device binding information;
[0032] Establishing a connection with the cloud through a router according to the network configuration information, and sending the device binding information to the cloud;
[0033] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0034] Furthermore, the step of encapsulating the device identification of the smart device using the first SDK encapsulation interface to generate a first data packet includes:
[0035] Generate a device identification structure according to the device identification;
[0036] Generate a first plaintext according to the second public key and the device identification structure;
[0037] Generate a third ciphertext according to the first symmetric key, the third initialization vector and the first plaintext;
[0038] generating a device field according to the third ciphertext and the third initialization vector;
[0039] A first data packet is generated according to the device field and the mobile terminal definition field.
[0040] Further, the second SDK encapsulation interface is used to parse the second data packet to obtain network configuration information and device binding information, including:
[0041] Subpacketizing the second data packet to obtain a second ciphertext, a first public key, and a second initialization vector;
[0042] Decrypting the second ciphertext to obtain a shared key, a second initialization vector, and a combined data packet;
[0043] The combined data packet is sub-packetized to obtain device binding information and network configuration information.
[0044] The data transmission packet assembly device according to the third aspect of the present invention is applied to a mobile terminal and includes:
[0045] A first acquisition module, configured to acquire a first data packet sent by a smart device, where the first data packet is generated based on a device identification of the smart device;
[0046] A first parsing module, configured to call a first SDK encapsulation interface to parse the first data packet to obtain a device identification of the smart device;
[0047] The first encapsulation module is used to call the second SDK encapsulation interface to encapsulate the device identifier to obtain device binding information;
[0048] A generating module, configured to generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device;
[0049] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0050] The data transmission packet assembly device according to the fourth aspect of the present invention is applied to a smart device, comprising:
[0051] A second encapsulation module is used to encapsulate the device identification of the smart device using the first SDK encapsulation interface, generate a first data packet, and send the first data packet to the mobile terminal;
[0052] A second parsing module is used to obtain a second data packet sent by the mobile terminal, and parse the second data packet using a second SDK encapsulation interface to obtain network configuration information and device binding information;
[0053] A processing module, used to establish a connection with the cloud through a router according to the network configuration information, and send the device binding information to the cloud;
[0054] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0055] The electronic device of the fifth aspect of the present invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned data transmission packet assembly method when executing the program.
[0056] The non-transitory computer-readable storage medium of the sixth aspect of the present invention stores a computer program thereon, which, when executed by a processor, implements the steps of the packetization method for data transmission as described above.
[0057] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 It is a flow chart of the packet assembly method for data transmission of the present invention;
[0060] Figure 2 is a schematic diagram of the generation process of the second data packet of the present invention;
[0061] Figure 3 is another flow chart of the packet assembly method for data transmission of the present invention;
[0062] Figure 4 is a schematic diagram of a process of generating a first data packet of the present invention;
[0063] Figure 5 It is a structural schematic diagram of a packet assembly device for data transmission of the present invention;
[0064] Figure 6 It is a structural schematic diagram of a packet assembly device for data transmission of the present invention;
[0065] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0066] The following is a further detailed description of the embodiments of the present invention in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention but are not intended to limit the scope of the present invention.
[0067] Figure 1 A schematic diagram showing a flow chart of a data transmission packet assembly method provided by the present invention is shown in FIG. Figure 1 The method is applied to a mobile terminal and comprises the following steps:
[0068] 11. Obtain a first data packet sent by the smart device, where the first data packet is generated based on a device identification of the smart device;
[0069] 12. Call the first SDK encapsulation interface to parse the first data packet to obtain a device identifier of the smart device;
[0070] 13. Call the second SDK encapsulation interface to encapsulate the device identifier to obtain device binding information;
[0071] 14. Generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device;
[0072] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0073] Regarding steps 11 to 14, it should be noted that in the present invention, after the smart device enters the network configuration state, it establishes communication with the mobile terminal and transmits the device identification to the mobile terminal. The mobile terminal determines whether it supports senseless network configuration by the device identification. If it does, it transmits the network configuration information and device binding information to the smart device. The smart device obtains the network configuration information to connect to the router, and then connects to the cloud through the router and transmits the device binding information. The cloud then interacts with the mobile terminal to verify the device binding information and complete the device confirmation.
[0074] In the above description, the smart device needs to send the device identification to the mobile terminal. In order to avoid the smart device manufacturer informing the mobile terminal manufacturer of the format of the device identification in advance, the method of the present invention needs to encapsulate the device identification on the smart device. Here, the SDK encapsulation interface is used to encapsulate the device identification, package it into a data packet (i.e., the first data packet mentioned in the step), and then send the data packet to the mobile terminal.
[0075] In the present invention, SDK, namely Software Development Kit, refers to a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.
[0076] In the present invention, the mobile terminal is provided by the smart terminal manufacturer with two SDK packaging interfaces, namely the first SDK packaging interface and the second SDK packaging interface. The first SDK packaging interface and the second SDK packaging interface are constructed based on the specification file of the device manufacturer.
[0077] Since the data packet received by the mobile terminal is obtained by processing the device identification using the first SDK encapsulation interface, the first SDK encapsulation interface is used to perform reverse processing on the received data packet, thereby obtaining the device identification of the smart device.
[0078] Therefore, the mobile terminal receives the data packet sent by the smart device, calls the first SDK encapsulation interface to parse the first data packet, and obtains the device identification of the smart device.
[0079] In the above description, the mobile terminal needs to feed back device binding information for the smart device to the smart device, and the device binding information is used for the cloud and the mobile terminal to confirm the ownership of the smart device.
[0080] In order to avoid the smart device manufacturer informing the mobile terminal manufacturer of the format of the device binding information in advance, the method of the present invention requires the device binding information to be encapsulated. Here, the SDK encapsulation interface is also used to encapsulate the device binding information, and then it is packaged into a data packet (i.e., the second data packet mentioned in the step) with the network configuration information (the SSID and password of the router), and then the data packet is sent to the smart device.
[0081] In the present invention, in order to distinguish the working nature of the SDK encapsulation interface, the second SDK encapsulation interface is used to encapsulate the device identification to obtain the device binding information.
[0082] Therefore, the mobile terminal calls the second SDK encapsulation interface to encapsulate the device identifier to obtain the device binding information.
[0083] The data transmission packaging method provided by the present invention enables the mobile terminal and the smart device to have a unified SDK packaging interface, and can transmit the device identification and device binding information between the mobile terminal and the smart device through the same standard interface, thereby avoiding the mobile terminal from obtaining and processing the device field and binding information field of each smart device, achieving compatibility with the device data format requirements of different smart device manufacturers, and also keeping the device field and binding information field of the smart device manufacturer confidential.
[0084] In the further method of the above invention, the processing of calling the second SDK encapsulation interface to encapsulate the device identifier to obtain the device binding information is mainly explained, as follows:
[0085] Generate a binding information structure based on the device identifier;
[0086] Generate a first ciphertext according to a first symmetric key, a first initialization vector and a binding information structure; wherein the first symmetric key is randomly configured by the smart device, and the first initialization vector is randomly generated in a symmetric encryption algorithm;
[0087] The device binding information is obtained by encapsulating the first ciphertext and the first initialization vector.
[0088] In this regard, it should be noted that, in the present invention, the second SDK encapsulation interface provided by the smart device manufacturer is called to generate a binding information structure for device binding based on the smart device manufacturer specification and device identification, and then a set of initialization vectors (ie, the first initialization vector) is randomly generated.
[0089] Then, the binding information structure is symmetrically encrypted using the symmetric key (i.e., the first symmetric key) and the initialization vector sent by the smart device to generate a ciphertext (i.e., the first ciphertext). The generated ciphertext is then concatenated with the initialization vector through an algorithm to form the device binding information.
[0090] A further method of the present invention encrypts and concatenates a binding information structure generated for device binding based on the smart device manufacturer's specifications and device identification through an SDK encapsulation interface, thereby obtaining device binding information transmitted between a mobile terminal and a smart device using the same standard interface, thereby facilitating the use of the information by the smart device.
[0091] In the further method of the above invention, the processing of generating the second data packet according to the device binding information and the network configuration information is mainly explained as follows:
[0092] Generate a shared key based on the first symmetric key and the first public key;
[0093] Generate a combined data packet based on device binding information and network configuration information;
[0094] generating a second ciphertext according to the shared secret key, the second initialization vector and the combined data packet;
[0095] The second data packet is obtained by encapsulating the second ciphertext, the first public key and the second initialization vector.
[0096] In this regard, it should be noted that in the present invention, after obtaining the device binding information, the mobile terminal needs to send the device binding information and the network configuration information to the smart device, so that the smart device can connect to the router according to the network configuration information, and then establish a connection with the cloud. Here, the device binding information and the network configuration information need to be encapsulated and packaged to obtain a data packet, and then the data packet is sent to the smart device.
[0097] The mobile terminal first randomly generates a set of public-private key pairs for key exchange, namely a first public key and a first private key, through a key generation algorithm.
[0098] The first symmetric key and the first public key are used to generate a shared key, and then the device binding information and the network configuration information are used to generate a combined data packet, where the combined data packet represents that the device binding information and the network configuration information are taken as one data packet.
[0099] Symmetric encryption is performed according to the shared secret key, the second initialization vector and the combined data packet to generate a second ciphertext, and then encapsulated according to the second ciphertext, the first public key and the second initialization vector to obtain a second data packet.
[0100] A further method of the present invention is that since the network configuration information is a configuration format of a router, when a smart device has a network configuration requirement, the network configuration information and device binding information are reasonably encrypted and packaged to achieve data transmission.
[0101] In the further method of the above invention, the processing of calling the first SDK encapsulation interface to parse the first data packet and obtain the device identification of the smart device is mainly explained as follows:
[0102] The first data packet is processed by packetization to obtain a device field and a mobile terminal definition field;
[0103] Perform a reverse concatenation process on the device field to obtain a third ciphertext and a third initialization vector;
[0104] Decrypting the third ciphertext to obtain the first symmetric key, the third initialization vector, and the first plaintext;
[0105] Performing a reverse concatenation process on the first plaintext to obtain a second public key and a device identification structure;
[0106] Get the device ID according to the device ID structure.
[0107] In this regard, it should be noted that, in the present invention, the first data packet is obtained by the smart device using the first SDK encapsulation interface to encapsulate and pack the device identification. For this purpose, the mobile terminal calls the same first SDK encapsulation interface to perform reverse operations on the first data packet, thereby obtaining the device identification.
[0108] Table 1 shows the structure content of the first data packet, and Table 2 shows the structure content of the second data packet.
[0109] Table 1
[0110]
[0111] Table 2
[0112]
[0113] The generation process of the second data packet is explained below with a specific example, as follows:
[0114] After the mobile terminal receives the first data packet sent by the smart device, the first SDK encapsulation (SDK1) interface is used to parse the encapsulated device field F1. SDK1 integrates a data parsing algorithm, first reverses the splicing process to obtain the initialization vector iv3 and the ciphertext E1, and decrypts the ciphertext E1 using the symmetric key K1 and iv3 to obtain the plaintext C1. After reverse splicing, the public key N1 and the device identification structure S1 of the device-side key exchange are obtained. The device identification structure S1 is parsed to determine whether the device supports sensorless network configuration, and the judgment result and the public key N1 are fed back to the mobile terminal as the standard output of the SDK1 interface.
[0115] See also Figure 2 , the mobile terminal receives the above judgment result. If the smart device does not support senseless network configuration, the mobile terminal does not process the first data packet. If the smart device supports senseless network configuration, the second SDK encapsulation interface (SDK2) provided by the smart device manufacturer is called to generate a set of binding information structures S2 for device binding according to the smart device manufacturer's specifications. At the same time, SDK2 transmits the binding information structure S2 to the cloud of the smart device manufacturer through the mobile terminal for backup. The mobile terminal also randomly generates a set of initialization vectors iv1, and uses the symmetric secret key K1 and iv1 on the device side to symmetrically encrypt S2. The generated ciphertext E2 and iv2 are spliced and encapsulated into device binding information F2 through the algorithm.
[0116] The mobile phone encrypts the connected network information R1 (router's SSID, password, channel, etc.) and the device binding information F2 encapsulated by SDK2 through a key exchange algorithm to generate an encrypted data packet G2.
[0117] A shared key K2 is generated by a key generation algorithm based on the symmetric key K1 and the public key N1, and then a ciphertext E3 is generated by the shared key K2, the initialization vector iv2 and the data packet G2. The second data packet is then encapsulated based on the ciphertext E3, the public key N2 and the initialization vector iv3.
[0118] Figure 3 A schematic diagram showing a flow chart of a data transmission packet assembly method provided by the present invention is shown in FIG. Figure 3 The method is applied to a smart terminal and comprises the following steps:
[0119] 31. Encapsulate the device identifier of the smart device using the first SDK encapsulation interface, generate a first data packet, and send the first data packet to the mobile terminal;
[0120] 32. Obtain a second data packet sent by the mobile terminal, and parse the second data packet using a second SDK encapsulation interface to obtain network configuration information and device binding information;
[0121] 33. Establish a connection with the cloud through the router according to the network configuration information, and send the device binding information to the cloud;
[0122] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0123] Regarding step S31 and step S32, it should be noted that, in the present invention, after the smart device enters the network configuration state, it establishes communication with the mobile terminal and transmits the device identification to the mobile terminal.
[0124] In order to avoid the smart device manufacturer informing the mobile terminal manufacturer of the format of the device identifier in advance, the smart device uses the SDK encapsulation interface to encapsulate the device identifier, packages it into a data packet (i.e., the first data packet mentioned in the step), and then sends the data packet to the mobile terminal.
[0125] In the present invention, the mobile terminal is provided by the smart terminal manufacturer with two SDK packaging interfaces, namely the first SDK packaging interface and the second SDK packaging interface. The first SDK packaging interface and the second SDK packaging interface are constructed based on the specification file of the device manufacturer.
[0126] The processing of the first data packet and the generation of the second data packet by the mobile terminal are described in detail in the above content and will not be repeated here.
[0127] The mobile terminal feeds back the second data packet to the smart device, and the smart device parses the second data packet using the second SDK encapsulation interface to obtain the network configuration information and the device binding information.
[0128] Subsequently, the smart device establishes a connection with the cloud through the router based on the network configuration information and sends the device binding information to the cloud.
[0129] Specifically, after the smart device receives the second data packet, it first decrypts the data packet through the secret key exchange algorithm to obtain the network configuration information and device binding information, and then parses the device binding information to obtain the binding information structure. The smart device connects to the router through the network configuration information, logs in to the cloud, transmits the binding information structure to the cloud, and verifies it with the binding information structure sent by the mobile terminal to the cloud to complete the binding.
[0130] The data transmission packaging method provided by the present invention enables the mobile terminal and the smart device to have a unified SDK packaging interface, and can transmit the device identification and device binding information between the mobile terminal and the smart device through the same standard interface, thereby avoiding the mobile terminal from obtaining and processing the device field and binding information field of each smart device, achieving compatibility with the device data format requirements of different smart device manufacturers, and also keeping the device field and binding information field of the smart device manufacturer confidential.
[0131] In the further method of the above invention, the process of encapsulating the device identifier of the smart device by using the first SDK encapsulation interface to generate the first data packet is mainly explained as follows:
[0132] Generate a device identification structure according to the device identification;
[0133] Generate a first plaintext according to the second public key and the device identification structure;
[0134] Generate a third ciphertext according to the first symmetric key, the third initialization vector and the first plaintext;
[0135] generating a device field according to the third ciphertext and the third initialization vector;
[0136] A first data packet is generated according to the device field and the mobile terminal definition field.
[0137] In this regard, it should be noted that, in the present invention, the smart device configures the device identification into the device identification structure according to the specification file. Then, the device identification structure is encrypted using the public key in the randomly generated public-private key pair to generate a plain text. The plain text generates a cipher text based on the symmetric key and the initialization vector. The cipher text is then combined with the previous initialization vector to generate a device field, and then the device field is combined with the mobile terminal definition field to generate a first data packet, and the first data packet is sent to the mobile terminal.
[0138] The generation process of the first data packet is explained below with a specific example, as follows:
[0139] See also Figure 4 After the smart device enters the network configuration mode, it randomly generates a set of public and private key pairs N2 and D2 for key exchange through the key generation algorithm and saves them. The public key N2 and the unique identification structure data of the device defined by the device manufacturer are spliced together through a certain algorithm to generate plain text C1. The splicing algorithm is formulated by the smart device manufacturer and the smartphone manufacturer does not need to know it.
[0140] The smart device manufacturer generates a set of symmetric encryption keys K1 in advance and stores them in the smart device. This key needs to be kept confidential and cannot be leaked. A set of initialization vectors iv1 is generated through a random number algorithm, and C1 is symmetrically encrypted using the symmetric keys K1 and iv1. The encrypted ciphertexts E1 and iv1 are concatenated through an algorithm to generate the smart device field F1. The device field and the mobile terminal definition field are then combined to generate the first data packet, which is then sent to the mobile terminal.
[0141] In the further method of the above invention, the processing of parsing the second data packet using the second SDK encapsulation interface to obtain the network configuration information and the device binding information is mainly explained as follows:
[0142] Subpacketizing the second data packet to obtain a second ciphertext, a first public key, and a second initialization vector;
[0143] Decrypting the second ciphertext to obtain a shared key, a second initialization vector, and a combined data packet;
[0144] The combined data packet is sub-packetized to obtain device binding information and network configuration information.
[0145] After receiving the second data packet from the mobile phone, the smart device first decrypts the second data packet through the key exchange algorithm to obtain the ciphertext E3, the public key N2 and the initialization vector iv3. Then, the ciphertext E3 is decrypted to obtain the shared key K2, the initialization vector iv2 and the data packet G2.
[0146] The data packet G2 is processed using the SDK encapsulation interface to obtain the network configuration information and device binding information. The device binding information is parsed to obtain the symmetrically encrypted initialization vector iv2 and the symmetrically encrypted ciphertext E2. The symmetric key K1 and iv1 are used to decrypt the ciphertext E2 to obtain the device binding information structure S2. The smart device connects to the router through the network configuration information, logs in to the cloud, transmits the binding information structure to the cloud, and verifies it with the binding information structure sent by the mobile terminal to the cloud to complete the binding.
[0147] Figure 5 A schematic diagram showing the structure of a data transmission packet assembly device provided by the present invention is shown in FIG. Figure 5 The device includes a first acquisition module 51, a first analysis module 52, a first encapsulation module 53 and a generation module 54, wherein:
[0148] A first acquisition module 51 is used to acquire a first data packet sent by a smart device, where the first data packet is generated based on a device identification of the smart device;
[0149] A first parsing module 52, configured to call a first SDK encapsulation interface to parse the first data packet to obtain a device identification of the smart device;
[0150] The first encapsulation module 53 is used to call the second SDK encapsulation interface to encapsulate the device identifier to obtain device binding information;
[0151] A generating module 54, configured to generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device;
[0152] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0153] In a further device of the above invention, the first encapsulation module, in the process of calling the second SDK encapsulation interface to encapsulate the device identifier to obtain the device binding information, is specifically used to:
[0154] Generate a binding information structure according to the device identifier;
[0155] Generate a first ciphertext according to a first symmetric key, a first initialization vector and a binding information structure; wherein the first symmetric key is randomly configured by the smart device, and the first initialization vector is randomly generated in a symmetric encryption algorithm;
[0156] The device binding information is obtained by encapsulating the first ciphertext and the first initialization vector.
[0157] In a further device of the above invention, the generating module, in the process of generating the second data packet according to the device binding information and the network configuration information, is specifically used to:
[0158] Generate a shared key based on the first symmetric key and the first public key;
[0159] Generate a combined data packet based on device binding information and network configuration information;
[0160] generating a second ciphertext according to the shared secret key, the second initialization vector and the combined data packet;
[0161] The second data packet is obtained by encapsulating the second ciphertext, the first public key and the second initialization vector.
[0162] In a further device of the above invention, the first parsing module, in the process of parsing the first data packet by calling the first SDK encapsulation interface to obtain the device identification of the smart device, is specifically used to:
[0163] The first data packet is processed by packetization to obtain a device field and a mobile terminal definition field;
[0164] Perform a reverse concatenation process on the device field to obtain a third ciphertext and a third initialization vector;
[0165] Decrypting the third ciphertext to obtain the first symmetric key, the third initialization vector, and the first plaintext;
[0166] Performing a reverse concatenation process on the first plaintext to obtain a second public key and a device identification structure;
[0167] Get the device ID according to the device ID structure.
[0168] Since the device of the present invention has the same principle as the method of the above invention, a more detailed explanation will not be repeated here.
[0169] It should be noted that, in the present invention, relevant functional modules can be implemented by a hardware processor.
[0170] The data transmission packaging device provided in the above embodiment enables the mobile terminal and the smart device to have a unified SDK encapsulation interface, and can transmit the device identification and device binding information between the mobile terminal and the smart device through the same standard interface, thereby avoiding the mobile terminal from obtaining and processing the device fields and binding information fields of each smart device, achieving compatibility with the device data format requirements of different smart device manufacturers, and also keeping the device fields and binding information fields of the smart device manufacturers confidential.
[0171] Figure 6 A schematic diagram showing the structure of a data transmission packet assembly device provided by the present invention is shown in FIG. Figure 6 The device includes a second encapsulation module 61, a second analysis module 62 and a processing module 63, wherein:
[0172] The second encapsulation module 61 is used to encapsulate the device identification of the smart device using the first SDK encapsulation interface, generate a first data packet, and send the first data packet to the mobile terminal;
[0173] A second parsing module 62 is used to obtain a second data packet sent by the mobile terminal, and parse the second data packet using a second SDK encapsulation interface to obtain network configuration information and device binding information;
[0174] A processing module 63 is used to establish a connection with the cloud through a router according to the network configuration information, and send the device binding information to the cloud;
[0175] The first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0176] In a further device of the above invention, the second encapsulation module is specifically used to:
[0177] Generate a device identification structure according to the device identification;
[0178] Generate a first plaintext according to the second public key and the device identification structure;
[0179] Generate a third ciphertext according to the first symmetric key, the third initialization vector and the first plaintext;
[0180] generating a device field according to the third ciphertext and the third initialization vector;
[0181] A first data packet is generated according to the device field and the mobile terminal definition field.
[0182] In a further device of the above invention, the second parsing module, in the process of parsing the second data packet using the second SDK encapsulation interface to obtain the network configuration information and the device binding information, is specifically used for:
[0183] Subpacketizing the second data packet to obtain a second ciphertext, a first public key, and a second initialization vector;
[0184] Decrypting the second ciphertext to obtain a shared key, a second initialization vector, and a combined data packet;
[0185] The combined data packet is sub-packetized to obtain device binding information and network configuration information.
[0186] Since the device of the present invention has the same principle as the method of the above invention, a more detailed explanation will not be repeated here.
[0187] It should be noted that, in the present invention, relevant functional modules can be implemented by a hardware processor.
[0188] The data transmission packaging device provided in the above embodiment enables the mobile terminal and the smart device to have a unified SDK encapsulation interface, and can transmit the device identification and device binding information between the mobile terminal and the smart device through the same standard interface, thereby avoiding the mobile terminal from obtaining and processing the device fields and binding information fields of each smart device, achieving compatibility with the device data format requirements of different smart device manufacturers, and also keeping the device fields and binding information fields of the smart device manufacturers confidential.
[0189] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 71, a communication interface 72, a memory 73 and a communication bus 74, wherein the processor 71, the communication interface 72 and the memory 73 communicate with each other through the communication bus 74. The processor 71 may call the logic instructions in the memory 73 to execute the following method: obtain a first data packet sent by a smart device, wherein the first data packet is generated based on the device identification of the smart device; call the first SDK encapsulation interface to parse the first data packet to obtain the device identification of the smart device; call the second SDK encapsulation interface to encapsulate the device identification to obtain device binding information; generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device; wherein the first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0190] In addition, the logic instructions in the above-mentioned memory 73 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the 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 for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0191] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is implemented to execute the methods provided by the above embodiments, for example, including: obtaining a first data packet sent by a smart device, the first data packet is generated based on the device identification of the smart device; calling a first SDK encapsulation interface to parse the first data packet to obtain the device identification of the smart device; calling a second SDK encapsulation interface to encapsulate the device identification to obtain device binding information; generating a second data packet according to the device binding information and the network configuration information, and sending the second data packet to the smart device; wherein the first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification files of the device manufacturer.
[0192] The present invention provides an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. The processor may call the logic instructions in the memory to execute the following method: encapsulate the device identification of the smart device using the first SDK encapsulation interface, generate a first data packet, and send the first data packet to the mobile terminal; obtain the second data packet sent by the mobile terminal, and parse the second data packet using the second SDK encapsulation interface to obtain network configuration information and device binding information; establish a connection with the cloud through a router according to the network configuration information, and send the device binding information to the cloud; wherein the first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification file of the device manufacturer.
[0193] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0194] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is implemented to execute the methods provided by the above embodiments, for example, including: using a first SDK encapsulation interface to encapsulate the device identification of the smart device, generating a first data packet, and sending the first data packet to a mobile terminal; obtaining a second data packet sent by the mobile terminal, using a second SDK encapsulation interface to parse the second data packet to obtain network configuration information and device binding information; establishing a connection with the cloud through a router according to the network configuration information, and sending the device binding information to the cloud; wherein the first SDK encapsulation interface and the second SDK encapsulation interface are constructed based on the specification files of the device manufacturer.
[0195] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0196] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data transmission packet forming method, characterized in that: Applied to mobile terminals, including: Acquire a first data packet sent by the smart device, where the first data packet is generated by encapsulating a device identifier by the smart device using a first SDK encapsulation interface; Calling a first SDK encapsulation interface to parse the first data packet to obtain a device identifier of the smart device; Call the second SDK encapsulation interface to encapsulate the device identifier to obtain device binding information; Generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device; The first SDK encapsulation interface and the second SDK encapsulation interface are provided by the smart device manufacturer and are constructed based on the specification file of the device manufacturer; The calling of the second SDK encapsulation interface to encapsulate the device identifier to obtain the device binding information includes: Generate a binding information structure according to the device identifier; Generate a first ciphertext according to a first symmetric key, a first initialization vector and a binding information structure; wherein the first symmetric key is randomly configured by the smart device, and the first initialization vector is randomly generated in a symmetric encryption algorithm; Encapsulate the first ciphertext and the first initialization vector to obtain device binding information; The generating a second data packet according to the device binding information and the network configuration information includes: Generate a shared key based on the first symmetric key and the first public key; Generate a combined data packet based on device binding information and network configuration information; generating a second ciphertext according to the shared secret key, the second initialization vector and the combined data packet; The second data packet is obtained by encapsulating the second ciphertext, the first public key and the second initialization vector.
2. The data transmission packetization method according to claim 1, characterized in that: The calling the first SDK encapsulation interface to parse the first data packet to obtain the device identification of the smart device includes: The first data packet is processed by packetization to obtain a device field and a mobile terminal definition field; Perform a reverse concatenation process on the device field to obtain a third ciphertext and a third initialization vector; Decrypting the third ciphertext to obtain the first symmetric key, the third initialization vector, and the first plaintext; Performing a reverse concatenation process on the first plaintext to obtain a second public key and a device identification structure; Get the device ID according to the device ID structure.
3. A data transmission packetization method, characterized in that: Applied to smart devices, including: Encapsulating the device identification of the smart device using a first SDK encapsulation interface to generate a first data packet, and sending the first data packet to the mobile terminal; Obtain a second data packet sent by the mobile terminal, and parse the second data packet using a second SDK encapsulation interface to obtain network configuration information and device binding information; Establishing a connection with the cloud through a router according to the network configuration information, and sending the device binding information to the cloud; The first SDK encapsulation interface and the second SDK encapsulation interface are provided by the smart device manufacturer and are constructed based on the specification file of the device manufacturer; The step of encapsulating the device identifier of the smart device using the first SDK encapsulation interface to generate a first data packet includes: Generate a device identification structure according to the device identification; Generate a first plaintext according to the second public key and the device identification structure; Generate a third ciphertext according to the first symmetric key, the third initialization vector and the first plaintext; generating a device field according to the third ciphertext and the third initialization vector; Generate a first data packet according to the device field and the mobile terminal definition field; The second SDK encapsulation interface is used to parse the second data packet to obtain network configuration information and device binding information, including: Subpacketizing the second data packet to obtain a second ciphertext, a first public key, and a second initialization vector; Decrypting the second ciphertext to obtain a shared key, a second initialization vector, and a combined data packet; The combined data packet is sub-packetized to obtain device binding information and network configuration information.
4. A data transmission packet assembly device, characterized in that: Applied to mobile terminals, including: A first acquisition module is used to acquire a first data packet sent by the smart device, where the first data packet is generated by the smart device encapsulating a device identifier using a first SDK encapsulation interface; A first parsing module, used to call a first SDK encapsulation interface to parse the first data packet to obtain a device identification of the smart device; The first encapsulation module is used to call the second SDK encapsulation interface to encapsulate the device identifier to obtain device binding information; A generating module, configured to generate a second data packet according to the device binding information and the network configuration information, and send the second data packet to the smart device; The first SDK encapsulation interface and the second SDK encapsulation interface are provided by the smart device manufacturer and are constructed based on the specification file of the device manufacturer; The first encapsulation module, in the process of calling the second SDK encapsulation interface to encapsulate the device identifier to obtain the device binding information, is specifically used to: Generate a binding information structure according to the device identifier; Generate a first ciphertext according to a first symmetric key, a first initialization vector and a binding information structure; wherein the first symmetric key is randomly configured by the smart device, and the first initialization vector is randomly generated in a symmetric encryption algorithm; Encapsulate the first ciphertext and the first initialization vector to obtain device binding information; The generating module is specifically used in the process of generating the second data packet according to the device binding information and the network configuration information: Generate a shared key based on the first symmetric key and the first public key; Generate a combined data packet based on device binding information and network configuration information; generating a second ciphertext according to the shared secret key, the second initialization vector and the combined data packet; The second data packet is obtained by encapsulating the second ciphertext, the first public key and the second initialization vector.
5. A data transmission packet assembly device, characterized in that: Applied to smart devices, including: A second encapsulation module, configured to encapsulate the device identification of the smart device using the first SDK encapsulation interface, generate a first data packet, and send the first data packet to the mobile terminal; A second parsing module is used to obtain a second data packet sent by the mobile terminal, and parse the second data packet using a second SDK encapsulation interface to obtain network configuration information and device binding information; A processing module, used to establish a connection with the cloud through a router according to the network configuration information, and send the device binding information to the cloud; The first SDK encapsulation interface and the second SDK encapsulation interface are provided by the smart device manufacturer and are constructed based on the specification file of the device manufacturer; The second encapsulation module is specifically used for: Generate a device identification structure according to the device identification; Generate a first plaintext according to the second public key and the device identification structure; Generate a third ciphertext according to the first symmetric key, the third initialization vector and the first plaintext; generating a device field according to the third ciphertext and the third initialization vector; Generate a first data packet according to the device field and the mobile terminal definition field; The second parsing module, in the process of parsing the second data packet using the second SDK encapsulation interface to obtain the network configuration information and the device binding information, is specifically used for: Subpacketizing the second data packet to obtain a second ciphertext, a first public key, and a second initialization vector; Decrypting the second ciphertext to obtain a shared key, a second initialization vector, and a combined data packet; The combined data packet is sub-packetized to obtain device binding information and network configuration information.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the processor implements the steps of the packetization method for data transmission as claimed in claim 1 or 2, or implements the steps of the packetization method for data transmission as claimed in claim 3.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the steps of the data transmission packet assembly method according to claim 1 or 2, or implements the steps of the data transmission packet assembly method according to claim 3.
Citation Information
Patent Citations
Method and device used for binding mobile terminal with intelligent household electrical appliance
CN105357629A
