Hardware module and data transmission method and device
By setting up hardware modules between the intranet and the extranet to provide data transmission interfaces and encryption, the security and cost issues of existing network layer isolation methods are resolved, achieving more efficient data access and security.
Patent Information
- Application Number
- CN202411258405.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-11-29
AI Technical Summary
In existing technologies, methods for isolating internal and external networks based on the network layer require dedicated network equipment, resulting in lower security, higher costs, and limited applicability.
By setting up hardware modules between the intranet and the extranet, an interface is provided for the target host to access extranet data. These modules include microcontrollers or embedded modules, enabling data transmission and encryption, ensuring isolation between the intranet and extranet while improving security and convenience.
It reduces research and development and maintenance costs, expands applicable scenarios, and improves the security and ease of use of devices within the local area network without changing the network environment.
Smart Images

Figure CN119051962A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of network security technology, and in particular, relates to a hardware module, a data transmission method and a device. Background Art
[0002] In many industries, in order to ensure network security, security precautions are taken between business systems. In the related technology, there is a method of isolating the internal and external networks based on the network layer. This method requires special dedicated network equipment to isolate the internal and external networks, and requires dedicated network equipment to connect the internal and external networks at the same time. It has low security and is easy to cause risks to the devices in the local area network. In addition, the cost of network equipment construction and maintenance is high, and the applicable scenarios are limited. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes a hardware module, a data transmission method and a device, which reduces the R&D cost and maintenance cost, improves the convenience of use, broadens the applicable scenarios, and improves the security of devices in the local area network.
[0004] In a first aspect, the present application provides a hardware module, including:
[0005] A first interface, wherein the first interface is connected to an external network server;
[0006] A communication serial port, the communication serial port is connected to a target host; the hardware module is used to return target business data corresponding to the access data request to the target host when receiving the access data request sent by the target host; the communication serial port includes: an initialization interface, a heartbeat interface, a request interface, a success data callback interface and a failure data callback interface; the hardware module includes a single-chip microcomputer or an embedded module.
[0007] According to the hardware module provided in the embodiment of the present application, by setting a hardware module between the target host in the intranet and the external network server without changing the network environment, the target host can access data in the external network, etc., thereby reducing R&D costs and maintenance costs, improving ease of use, and broadening applicable scenarios; and on the basis of completely isolating the internal and external networks, it can communicate with the external network through the first interface in the hardware module, thereby improving the security of devices in the local area network.
[0008] In a second aspect, the present application provides a data transmission method based on the hardware module as described in the first aspect, comprising:
[0009] The hardware module sends the received access data request to the external network server; the access data request is sent by the target host;
[0010] The external network server sends the initial service data corresponding to the access data request to the hardware module based on the access data request;
[0011] The hardware module processes the initial service data to obtain the target service data, and sends the target service data to the target host through the communication serial port;
[0012] When it is determined that the target service data passes the verification, the target host receives the target service data.
[0013] In a data transmission method according to an embodiment of the present application, the hardware module processes the initial service data to obtain target service data, including:
[0014] Encrypting the initial service data to obtain encrypted service data;
[0015] The encrypted business data is processed based on a target message format to obtain the target business data.
[0016] In a data transmission method according to an embodiment of the present application, the encrypted service data is processed based on a target message format to obtain the target service data, including:
[0017] Encapsulating the encrypted service data and message fields based on the target message format to obtain a message body included in the target service data; the message fields include at least one of a message header field, a user identification number field, a message type field, a message length field, and a message identification number field;
[0018] Based on the check code generation rule, the message body is calculated to generate a target check code corresponding to the target business data;
[0019] The target verification code is added to the target position of the message body to obtain the target business data.
[0020] In a data transmission method according to an embodiment of the present application, the initial service data is encrypted to obtain encrypted service data, including:
[0021] The initial business is encrypted based on an adaptive encryption algorithm or a homomorphic encryption algorithm to obtain the encrypted business data.
[0022] In a data transmission method according to an embodiment of the present application, before obtaining the target service data, the method further includes:
[0023] Adding a message tail field to the end of the message body to obtain first service data;
[0024] When a target byte in the first service data is identical to a byte of the message header field, the message tail field or an escape character, an escape process is performed on the target byte.
[0025] In a data transmission method according to an embodiment of the present application, the target service data is sent to the target host through the communication serial port, comprising:
[0026] adjusting data transmission parameters between the hardware module and the target host based on a network condition between the hardware module and the target host;
[0027] Based on the data transmission parameters, the target service data is sent to the target host through the communication serial port.
[0028] In a data transmission method according to an embodiment of the present application, the target service data is sent to the target host through the communication serial port, comprising:
[0029] Determining a data compression algorithm based on the target business data;
[0030] Compressing the target service data based on the data compression algorithm to obtain second service data;
[0031] The second service data is sent to the target host through the communication serial port.
[0032] In a data transmission method according to an embodiment of the present application, determining that the target service data passes verification includes:
[0033] Obtaining a target verification code corresponding to the target service data;
[0034] Calculating the target service data to obtain a first check code corresponding to the target service data;
[0035] When the first verification code is identical to the target verification code, it is determined that the target service data passes the verification.
[0036] In a third aspect, the present application provides a data transmission device based on the hardware module as described in the first aspect, including:
[0037] A first processing module, used for the hardware module to send the received access data request to the external network server; the access data request is sent by the target host;
[0038] A second processing module, configured for the external network server to send initial service data corresponding to the access data request to the hardware module based on the access data request;
[0039] A third processing module, configured for the hardware module to process the initial service data to obtain the target service data, and to send the target service data to the target host through the communication serial port;
[0040] The fourth processing module is used for, when it is determined that the target service data passes the verification, the target host receives the target service data.
[0041] In a fourth aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data transmission method as described in the second aspect above is implemented.
[0042] In a fifth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the data transmission method as described in the second aspect above is implemented.
[0043] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the data transmission method as described in the second aspect above.
[0044] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
[0045] By setting a hardware module between the target host in the intranet and the external network server without changing the network environment, the target host can access data in the external network, thereby reducing R&D costs and maintenance costs, improving ease of use, and broadening applicable scenarios. Moreover, while completely isolating the internal and external networks, it can communicate with the external network through the first interface in the hardware module, thereby improving the security of devices in the local area network.
[0046] Furthermore, by defining some standard interfaces and encapsulating the drivers of related hardware modules, the target host can communicate with the external network server more quickly and conveniently.
[0047] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0049] Figure 1 It is one of the structural diagrams of the hardware module provided in the embodiment of the present application;
[0050] Figure 2 This is the second structural diagram of the hardware module provided in the embodiment of the present application;
[0051] Figure 3 It is a flowchart of a data transmission method provided in an embodiment of the present application;
[0052] Figure 4 is a schematic diagram of the structure of a data transmission device provided in an embodiment of the present application;
[0053] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0054] Reference numerals:
[0055] Hardware module 110; target host 120; external network server 130; first interface 140; communication serial port 150. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0057] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0058] Combine the following Figure 1 and Figure 2 The hardware module 110 of the embodiment of the present application is described.
[0059] It should be noted that the hardware module 110 is applied to an independent single device that needs to request external network data, such as a subway gate or a display screen.
[0060] The hardware module 110 can be applied in rail transit scenarios, or can also be applied to other scenarios that require intranet devices to request external network data, which is not limited in this application.
[0061] like Figure 1As shown, the hardware module 110 includes a first interface 140 and a communication serial port 150 .
[0062] In this embodiment, the hardware module 110 integrates network communication and serial port communication functions.
[0063] The first interface 140 is connected to the external network server 130 .
[0064] The first interface 140 may include an Ethernet interface, a Wi-Fi module, or any other interface supporting IP network communication.
[0065] Based on the first interface 140 , the hardware module 110 can receive instructions or data from the server and feed back data or status information to the server.
[0066] The communication serial port 150 is connected to the target host 120 .
[0067] The target host 120 may include an industrial computer or an embedded device.
[0068] The communication serial port 150 is used for serial communication with the target host 120 .
[0069] like Figure 2 As shown, the communication serial port 150 provides a channel for data exchange. Based on the communication serial port 150, the hardware module 110 can receive an access data request from the target host 120, and return corresponding target business data in response to the access data request.
[0070] In the actual implementation process, for example, in the automatic ticket vending machine system of the subway, when a passenger buys a ticket, the ticket vending machine interacts with the background server through the communication serial port 150 of the hardware module 110 to transmit and process the ticket purchase information in real time.
[0071] For example, when a passenger selects the number of tickets and the destination, this information will be sent to the hardware module 110 via the serial port, and then uploaded by the hardware module 110 to the ticketing system server on the external network through the network interface for processing. At the same time, the information on the success or failure of the ticket purchase returned by the server will also be transmitted back to the ticket machine through the hardware module 110 to complete the entire ticket purchase process.
[0072] For example, in a subway application environment, the first interface 140 may be an Ethernet interface, and a secure connection with an external network (such as a bank's extranet) may be ensured through VPN and other technologies.
[0073] The first interface 140 is used to receive instructions or data from the bank's external network, such as transaction verification information or account balance inquiry.
[0074] The communication serial port 150 is used for serial communication with the subway gate system. The hardware module 110 can receive access data requests (such as payment requests) sent by the gate and return processing results (such as payment success / failure information) to the gate.
[0075] When passengers use digital RMB to pay at the subway gate, the gate can send a payment request to the hardware module 110 through the communication serial port 150; the hardware module 110 can forward the payment request to the bank's external network through the first interface 140 for verification and processing; after the bank's external network completes the processing, the payment result (success or failure) can be returned to the hardware module 110; the hardware module 110 can pass the payment result to the gate through the communication serial port 150, and the gate can perform corresponding operations based on the payment result (such as opening the door or prompting a payment failure).
[0076] According to the hardware module 110 provided in the embodiment of the present application, by setting the hardware module 110 between the target host 120 of the intranet and the external network server 130 without changing the network environment, the target host 120 is used to access the data of the external network, etc., thereby reducing the research and development cost and maintenance cost, improving the convenience of use, and broadening the applicable scenarios; and on the basis of completely isolating the internal and external networks, it can communicate with the external network through the first interface 140 in the hardware module 110, thereby improving the security of the devices in the local area network.
[0077] In some embodiments, the hardware module 110 may include a single chip microcomputer or an embedded module.
[0078] In this embodiment, the single chip microcomputer can integrate a central processing unit, a memory, an input and output interface, etc. on a single chip.
[0079] The functions of the TCP / IP protocol stack can be simulated or implemented on the microcontroller through programming to achieve communication between the internal and external networks.
[0080] The embedded module may include an embedded module of a Linux system, an embedded module of an Android system, or other modules capable of network communication.
[0081] For example, network communication can be performed through the built-in Ethernet interface or Wi-Fi module in the Linux system, or network communication applications can be developed on the Linux system using standard network programming interfaces (such as socket programming).
[0082] The Android system has built-in communication protocols such as HTTP, HTTPS and WebSocket, and network communication can be carried out directly through the built-in communication protocols.
[0083] Alternatively, you can use the API provided by the Android system (such as HttpClient or OkHttp, etc.) or a third-party library to implement network communication.
[0084] The user can select the hardware module 110 based on the requirements, which is not limited in this application.
[0085] In some embodiments, software development can be performed on the hardware module 110, and required network requests or data can be processed and obtained through network request methods such as HTTP or Socket.
[0086] In this embodiment, HTTP (Hypertext Transfer Protocol) is an application layer protocol for transmitting hypermedia documents (such as HTML).
[0087] In the embedded system or hardware module 110, an HTTP client library can be used to send HTTP requests (such as GET, POST, PUT, or DELETE, etc.) to the server and receive responses. These responses may contain data in JSON, XML, or other formats for the device to parse and process.
[0088] Socket is a network programming interface. In an embedded system or hardware module 110, Socket programming can be used to establish a connection with a remote server or other device, and send and receive data through this connection.
[0089] In some embodiments, the communication serial port 150 may include: an initialization interface, a heartbeat interface, a request interface, a success data callback interface, and a failure data callback interface.
[0090] In this embodiment, the initialization interface is used to perform initialization settings when the hardware module 110 establishes a connection with the target host 120, such as configuring communication parameters such as baud rate, data bits and stop bits, and setting timeouts for connection and read and write operations.
[0091] If the hardware module 110 and the target host 120 fail to successfully establish a connection within the connection timeout period, it can be considered that the connection has failed.
[0092] When performing network read and write operations, if the operation exceeds the read and write timeout period, the operation can be considered to have timed out.
[0093] The heartbeat interface is used for the target host 120 to periodically send a heartbeat signal to the hardware module 110 to detect the device status and network status of the hardware module 110.
[0094] The device status is used to represent the current working status of the hardware module 110, such as online, offline or busy.
[0095] The network status is used to represent the network connection status of the hardware module 110, such as connected, not connected, connecting, or poor network.
[0096] When the target host 120 does not receive a heartbeat response for a long time, it can be considered that the status of the hardware module 110 is abnormal.
[0097] The request interface is used for the hardware module 110 to send request data to the target host 120 , wherein the request data includes a request address, request parameters, and a signature field, etc.
[0098] The request address is the URL for processing the request on the target host 120 , the request parameters include key-value pairs of all request parameters, and the signature field is used to verify the legitimacy of the request and can be generated based on the request parameters and other keys.
[0099] When the hardware module 110 successfully obtains data from the external network server 130 , the encrypted data may be transmitted to the target host 120 through a successful data callback interface.
[0100] When the hardware module 110 encounters an error (such as connection failure, request timeout or data parsing error, etc.) during communication with the external network server 130, the error information can be passed to the target host 120 through the failure data callback interface for error handling or retry operations.
[0101] During actual execution, the hardware module 110 may sign the access data request based on the signature field.
[0102] For example, all parameters except signature can be sorted in lexicographical order and connected by the "&" symbol to serve as the original signature text; then the original signature text is encrypted by HmacSha1 using the key defined by both parties; and the encrypted ciphertext is base64 encoded.
[0103] In the present application, the hardware module 110 is set without changing the network environment, so that the device can use the network in the intranet environment. The device does not need dual network cards for intranet access, which is convenient to use and has little impact on the normal LAN connection and communication of the intranet.
[0104] According to the hardware module provided in the embodiment of the present application, by defining some standard interfaces and encapsulating the drivers of related hardware modules, the target host can communicate with the external network server more quickly and conveniently.
[0105] In conjunction with the accompanying drawings, the data transmission method, data transmission device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0106] The data transmission method may be applied to a terminal, and may be specifically executed by hardware or software in the terminal.
[0107] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).
[0108] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.
[0109] The data transmission method provided in the embodiment of the present application may be executed by a hardware module or an electronic device, or a functional module or functional entity in the hardware module or electronic device that can implement the data transmission method. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The data transmission method provided in the embodiment of the present application is described below using an electronic device as an example of the execution subject.
[0110] like Figure 3 As shown, the data transmission method includes: step S1, step S2, step S3 and step S4.
[0111] Step S1, the hardware module sends the received access data request to the external network server;
[0112] In this step, the access data request is sent by the target host.
[0113] The target host can generate an access data request based on demand, and the access data request can include information such as an identifier of the target data, query conditions, and security credentials.
[0114] The target host can send a data access request to the hardware module through the first interface.
[0115] In some embodiments, step S1 may include:
[0116] The hardware module encrypts the data access request based on the target key to obtain an encrypted request;
[0117] Send the encrypted request to the external network server.
[0118] In this embodiment, a secure target key may be generated or obtained in a hardware module.
[0119] The hardware module may use the target key to encrypt the access data request. For example, the data may be converted by using an encryption algorithm and a key to obtain an encrypted request.
[0120] The encryption algorithm may include Advanced Encryption Standard (AES) or DES (Data Encryption Standard) symmetric encryption algorithm, etc., which is not limited in this application.
[0121] The encrypted request includes an encrypted form of the original access data request.
[0122] The hardware module can send the encryption request to the external network server through the first interface.
[0123] In some embodiments, after receiving the encryption request, the external network server may decrypt the encryption request using the same key as the hardware module or a corresponding decryption key to restore the original access data request.
[0124] Step S2: the external network server sends the initial service data corresponding to the access data request to the hardware module based on the access data request;
[0125] In this step, after receiving the data access request, the external network server can retrieve or calculate the initial business data from the database according to the information in the request.
[0126] The external network server can send the initial business data back to the hardware module through the network.
[0127] Initial business data may include transaction data, customer information, market data, and business operation data.
[0128] Step S3: The hardware module processes the initial service data to obtain target service data, and sends the target service data to the target host through the communication serial port;
[0129] In this step, the hardware module receives initial service data from the external network server.
[0130] The initial service data may be unencrypted data or encrypted data.
[0131] The hardware module can process the initial business data, such as format conversion, encryption and decryption, or data filtering, to generate target business data.
[0132] The hardware module can send the processed target business data to the target host through a communication serial port (such as RS-232 or RS-485, etc.).
[0133] In some embodiments, the hardware module processes the initial service data to obtain the target service data, which may include:
[0134] Encrypting the initial business data to obtain encrypted business data;
[0135] The encrypted business data is processed based on the target message format to obtain the target business data.
[0136] In this embodiment, the hardware module can receive initial service data sent from the external network server.
[0137] The hardware module can use encryption algorithms and keys to encrypt initial business data.
[0138] The encrypted business data is data obtained after encrypting the initial business data.
[0139] The encrypted business data can be converted into data that conforms to the target message format to obtain the target business data.
[0140] The processing of the encrypted business data may include formatting, encoding or packaging the encrypted business data, so that the target business data obtained after the processing can be correctly parsed and processed in the target system or device.
[0141] The encrypted business data may be processed in other ways, for example, specific header information, separators or checksums may be added.
[0142] In some embodiments, processing the encrypted service data based on the target message format to obtain the target service data may include:
[0143] Encapsulate the encrypted business data and message fields based on the target message format to obtain the message body included in the target business data;
[0144] Based on the check code generation rules, the message body is calculated to generate the target check code corresponding to the target business data;
[0145] Add the target check code to the target position of the message body to obtain the target business data.
[0146] In this embodiment, the message fields may be defined according to the requirements of the target message format.
[0147] The message field may include at least one of a message header field, a user identification number field, a message type field, a message length field, and a message identification number field.
[0148] As shown in Table 1, the data in the protocol can be parsed using the little-endian mode.
[0149] Table 1
[0150] Bit value Explanation of meaning 0 0xA5 Message Header 1 0x01 User ID 2 0xXX Message type (interface type) 3~4 0xXXXX Message data length 5~6 0xXXXX Message ID 7~n Message data Message data n+1 0xXX Internal checksum n+2 0xA6 Message tail
[0151] In the data format, 3 to 4 bytes are the message data length, and the message length is encoded in little-endian mode, that is, the 3rd byte stores the low byte and the 4th byte stores the high byte.
[0152] In the data format, bytes 5 to 6 are the message ID, which, like the message length, can also be encoded in little-endian mode.
[0153] You can use the message ID to filter out duplicate messages caused by timeout retransmission.
[0154] The two-byte message ID can take values from 0 to 65535 and can be used cyclically in actual use.
[0155] The encrypted business data can be encapsulated as part of the message body together with other necessary message fields.
[0156] The encapsulated encrypted business data and message fields can be combined into a complete message body.
[0157] In the process of building the message body, separators, delimiters, or other identifiers can be added to distinguish different fields and data parts.
[0158] The algorithm and rules for generating the check code may be determined according to the requirements of the target message format.
[0159] The check code can be used to verify the integrity and correctness of the data. The check code algorithm may include CRC (cyclic redundancy check), MD5 or SHA-1, etc., or may also be other check code algorithms, which can be selected based on user needs and are not limited in this application.
[0160] The selected checksum generation rule can be used to calculate the message body and generate a target checksum.
[0161] The check code is used to verify the correctness of serial port transmission.
[0162] In actual execution, the checksum is calculated by summing and negating all bytes except the checksum byte, the message end byte, and the escape character and adding 1:
[0163] checkcode = (~sum(byte 0 + byte 2 + ... + byte n) + 1) xor (key)
[0164] Among them, key is defined by the agreement between the two parties.
[0165] Based on the definition of the target message format, the target position of the checksum in the message body can be determined.
[0166] The target position can be the end, beginning, or after a specific field of the message body.
[0167] The generated target check code is added to the target position of the message body. For example, the target check code may be added to the end of the message body.
[0168] The target business data includes encrypted business data, necessary message fields and target check code.
[0169] The target business data complies with the requirements of the target message format and can be correctly parsed and processed by the target system or device.
[0170] In some embodiments, before obtaining the target service data, the method may further include:
[0171] Add the message tail field to the end of the message body to obtain the first business data;
[0172] When a target byte in the first service data is identical to a byte in a message header field, a message tail field, or an escape character, an escape process is performed on the target byte.
[0173] In this embodiment, the message tail field may be used to identify the end of the message.
[0174] The message tail field may include other information, such as a checksum or an end flag.
[0175] Based on the definition of the target message format, it can be determined whether the message trailer field needs to be added.
[0176] The message tail field may be added to the end of the encapsulated message body to allow the receiver to correctly identify the end position of the message.
[0177] The target byte is the same as the collision byte of the message header field, message trailer field, or escape character.
[0178] For each target byte, escape processing may be performed according to the escape rule of the target message format.
[0179] For example, one or more escape characters may be added before the target byte.
[0180] In the actual execution process, in the entire message data, except for the message header, when the same data as the message header (0xA5) appears, an escape character can be added before the data (ie, the data is converted to 0x1B0xA5).
[0181] Except for the message tail (0xA6), when data that is the same as the message tail appears, an escape character can be added before the data (ie, the data is converted to 0x1B0xA6).
[0182] When an escape character (0x1B) appears, the escape character may be added before the data (ie, the data is converted to 0x1B0x1B), wherein the escape character is not counted in the message length.
[0183] In some embodiments, encrypting the initial service data to obtain encrypted service data may include:
[0184] The initial business is encrypted based on an adaptive encryption algorithm or a homomorphic encryption algorithm to obtain encrypted business data.
[0185] In this embodiment, the adaptive encryption algorithm can automatically adjust the encryption strength according to the randomness and complexity of the data.
[0186] Adaptive encryption algorithm can adjust encryption strength according to different data transmission environments and requirements
[0187] Adaptive encryption algorithms can include greedy algorithms, encryption methods based on genetic algorithms, and encryption algorithms based on neural networks.
[0188] Homomorphic encryption allows users to perform calculations directly on encrypted data without decrypting the data. After the calculation is completed, the result is still encrypted, and only users with the decryption key can see the true value of the calculation result.
[0189] Homomorphic encryption can include: additive homomorphic encryption, multiplicative homomorphic encryption and fully homomorphic encryption.
[0190] In some embodiments, sending the target service data to the target host through the communication serial port may include:
[0191] Based on the network status between the hardware module and the target host, adjusting the data transmission parameters between the hardware module and the target host;
[0192] Based on the data transmission parameters, the target business data is sent to the target host through the communication serial port.
[0193] In this embodiment, the network conditions include packet loss rate, bandwidth utilization, connection stability, delay and error rate, etc.
[0194] Among them, the packet loss rate is used to measure the quality of network communication. The packet loss rate is the ratio of the number of data packets lost during data transmission to the total number of data packets sent.
[0195] Bandwidth utilization is the ratio of actual data transmission in the network to the transmission bandwidth.
[0196] Connection stability is used to characterize whether the serial port connection is stable and whether there are frequent interruptions or errors.
[0197] Latency is the time required for data to travel between the hardware module and the destination host.
[0198] The error rate includes checksum errors or frame errors, etc.
[0199] Data transmission parameters may include baud rate, packet size, and retransmission interval, etc.
[0200] Among them, the baud rate determines the speed of data transmission. When the network condition is good, the baud rate can be increased to speed up the data transmission; when the network condition is poor, the baud rate can be reduced to reduce transmission errors.
[0201] When the network bandwidth is wide and the latency is low, the packet size can be appropriately increased to improve transmission efficiency; when the network bandwidth is narrow or the latency is high, the packet size can be reduced to reduce packet loss and retransmission during transmission.
[0202] The retransmission interval can be adjusted according to the network packet loss rate and delay. When the network packet loss rate is high, the retransmission interval can be shortened to recover the lost data packets as soon as possible; when the network packet loss rate is low, the retransmission interval can be extended to reduce unnecessary retransmission overhead.
[0203] In some embodiments, whether the network is congested can be determined by detecting packet loss in the network.
[0204] When the packet loss rate exceeds a set threshold, it can be considered that the network is congested.
[0205] In some embodiments, whether the network is congested may be determined by measuring data transmission delay in the network.
[0206] When the transmission delay exceeds the set threshold, it can be considered that the network is congested.
[0207] When network congestion occurs, the size of the congestion window of the sender can be dynamically adjusted based on the degree of congestion in the network to control the sending rate.
[0208] When the network congestion is low, you can increase the congestion window and increase the sending rate; when the network congestion is high, you can decrease the congestion window and reduce the sending rate.
[0209] When the network is congested, other nodes in the network can be notified by sending a specific congestion signal.
[0210] After other nodes receive the congestion signal, they can reduce the sending rate to alleviate network congestion.
[0211] In some embodiments, FEC parameters may be dynamically adjusted based on network conditions, and service data may be transmitted based on the adjusted FEC parameters:
[0212] In this embodiment, key indicators of the network, such as packet loss rate, delay, and bandwidth utilization, etc., can be monitored.
[0213] Then, FEC parameters such as redundancy and encoding method are dynamically adjusted according to the results of network monitoring.
[0214] For example, when the packet loss rate is high, redundancy can be increased to improve the reliability of data transmission; when the packet loss rate is low, redundancy can be reduced to reduce transmission overhead.
[0215] The actual effect of data transmission can be obtained through the feedback mechanism of the receiving end, and the FEC parameters can be further adjusted according to the feedback results.
[0216] In some embodiments, the business data may be encoded based on a target encoding technique.
[0217] In this embodiment, the target coding technology may include LDPC code or Polar code, etc.
[0218] The internal parameters of the algorithm (such as code length, code rate or number of check bits) can be optimized through theoretical analysis and experimental verification, or machine learning technology can be used to predict network conditions and data transmission error patterns, and dynamically adjust FEC parameters based on the prediction results.
[0219] Step S4: When it is determined that the target service data passes the verification, the target host receives the target service data.
[0220] In this step, the target host can receive target service data from the hardware module through the communication serial port.
[0221] The target host can verify the received data to ensure the integrity and correctness of the data.
[0222] The verification method may include CRC verification or MD5 / SHA hash value comparison.
[0223] After determining that the data has passed verification, the target host can use the target business data for subsequent business logic processing or display.
[0224] In some embodiments, determining that the target service data passes verification may include:
[0225] Obtain the target verification code corresponding to the target business data;
[0226] Calculate the target business data to obtain a first check code corresponding to the target business data;
[0227] When the first verification code is identical to the target verification code, it is determined that the target service data passes the verification.
[0228] In this embodiment, the target service data may be calculated using the same algorithm as the target check code to obtain the first check code.
[0229] When the first check code and the target check code are the same, it indicates that no error or tampering occurs to the target business data during transmission or storage, and it can be determined that the target business data passes the check.
[0230] When the first check code is different from the target check code, it indicates that there may be a problem with the target business data, and you may request retransmission or record an error log.
[0231] In some embodiments, sending the target service data to the target host through the communication serial port includes:
[0232] Determine a data compression algorithm based on target business data;
[0233] Compressing the target service data based on a data compression algorithm to obtain second service data;
[0234] The second service data is sent to the target host through the communication serial port.
[0235] In this embodiment, a data compression algorithm may be determined based on data content, and the service data may be compressed based on the data compression algorithm.
[0236] The data content can be analyzed, for example, the data type (such as text, images, and videos), data characteristics (such as repetitive patterns, redundancy, and complexity), and compression requirements (such as compression ratio, decompression speed, compressed data quality, etc.) can be analyzed.
[0237] Based on the results of the content analysis, a compression algorithm that best suits the current data content can be selected from a predefined compression algorithm library.
[0238] Data compression algorithms can include traditional lossless compression algorithms (such as ZIP and GZIP) and lossy compression algorithms (such as JPEG and WebP), as well as compression algorithms based on machine learning, etc.
[0239] After the data compression algorithm is determined, the parameters of the algorithm can be further adjusted according to the data characteristics and compression requirements. For example, the compression level can be adjusted, a specific encoding mode can be selected, or the internal parameters of the algorithm can be optimized.
[0240] After the business data is compressed based on the data compression algorithm, the performance of the compressed data can be evaluated, including compression ratio, decompression speed, and data quality.
[0241] In some embodiments, multiple compression algorithms with complementary advantages may be selected and combined to obtain a hybrid compression strategy.
[0242] The data to be compressed can be divided into multiple parts or blocks, and each part or block is assigned to the most suitable compression algorithm for processing according to its characteristics and compression requirements.
[0243] Parallel computing techniques can be used to process different parts or blocks of data simultaneously, and then the compression results of the various parts or blocks can be combined into a complete compressed file.
[0244] In the actual execution process, for example, in the process of the hardware module sending the target service data to the target host, the target service data can be compressed and processed according to the target service data and the network status, and the transmission strategy between the hardware module and the target host can be dynamically adjusted. The data transmission device provided by the present application is described below, and the data transmission device described below and the data transmission method described above can be referred to each other.
[0245] The data transmission method provided in the embodiment of the present application can be executed by a data transmission device. In the embodiment of the present application, the data transmission method executed by a data transmission device is taken as an example to illustrate the data transmission device provided in the embodiment of the present application.
[0246] The embodiment of the present application also provides a data transmission device.
[0247] like Figure 4 As shown, the data transmission device includes: a first processing module 410 , a second processing module 420 , a third processing module 430 and a fourth processing module 440 .
[0248] The first processing module 410 is used for the hardware module to send the received access data request to the external network server; the access data request is sent by the target host;
[0249] The second processing module 420 is used for the external network server to send the initial service data corresponding to the access data request to the hardware module based on the access data request;
[0250] The third processing module 430 is used for the hardware module to process the initial service data to obtain target service data, and send the target service data to the target host through the communication serial port;
[0251] The fourth processing module 440 is configured to enable the target host to receive the target service data when it is determined that the target service data passes the verification.
[0252] In some embodiments, the third processing module 430 may also be used to:
[0253] Encrypting the initial business data to obtain encrypted business data;
[0254] The encrypted business data is processed based on the target message format to obtain the target business data.
[0255] In some embodiments, the third processing module 430 may also be used to:
[0256] Encapsulating the encrypted business data and message fields based on the target message format to obtain a message body included in the target business data; the message fields include at least one of a message header field, a user identification number field, a message type field, a message length field, and a message identification number field;
[0257] Based on the check code generation rules, the message body is calculated to generate the target check code corresponding to the target business data;
[0258] Add the target check code to the target position of the message body to obtain the target business data.
[0259] In some embodiments, the third processing module 430 may also be used to:
[0260] The initial service is encrypted based on an adaptive encryption algorithm or a homomorphic encryption algorithm to obtain encrypted service data. In some embodiments, the third processing module 430 may also be used to add a message tail field to the end of the message body before obtaining the target service data to obtain the first service data;
[0261] When a target byte in the first service data is identical to a byte in the message header or an escape character, an escape process is performed on the target byte.
[0262] In some embodiments, the third processing module 430 may also be used to:
[0263] Based on the network status between the hardware module and the target host, adjusting the data transmission parameters between the hardware module and the target host;
[0264] Based on the data transmission parameters, the target business data is sent to the target host through the communication serial port.
[0265] In some embodiments, the third processing module 430 may also be used to:
[0266] Determine a data compression algorithm based on target business data;
[0267] Compressing the target service data based on a data compression algorithm to obtain second service data;
[0268] The second service data is sent to the target host through the communication serial port.
[0269] In some embodiments, the fourth processing module 440 may also be used to:
[0270] Obtain the target verification code corresponding to the target business data;
[0271] Calculate the target business data to obtain a first check code corresponding to the target business data;
[0272] When the first verification code is identical to the target verification code, it is determined that the target service data passes the verification.
[0273] In some embodiments, the first processing module 410 may also be used to:
[0274] The hardware module encrypts the data access request based on the target key to obtain an encrypted request;
[0275] Send the encrypted request to the external network server.
[0276] The data transmission device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0277] The data transmission device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0278] The data transmission device provided in the embodiment of the present application can achieve Figure 3 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0279] In some embodiments, Figure 5 As shown, an embodiment of the present application also provides an electronic device 500, including a processor 501, a memory 502, and a computer program stored in the memory 502 and executable on the processor 501. When the program is executed by the processor 501, each process of the above-mentioned data transmission method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0280] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0281] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the various processes of the above-mentioned data transmission method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0282] On the other hand, the present application 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 perform the various processes of the above-mentioned data transmission method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0283] On the other hand, an embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data transmission method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0284] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0285] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0286] 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, by hardware. Based on this understanding, the above technical solution can be essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which 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 embodiment.
[0287] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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 application.
Claims
1. A hardware module, characterized in that: include: A first interface, wherein the first interface is connected to an external network server; A communication serial port, the communication serial port is connected to a target host; The hardware module is used to return target service data corresponding to the access data request to the target host when receiving the access data request sent by the target host; The communication serial port includes: an initialization interface, a heartbeat interface, a request interface, a success data callback interface and a failure data callback interface; The hardware module includes a single chip microcomputer or an embedded module.
2. A data transmission method based on the hardware module according to claim 1, characterized in that: include: The hardware module sends the received access data request to the external network server; The access data request is sent by the target host; The external network server sends the initial service data corresponding to the access data request to the hardware module based on the access data request; The hardware module processes the initial service data to obtain the target service data, and sends the target service data to the target host through the communication serial port; When it is determined that the target service data passes the verification, the target host receives the target service data.
3. The data transmission method according to claim 2, characterized in that: The hardware module processes the initial service data to obtain target service data, including: Encrypting the initial service data to obtain encrypted service data; The encrypted business data is processed based on a target message format to obtain the target business data.
4. The data transmission method according to claim 3, characterized in that: The step of processing the encrypted service data based on the target message format to obtain the target service data includes: Encapsulating the encrypted service data and message fields based on the target message format to obtain a message body included in the target service data; the message fields include at least one of a message header field, a user identification number field, a message type field, a message length field, and a message identification number field; Based on the check code generation rule, the message body is calculated to generate a target check code corresponding to the target business data; The target verification code is added to the target position of the message body to obtain the target business data.
5. The data transmission method according to claim 3, characterized in that: The encrypting the initial service data to obtain encrypted service data includes: The initial business is encrypted based on an adaptive encryption algorithm or a homomorphic encryption algorithm to obtain the encrypted business data.
6. The data transmission method according to claim 3, characterized in that: Before obtaining the target service data, the method further includes: Adding a message tail field to the end of the message body to obtain first service data; When a target byte in the first service data is identical to a byte of the message header field, the message tail field or an escape character, an escape process is performed on the target byte.
7. The data transmission method according to any one of claims 2 to 6, characterized in that: The sending the target service data to the target host through the communication serial port includes: adjusting data transmission parameters between the hardware module and the target host based on a network condition between the hardware module and the target host; Based on the data transmission parameters, the target service data is sent to the target host through the communication serial port.
8. The data transmission method according to any one of claims 2 to 6, characterized in that: The sending the target service data to the target host through the communication serial port includes: Determining a data compression algorithm based on the target business data; Compressing the target service data based on the data compression algorithm to obtain second service data; The second service data is sent to the target host through the communication serial port.
9. The data transmission method according to any one of claims 2 to 6, characterized in that: The determining that the target business data passes the verification includes: Obtaining a target verification code corresponding to the target service data; Calculating the target service data to obtain a first check code corresponding to the target service data; When the first verification code is identical to the target verification code, it is determined that the target service data passes the verification.
10. A data transmission device based on the hardware module according to claim 1, characterized in that: include: A first processing module, configured for the hardware module to send the received access data request to the external network server; The access data request is sent by the target host; A second processing module, configured for the external network server to send initial service data corresponding to the access data request to the hardware module based on the access data request; A third processing module, configured for the hardware module to process the initial service data to obtain the target service data, and to send the target service data to the target host through the communication serial port; The fourth processing module is used for, when it is determined that the target service data passes the verification, the target host receives the target service data.
