Network connection establishment method and device, storage medium and electronic device
By generating and encrypting user signatures, combined with system keywords and device information from the cloud server, the problem of insufficient data transmission security during network connection establishment is solved, enabling faster and more accurate data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies do not adequately improve data transmission security from a network connectivity perspective, resulting in slow data reception speeds, low accuracy, and high download failure rates for terminals.
By generating a user signature based on the system keywords of the cloud server, and combining it with the device model, service address and timestamp information to generate a hash value, the system performs encryption processing to establish a network connection request, ensuring the security of data transmission.
It improves the security and accuracy of data transmission, reduces the download failure rate, and enhances the integrity and reliability of network connections.
Smart Images

Figure CN115473928B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to a method, apparatus, storage medium, and electronic device for establishing a network connection. Background Technology
[0002] Currently, as people pay more and more attention to personal privacy, their requirements for the security of transmitted data are also increasing. Although related technologies have used data encryption and other means to meet users' needs for data transmission security, this approach does not consider how to improve data transmission security from the perspective of network connection. Moreover, it usually adopts relatively simple technical processing methods, which are insufficient in the comprehensiveness and integrity of data processing. This can easily lead to problems such as slow terminal data reception speed, low data accuracy, and a high download failure rate.
[0003] Therefore, in related technologies, there is a question of how to improve the security of data transmission from the perspective of network connection establishment. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and electronic device for establishing a network connection, in order to at least address the problem in the related art of how to improve the security of data transmission from the perspective of establishing a network connection.
[0005] According to one embodiment of this application, a method for establishing a network connection is provided, comprising: obtaining a user signature based on a system keyword of a cloud server; determining a network connection request based on the user signature and the service address of the cloud server; and sending the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
[0006] In one exemplary embodiment, obtaining a user signature based on a system keyword of a cloud server includes: determining the device model of the terminal device corresponding to the network connection request; generating a first signature string based on the system keyword of the cloud server and the device model; encrypting the first signature string to obtain a first hash value corresponding to the first signature string; and determining the first hash value as the user signature.
[0007] In one exemplary embodiment, obtaining a user signature based on a system keyword of a cloud server includes: determining the service address of the cloud server; generating a second signature string based on the system keyword and the service address of the cloud server; encrypting the second signature string to obtain a second hash value corresponding to the first signature string; and determining the second hash value as the user signature.
[0008] In one exemplary embodiment, obtaining a user signature based on a system keyword of a cloud server includes: determining the file name of a device configuration file corresponding to a terminal device pre-stored in the cloud server; generating a third signature string based on the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypting the third signature string to obtain a third hash value corresponding to the third signature string; and determining the third hash value as the user signature.
[0009] In one exemplary embodiment, the method further includes: combining at least two of the first signature string, the second signature string, and the third signature string to obtain a combined fourth signature string; wherein the second signature string is obtained based on the system keyword of the cloud server and the service address of the cloud server, and the third signature string is obtained based on the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypting the fourth signature string to obtain a fourth hash value corresponding to the fourth signature string; and determining the fourth hash value as the user signature.
[0010] In one exemplary embodiment, after sending the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request, the method further includes: receiving a response message sent by the cloud server, the response message indicating that the cloud server allows the terminal device to establish a network connection; and sending a file download request to the cloud server to download the configuration file corresponding to the terminal device through the cloud server.
[0011] In an exemplary embodiment, sending a file download request to the cloud server includes: parsing a response message sent by the cloud server to obtain the file service address of the configuration file and the file version number of the configuration file, wherein the file version number of the configuration file represents the device configuration version of the terminal device; if it is determined that the file version number is inconsistent with the device configuration version number corresponding to the terminal device, generating the file download request based on the file service address of the configuration file and sending the file download request.
[0012] According to another embodiment of the present application, a network connection establishment apparatus is also provided, comprising: a obtaining module, configured to obtain a user signature based on a system keyword of a cloud server; a determining module, configured to determine a network connection request based on the user signature and the service address of the cloud server; and a sending module, configured to send a network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
[0013] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described method for establishing a network connection when it is run.
[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described method for establishing a network connection through the computer program.
[0015] In this embodiment, a user signature is obtained based on the system keyword of the cloud server; a network connection request is determined based on the user signature and the service address of the cloud server; the network connection request is sent to the cloud server to establish a network connection with the cloud server through the network connection request; by adopting the above technical solution, the problem of how to improve the security of data transmission from the perspective of network connection establishment is solved, thereby improving the security of data transmission. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of the hardware environment for a method of establishing a network connection according to an embodiment of this application;
[0019] Figure 2 This is a flowchart of a method for establishing a network connection according to an embodiment of this application;
[0020] Figure 3 This is a flowchart illustrating a method for establishing a network connection according to an embodiment of this application;
[0021] Figure 4 This is a structural block diagram (a) of a network connection establishment device according to an embodiment of this application;
[0022] Figure 5 This is a structural block diagram (II) of a network connection establishment device according to an embodiment of this application. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] Furthermore, the technical terms used in this application are explained as follows:
[0026] HTTP: HyperText Transfer Protocol;
[0027] MD5: Message-Digest Algorithm;
[0028] TCP / IP: Transmission Control Protocol / Internet Protocol, representing the network transmission control protocol;
[0029] URL: Uniform Resource Locator, representing the address of a network resource;
[0030] JSON: JavaScript Object Notation, representing a lightweight data exchange format;
[0031] SHA-256: Secure Hash Algorithm-256, representing a hash algorithm.
[0032] According to one aspect of the embodiments of this application, a method for establishing a network connection is provided. This method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned method for establishing a network connection can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0033] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0034] This embodiment provides a method for establishing a network connection, applied to the aforementioned terminal device. Figure 2 This is a flowchart of a method for establishing a network connection according to an embodiment of this application, the process including the following steps:
[0035] Step S202: Obtain the user signature based on the system keyword of the cloud server;
[0036] It should be noted that the above system keywords can be understood as key identifiers for terminal devices to identify cloud servers. For example, when a terminal device is bound to multiple cloud servers, the target cloud server corresponding to the system keyword can be identified based on the system keyword.
[0037] Step S204: Determine the network connection request based on the user signature and the service address of the cloud server;
[0038] It should be noted that the aforementioned user signature can be obtained based on one or more of the following: the service address of the cloud server, the system keyword of the cloud server, the device model, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device.
[0039] Step S206: Send the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
[0040] Optionally, in one embodiment, the process of determining the network connection request based on the user signature and the service address of the cloud server may include, for example, determining, on the terminal device side, a network connection request, such as an HTTP protocol request, to be sent to the cloud server based on the user signature and the service address of the cloud server, thereby achieving the purpose of establishing a TCP / IP network connection between the terminal and the cloud server.
[0041] Through the above steps, a user signature is obtained based on the system keyword of the cloud server; a network connection request is determined based on the user signature and the service address of the cloud server; the network connection request is sent to the cloud server to establish a network connection with the cloud server through the network connection request, thus solving the problem in related technologies of how to improve the security of data transmission from the perspective of network connection establishment.
[0042] In an exemplary embodiment, to better understand how the user signature is obtained from the system keyword of the cloud server in step S202 above, a technical solution is proposed, which specifically includes: determining the device model of the terminal device corresponding to the network connection request; generating a first signature string based on the system keyword of the cloud server and the device model; encrypting the first signature string to obtain a first hash value corresponding to the first signature string; and determining the first hash value as the user signature.
[0043] In an exemplary embodiment, a technical solution is also proposed to obtain the user signature based on the system keyword of the cloud server in step S202 above. The specific steps are as follows: determine the service address of the cloud server; generate a second signature string based on the system keyword of the cloud server and the service address of the cloud server; encrypt the second signature string to obtain a second hash value corresponding to the first signature string; and determine the second hash value as the user signature.
[0044] Furthermore, in an exemplary embodiment, a technical solution is proposed to obtain the user signature based on the system keyword of the cloud server in step S202 above. The specific steps include: determining the file name of the device configuration file corresponding to the terminal device that is pre-stored in the cloud server; generating a third signature string based on the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypting the third signature string to obtain a third hash value corresponding to the third signature string; and determining the third hash value as the user signature.
[0045] In an exemplary embodiment, the following scheme is further proposed to implement the process of determining the user signature in step S202 above. The specific steps include: combining at least two of the first signature string, the second signature string, and the third signature string to obtain a combined fourth signature string; wherein the second signature string is obtained based on the system keyword of the cloud server and the service address of the cloud server, and the third signature string is obtained based on the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypting the fourth signature string to obtain a fourth hash value corresponding to the fourth signature string; and determining the fourth hash value as the user signature.
[0046] The above embodiments propose multiple methods for obtaining user signatures, enriching the data types of user signatures and improving the accuracy of network connections.
[0047] In an exemplary embodiment, after sending the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request, a technical solution is further implemented, the specific steps of which include: receiving a response message sent by the cloud server, the response message being used to indicate that the cloud server allows the terminal device to establish a network connection; and sending a file download request to the cloud server to download the configuration file corresponding to the terminal device through the cloud server.
[0048] Optionally, in one embodiment, the cloud server can also be designated as the execution side to implement the following technical solution: receiving a network connection request sent by a terminal device, wherein the network connection request includes at least the user signature and the service address of the cloud server; establishing a network connection with the terminal device according to the network connection request; decrypting the user signature to obtain a decryption result; and, if it is determined that the decryption result matches the user signature, sending response information to the terminal device.
[0049] In one exemplary embodiment, a technical solution for sending a file download request to the cloud server is proposed. The specific steps include: parsing the response message sent by the cloud server to obtain the file service address of the configuration file and the file version number of the configuration file, wherein the file version number of the configuration file represents the device configuration version of the terminal device; if it is determined that the file version number is inconsistent with the device configuration version number corresponding to the terminal device, generating the file download request according to the file service address of the configuration file and sending the file download request.
[0050] Optionally, after sending the file download request, the file length of the configuration file is obtained, and the configuration file is downloaded from the cloud server. After the configuration file download is complete, the file length of the downloaded file is compared with the file length of the configuration file. If the difference in file length is equal to a first preset value (e.g., it can be 0), the encrypted value of the configuration file is obtained from the response message, the downloaded file is decrypted to obtain the decrypted value, and if the decrypted value and the encrypted value are consistent, it is determined that the configuration file download was successful, and the successfully downloaded configuration file is stored.
[0051] Furthermore, in one embodiment, the format of the downloaded file and the format of the verification file can also be set in the above file download request. For example, the format of the downloaded file may include JSON format, and the format of the verification file may include MD5 checksum.
[0052] Furthermore, in an exemplary embodiment, the process of determining the network connection request based on the user signature and the service address of the cloud server may include: determining the network connection request based on the user signature, the service address of the cloud server, and a public field, wherein the public field includes at least one of the following: appid (server-registered username), user signature, timestamp, and interaction data type. Here, appid (server-registered username) can be understood as the username registered by the user on the server corresponding to the terminal device, and interaction data type can be understood as the type of data requested by the terminal device from the cloud server, including but not limited to text, voice, and image formats.
[0053] For example, you can run a program that establishes a TCP / IP network connection through a terminal and send an HTTP protocol request (equivalent to a network connection request) to the cloud service address. The HTTP protocol can include a URL, a header (public fields), and a body.
[0054] The above embodiments improve the integrity of configuration file downloads and enhance the reliability of data storage.
[0055] To better understand the process of establishing the network connection described above, the implementation flow of establishing the network connection will be further described below with reference to optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.
[0056] Step S1: The terminal (equivalent to the terminal device mentioned above) establishes a TCP / IP network connection and initiates an HTTP protocol request to the cloud service address URL. The HTTP protocol can include the URL, header (public fields), and body.
[0057] The public fields can include appid (server-registered user name), user signature, timestamp (time stamp), and interactive data types.
[0058] Furthermore, a user signature can be generated by requesting at least one of the following parameters from the server: systemKey (equivalent to the system keyword mentioned above), URL resource path (equivalent to the service address of the cloud server mentioned above), body (the file name containing the configuration file, i.e., the file name of the device configuration file corresponding to the pre-stored terminal device mentioned above), appid (the baseboard model, i.e., the device model of the terminal device mentioned above), and timestamp (equivalent to the current timestamp information of the terminal device mentioned above).
[0059] Specifically: the signature string is determined by at least one of the following parameters: systemKey (server-side application system keyword), URL resource path, body, appid, and timestamp. The signature string is then calculated using a 32-bit lowercase SHA-256 value to generate the user signature.
[0060] Optionally, in one embodiment, the URL resource address in the HTTP protocol request can be represented as, for example, " / hardwareconfig / app / resource / configFile"; the body part can be represented as, for example, "{\"ppid\":\"200861051c408504012100618005394300000000000061800616440000000140\",\"ppver\": ""}"; the appid (baseboard model) can be represented as, for example, "MB-DEMOIOS-0000"; the systemKey server application keyword can be represented as, for example, "e3e48e32fb6636328b9cfdf1decf753d"; and the timestamp can be represented as, for example, "1644574261911".
[0061] Therefore, the signature string generated based on the above parameters systemKey, server-side application for system keyword (equivalent to the above system keyword), URL resource path, body (filename containing configuration file), appid (baseboard model), and timestamp is in the format of: "URL+body+appid+systemKey+timestamp", as shown below:
[0062] " / hardwareconfig / app / resource / configFile{\"ppid\":\"200861051c4085040121006180053943000000 00000061800616440000000140\"}MB-DEMOIOS-0000e3e48e32fb6636328b9cfdf1decf753d1644574261911".
[0063] Next, the encryption process of the signature string is analyzed as follows: Based on the principle of 32-bit lowercase SHA-256, 1. The hash value constant used by the algorithm is initialized; 2. Information preprocessing: the message of the hash value is completed so that the entire message meets the specified structure; 3. Logical operation: the signature string is decomposed into n blocks, and n iterations are performed, and the mapping result of each iteration is processed; 4. Data block processing: the signature hash value of the processed data is obtained, which is 64 characters long and is represented as: "d4d038423f74a146800f4cad793915d3d76d48be767171df9b0a493ed04d2126".
[0064] Step S2: After receiving the terminal's request protocol, the cloud parses the protocol. If the protocol is parsed correctly, it sends a response code HTTP Response (equivalent to the response message mentioned above) to the terminal.
[0065] Step S3: The terminal parses the response code to obtain the configuration file service address URL (equivalent to the file service address of the configuration file mentioned above) and the configuration file MD5 value, and obtains the configuration file version number (equivalent to the file version number of the configuration file mentioned above).
[0066] If the terminal's device configuration version number is equal to the configuration file version number, then there is no need to download the configuration file.
[0067] If the device configuration version number of the terminal is not equal to the configuration file version number, the terminal will send an HTTP request to the cloud server to download the configuration file from the cloud server.
[0068] The system can download configuration files in 1KB frames, use JSON data format for file transfer between the cloud server and the terminal, and use MD5 checksum to verify the downloaded files.
[0069] Step S4: After the terminal receives the data, it determines that the length of the received data is equal to the length of the configuration file, and then performs an MD5 check on the data. If the check value is equal to the MD5 value in the response code, the received data is correct and the data is stored.
[0070] By incorporating a user signature into the network establishment request through the above embodiments, the security of data transmission can be enhanced. Compared to methods that use text-based data download, this application employs JSON data format, which has the advantages of low bandwidth consumption and ease of parsing. Furthermore, the use of MD5 verification improves the integrity and accuracy of the downloaded configuration file.
[0071] Optionally, other embodiments provide a method for downloading files. Figure 3 This is a schematic diagram of the file download process according to an embodiment of this application, such as... Figure 3 As shown, after establishing a network connection based on the above embodiments, the process of downloading files is as follows:
[0072] Step S301: Determine whether the TCP / IP network connection was successfully established. If the connection was successfully established, proceed to step S302; if the connection failed, proceed to step S301.
[0073] Step S302: Send an HTTP request to the cloud server; if the request is successful, proceed to step S303; if the request fails, proceed to step S301.
[0074] Step S303: Respond to the HTTP request through the cloud server, send a response message, and parse the HTTP request to obtain the version number of the configuration file (equivalent to the file version number of the configuration file mentioned above).
[0075] Step S304: Determine whether the version number of the configuration file matches the device configuration version number corresponding to the terminal device. If the version number of the configuration file matches the device configuration version number corresponding to the terminal device, then there is no need to download the configuration file. If the version number of the configuration file does not match the device configuration version number corresponding to the terminal device, proceed to steps S305-S309.
[0076] Step S305: Send an HTTP request to the cloud server via the terminal to obtain the file length of the configuration file. If the request is successful, proceed to step S306. If the request fails, proceed to step S301.
[0077] Step S306: Download the configuration file. If the configuration file download is successful, proceed to step S307; if the configuration file download fails, proceed to step S301.
[0078] Step S307: Determine whether the file length of the downloaded configuration file is consistent with the file length of the obtained configuration file. If the file length of the downloaded configuration file is consistent with the file length of the obtained configuration file, proceed to step S308. If the file length of the downloaded configuration file is inconsistent with the file length of the obtained configuration file, proceed to step S301.
[0079] Step S308: Perform MD5 verification on the downloaded configuration file. If the verification value equals the MD5 value in the response message, the verification is successful, and proceed to step S309. If the verification value does not equal the MD5 value in the response message, the verification fails, and proceed to step S301.
[0080] Step S309: Write the downloaded configuration file to the specified configuration file address via the terminal, and determine whether the writing is complete. If the writing is complete, it means that the configuration file download and storage function has been successfully implemented. If the writing is incomplete, it means that the configuration file download and storage function has failed, and step S301 should be executed again.
[0081] The above embodiments not only achieve user signature addition to HTTP requests to ensure protocol security, but also reduce data bandwidth and transmission error rate by using JSON data format during data download, thereby improving data parsing efficiency. Furthermore, using MD5 verification on downloaded data improves the integrity and accuracy of received data.
[0082] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0083] Figure 4 This is a structural block diagram (a) of a network connection establishment apparatus according to an embodiment of this application; as shown... Figure 4 As shown, it includes:
[0084] Module 42 is used to obtain the user signature based on the system keyword of the cloud server;
[0085] It should be noted that the above system keywords can be understood as key identifiers for terminal devices to identify cloud servers. For example, when a terminal device is bound to multiple cloud servers, the target cloud server corresponding to the system keyword can be identified based on the system keyword.
[0086] The determination module 44 is used to determine the network connection request based on the user signature and the service address of the cloud server;
[0087] The sending module 46 is used to send a network connection request to the cloud server in order to establish a network connection with the cloud server through the network connection request.
[0088] The above-described device obtains a user signature based on the system keyword of the cloud server; determines a network connection request based on the user signature and the service address of the cloud server; and sends the network connection request to the cloud server to establish a network connection with the cloud server. This solves the problem in related technologies of how to improve the security of data transmission from the perspective of establishing a network connection.
[0089] In an exemplary embodiment, the above-described obtaining module 42 is further configured to determine the device model of the terminal device corresponding to the network connection request; generate a first signature string based on the system keyword of the cloud server and the device model; encrypt the first signature string to obtain a first hash value corresponding to the first signature string; and determine the first hash value as the user signature.
[0090] Furthermore, in an exemplary embodiment, the aforementioned obtaining module 42 is also used to determine the service address of the cloud server; generate a second signature string based on the system keyword of the cloud server and the service address of the cloud server; encrypt the second signature string to obtain a second hash value corresponding to the first signature string; and determine the second hash value as the user signature.
[0091] Furthermore, in an exemplary embodiment, the aforementioned module 42 is further configured to determine the file name of the device configuration file corresponding to the terminal device pre-stored in the cloud server; generate a third signature string based on the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypt the third signature string to obtain a third hash value corresponding to the third signature string; and determine the third hash value as the user signature.
[0092] Furthermore, in an exemplary embodiment, the network connection establishment apparatus further includes a combination module, configured to combine at least two of the first signature string, the second signature string, and the third signature string to obtain a combined fourth signature string; wherein the second signature string is obtained based on the system keyword of the cloud server and the service address of the cloud server, and the third signature string is obtained based on the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; the fourth signature string is encrypted to obtain a fourth hash value corresponding to the fourth signature string; and the fourth hash value is determined as the user signature.
[0093] The above embodiments propose multiple methods for obtaining user signatures, enriching the data types of user signatures and improving the accuracy of network connections.
[0094] Furthermore, in an exemplary embodiment, the determining module 44 is further configured to determine the network connection request based on the user signature, the service address of the cloud server, and a public field, wherein the public field includes at least one of the following: appid (server-registered username), user signature, timestamp, and interaction data type. Here, appid (server-registered username) can be understood as the username registered by the user on the server corresponding to the terminal device, and interaction data type can be understood as the type of data requested by the terminal device from the cloud server, including but not limited to text, voice, and image formats.
[0095] For example, you can run a program that establishes a TCP / IP network connection through a terminal and send an HTTP protocol request (equivalent to a network connection request) to the cloud service address. The HTTP protocol can include a URL, a header (public fields), and a body.
[0096] The above embodiments improve the integrity of configuration file downloads and enhance the reliability of data storage.
[0097] In one exemplary embodiment, the network connection establishment apparatus further includes a receiving module.
[0098] Figure 5 This is a structural block diagram (II) of a network connection establishment apparatus according to an embodiment of this application. Figure 5 As shown, the network connection establishment device includes a obtaining module 42, a determining module 44, a sending module 46, and a receiving module 52. It is used to send the network connection request to the cloud server to establish a network connection with the cloud server, and then receive a response message from the cloud server indicating that the cloud server allows the terminal device to establish a network connection. It also sends a file download request to the cloud server to download the configuration file corresponding to the terminal device.
[0099] Furthermore, in an exemplary embodiment, the receiving module 52 is further configured to parse the response message sent by the cloud server to obtain the file service address of the configuration file and the file version number of the configuration file, wherein the file version number of the configuration file represents the device configuration version of the terminal device; if it is determined that the file version number is inconsistent with the device configuration version number corresponding to the terminal device, the receiving module 52 generates the file download request according to the file service address of the configuration file and sends the file download request.
[0100] Optionally, the receiving module 52 is further configured to, after sending the file download request, obtain the file length of the configuration file and download the configuration file from the cloud server. After the configuration file download is complete, the file length of the downloaded file is compared with the file length of the configuration file. If the difference in file length is equal to a first preset value (e.g., it can be 0), the encrypted value of the configuration file is obtained from the response message, the downloaded file is decrypted to obtain the decrypted value, and if the decrypted value and the encrypted value are consistent, it is determined that the configuration file download was successful, and the successfully downloaded configuration file is stored.
[0101] Furthermore, in one embodiment, the receiving module 52 is also used to set the format of the downloaded file and the format of the verification file in the file download request. For example, the format of the downloaded file may include JSON format, and the format of the verification file may include MD5 verification method.
[0102] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0103] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0104] S1, obtain the user signature based on the system keyword of the cloud server;
[0105] S2, determine the network connection request based on the user signature and the service address of the cloud server;
[0106] S3, send the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
[0107] Embodiments of this application also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0108] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0109] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0110] S1, obtain the user signature based on the system keyword of the cloud server;
[0111] S2, determine the network connection request based on the user signature and the service address of the cloud server;
[0112] S3, send the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
[0113] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0114] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0115] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0116] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method of establishing a network connection, characterized by The application is applied to a terminal device, comprising: obtaining a user signature according to a system keyword of a cloud server and one or more of a service address of the cloud server, a device model of the terminal device, a file name of a device configuration file corresponding to the terminal device, and a current timestamp information of the terminal device; determining a network connection request according to the user signature, the service address of the cloud server, and a public field; sending the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request; after sending the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request, the method further comprises: receiving a response message sent by the cloud server, the response message being used to indicate that the cloud server allows the terminal device to establish a network connection; sending a file download request to the cloud server to download the configuration file corresponding to the terminal device through the cloud server; obtaining a file length of the configuration file, comparing the file length of the downloaded file with the file length of the configuration file to obtain a file length difference, and in the case that the file length difference is equal to a first preset value, obtaining an encrypted value of the configuration file from the response message, decrypting the downloaded file to obtain a decrypted value, and if the decrypted value and the encrypted value are consistent, storing the downloaded file that is downloaded successfully, wherein the downloaded file that is downloaded successfully represents the configuration file that is downloaded successfully; writing the downloaded file that is downloaded successfully into a specified configuration file address, and in the case that the writing is not completed, determining that the downloading and storing functions of the configuration file fail, and re-sending the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
2. The method of establishing a network connection according to claim 1, wherein, obtaining a user signature according to a system keyword of a cloud server, comprising: determining a device model of a terminal device corresponding to the network connection request; generating a first signature string according to the system keyword of the cloud server and the device model; encrypting the first signature string to obtain a first hash value corresponding to the first signature string; determining the first hash value as the user signature.
3. The method of establishing a network connection according to claim 1, wherein, obtaining a user signature according to a system keyword of a cloud server, comprising: determining a service address of the cloud server; generating a second signature string according to the system keyword of the cloud server and the service address of the cloud server; encrypting the second signature string to obtain a second hash value corresponding to the second signature string; determining the second hash value as the user signature.
4. The method of establishing a network connection according to claim 1, wherein, obtaining a user signature according to a system keyword of a cloud server, comprising: determining a file name of a device configuration file corresponding to a terminal device that is pre-stored in the cloud server; generating a third signature string according to the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypting the third signature string to obtain a third hash value corresponding to the third signature string; determining the third hash value as the user signature.
5. The method of establishing a network connection according to claim 2, wherein, The method further comprises: combining at least two of the first signature string, the second signature string, and the third signature string to obtain a fourth signature string after combination; wherein the second signature string is obtained according to the system keyword of the cloud server and the service address of the cloud server, and the third signature string is obtained according to the system keyword of the cloud server, the file name of the device configuration file corresponding to the terminal device, and the current timestamp information of the terminal device; encrypting the fourth signature string to obtain a fourth hash value corresponding to the fourth signature string; determining the fourth hash value as the user signature.
6. The method of establishing a network connection according to claim 1, wherein, sending a file download request to the cloud server, comprising: parsing the response message sent by the cloud server to obtain the file service address of the configuration file and the file version number of the configuration file, wherein the file version number of the configuration file represents the device configuration version of the terminal device; in a case where it is determined that the file version number is inconsistent with the device configuration version number corresponding to the terminal device, generating the file download request according to the file service address of the configuration file and sending the file download request.
7. An apparatus for establishing a network connection, characterized by comprise: a obtaining module configured to obtain a user signature according to one or more of a system keyword of a cloud server, a service address of the cloud server, a device model of a terminal device, a file name of a device configuration file corresponding to the terminal device, and current timestamp information of the terminal device; a determining module configured to determine a network connection request according to the user signature, the service address of the cloud server, and a public field; a sending module configured to send the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request; a receiving module configured to receive a response message sent by the cloud server, the response message being used to indicate that the cloud server allows the terminal device to establish a network connection, and send a file download request to the cloud server to download a configuration file corresponding to the terminal device through the cloud server; The receiving module is further configured to obtain a file length of the configuration file, compare the file length of the downloaded file with the file length of the configuration file, and obtain a file length difference; in a case where the file length difference is equal to a first preset value, obtain an encryption value of the configuration file from the response message, decrypt the downloaded file to obtain a decryption value, and if the decryption value is consistent with the encryption value, store the downloaded file which is successful in downloading; wherein the downloaded file represents a configuration file which is successfully downloaded, and the downloaded file which is successful in downloading represents the configuration file which is successfully downloaded; write the downloaded file which is successful in downloading into a specified configuration file address, in a case where the writing is not completed, determine that the downloading and storing of the configuration file fail, and resend the network connection request to the cloud server to establish a network connection with the cloud server through the network connection request.
8. A computer readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, wherein the program performs the method described in any one of claims 1 to 6 when executed. 9.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 6 through the computer program.
Citation Information
Patent Citations
Remote network connection method and system, computer equipment and storage medium
CN111901357A