Data encryption transmission method and device for intelligent gateway, equipment and medium
By using neural networks in the intelligent gateway for data encryption and decryption, and combining the verification method of preset data segments, data transmission efficiency and security issues in the intelligent gateway are solved, and efficient and secure data encryption transmission is achieved.
Patent Information
- Application Number
- CN202410890648.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2025-03-07
AI Technical Summary
It is difficult to achieve efficient and secure data transmission in an intelligent gateway in an existing technology. The existing encryption methods are computationally large and have low efficiency in data consistency verification, which cannot meet the performance requirements of the intelligent gateway's rapid response.
By constructing a first neural network including multiple encoder layers and a second neural network arranged in reverse order, the mapping and reflection of the neural network are used to process data encryption and decryption, and the computing efficiency is improved, and data consistency verification is achieved by adding preset data segments to the data.
It significantly improves the efficiency and security of data encryption transmission in intelligent gateways, reduces the amount of encryption and decryption calculations, and realizes efficient data consistency verification, meeting the performance requirements of intelligent gateways to respond quickly.
Smart Images

Figure CN119583090A_ABST
Abstract
Description
Technical Field
[0001] The present invention is applicable to the field of data encryption technology, and in particular relates to a data encryption transmission method, device, equipment and medium for an intelligent gateway. Background Art
[0002] Smart gateway is a network device, which is the key to the intelligence of local area network. Through smart gateway, the information collection and control of various sensors, network devices, cameras, hosts and other devices in the local area network can be realized. Therefore, in the application scenario of smart gateway, the data interaction between various terminals needs to be realized through smart gateway as a router. In order to ensure the security of various terminals in the overall system and avoid data leakage, it is often necessary to encrypt the data during the data interaction through smart gateway.
[0003] However, as users have higher and higher requirements for local area network scenarios such as smart homes, the performance requirements of smart gateways used in local area networks are also increased. Smart gateways are required to quickly complete the transmission of control commands and data information. The existing data encryption methods with higher security often correspond to large amounts of data decryption calculations, and when performing consistency checks on encrypted data before and after transmission, the most commonly used verification methods, such as hash checks, require hash coding calculations on the encrypted data before and after transmission, further reducing data transmission efficiency. As a result, existing encrypted transmissions are unable to meet the rapid response requirements of smart gateways.
[0004] Therefore, how to achieve efficient and secure transmission of data in intelligent gateways has become an urgent problem to be solved. Summary of the invention
[0005] In view of this, the embodiments of the present invention provide a data encryption transmission method, device, equipment and medium for an intelligent gateway to solve the problem that data in the current intelligent gateway cannot be transmitted efficiently and securely.
[0006] In a first aspect, a data encryption transmission method for an intelligent gateway is provided, the method comprising: Constructing a first neural network including a plurality of encoder layers, wherein the input size and the output size of each encoder layer are consistent, and the training of the first neural network is completed in the expectation of increasing the gap between the input and the output of each encoder layer; Arrange all encoder layers in the first neural network in reverse order as encoder layers of the second neural network, input any training sample of the first neural network into the trained first neural network to obtain stable input and stable output of each encoder layer, use the stable output of any number of encoder layers as training samples of encoder layers with the same number of layers in the second neural network, use the stable input of any number of encoder layers as labels of encoder layers with the same number of layers in the second neural network, and complete the training of the second neural network; The sending end inputs the initial data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end receives the encrypted data and the specified number of layers via the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
[0007] In a second aspect, a data encryption transmission device for an intelligent gateway is provided, the device comprising: An encryption model training module, used to construct a first neural network including a plurality of encoder layers, wherein the input size and output size of each encoder layer are consistent, and the training of the first neural network is completed in the expectation of widening the gap between the input and output of each encoder layer; a decryption model training module, configured to arrange all encoder layers in the first neural network in reverse order as encoder layers of the second neural network, input any training sample of the first neural network into the trained first neural network to obtain stable input and stable output of each encoder layer, use the stable output of encoder layers of any number of layers as training samples of encoder layers of the same number of layers in the second neural network, use the stable input of the encoder layers of any number of layers as labels of encoder layers of the same number of layers in the second neural network, and complete the training of the second neural network; The data transmission module is used for the sending end to input the initial data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end receives the encrypted data and the specified number of layers through the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
[0008] In a third aspect, an embodiment of the present invention provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data encryption transmission method for an intelligent gateway as described in the first aspect is implemented.
[0009] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data encryption transmission method for an intelligent gateway as described in the first aspect is implemented.
[0010] Compared with the prior art, the present invention has the following beneficial effects: The present invention encrypts and decrypts data through the mapping processing method of the encoder layer, which can significantly improve the computational efficiency of data encryption and decryption, and the mapping method of encryption and decryption cannot be predicted in advance, and can only be determined after the first and second neural network training for encryption and decryption is completed. At the same time, the terminal side cannot know the specific information such as the weight parameters included in each encoder layer, but can only use the encoder layer, ensuring data security. Finally, the present invention significantly improves the efficiency and security of data encryption transmission in the intelligent gateway. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0012] Figure 1 This is a schematic diagram of an application environment of a data encryption transmission method for an intelligent gateway provided by Embodiment 1 of the present invention; Figure 2 It is a flow chart of a data encryption transmission method for an intelligent gateway provided in the first embodiment of the present invention; Figure 3 It is a flow chart of a data encryption transmission method for an intelligent gateway that can simultaneously implement data consistency verification provided by Embodiment 2 of the present invention; Figure 4 It is a structural diagram of a data encryption transmission device for an intelligent gateway provided by Embodiment 3 of the present invention; Figure 5 It is a structural diagram of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0013] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0014] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0015] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0016] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.
[0017] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0018] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0019] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0020] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0021] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0022] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.
[0023] A data encryption transmission method for an intelligent gateway provided in the first embodiment of the present invention can be applied in the following aspects: Figure 1 In the application environment, both the sender and the receiver communicate with the smart gateway. The sender or receiver includes but is not limited to PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, personal digital assistants (PDAs), smart appliances, sensors and other terminal devices. The sender and the receiver can exchange identities when performing different data encryption transmissions. Both are essentially terminal devices connected to the smart gateway. The figure only shows one sender and one receiver. It is easy to understand that in a local area network such as a smart home scenario, it can usually include more than two terminal devices. Figure 1 Just a simple illustration.
[0024] See also Figure 2 , is a flow chart of a data encryption transmission method for an intelligent gateway provided by Embodiment 1 of the present invention. The data encryption transmission method for an intelligent gateway can be applied to Figure 1 In the terminal devices such as the sending and receiving ends, it can also be applied to the intelligent gateway, such as Figure 2 As shown, the data encryption transmission method for the intelligent gateway may include the following steps: Step S101, constructing a first neural network including a plurality of encoder layers, wherein the input size and output size of each encoder layer are consistent, and the gap between the input and output of each encoder layer is enlarged to complete the training of the first neural network as desired.
[0025] The present invention takes into account the existing data encryption methods with higher security. The reason why their encryption transmission efficiency is low is that each encrypted transmission requires a complex encryption and decryption calculation to be performed again. For this reason, this embodiment constructs a neural network for encryption and decryption. Through the mapping and reverse mapping of data by the trained neural network, the data encryption and decryption in the data transmission process of the intelligent gateway are completed, thereby improving the data encryption transmission efficiency.
[0026] Specifically, firstly, the first neural network for data encryption is constructed. The first neural network includes N encoder layers. For each encoder layer, its input size and output size are consistent, both of which are standardized size 1*K. The standardized size 1*K can be the maximum size of the data size corresponding to all historical transmission data of the intelligent gateway. Here, the default data is sent as a vector in the form of one row and multiple columns. If other forms of data are to be transmitted, only the size needs to be adjusted. For example, for a vector in the form of 2*2, the row vectors in the vector are spliced to obtain a vector in the form of 1*4, which can be adjusted to vector data in the form of one row and multiple columns. This size adjustment is performed on all historical data transmitted by the intelligent gateway, and then the maximum data size 1*K in the historical data is determined as the above-mentioned standardized size.
[0027] The training method of the first neural network is: select several historical transmission data as training samples, and the data size reaches 1*K by zero padding. For a single training sample, it is input into the first neural network, and the mean square error between the input and output of each encoder layer is calculated. Since the input size and output size of each encoder layer are consistent, the mean square error calculation is easy to implement. The mean square error calculation formula is the same as the Euclidean distance. The mean square error between the input and output of the nth encoder layer is expressed as , the sum of the mean square errors of all encoder layers is expressed as , the first loss function , where q is an adjustment parameter used to adjust the rate at which the first loss function changes with the change of D. For example, it can be set to 10. The larger q is, the greater the rate at which the first loss function changes with the change of D. When D=0, that is, when the input and output of any encoder layer are consistent, the first loss function takes the maximum value.
[0028] The first neural network is trained with the first loss function, and the input and output of any encoder layer in the trained first neural network are different and the difference is large.
[0029] In other embodiments, the first neural network may be configured to additionally include a fully connected layer based on the N encoder layers, the input size of the fully connected layer being the above-mentioned standardized size 1*K, and the output size being 1*1, i.e., a numerical value.
[0030] Then, after adding the fully connected layer on the basis of the N-layer encoder layer, the training process of the first neural network additionally includes: after a single training sample is input into the first neural network, it is necessary to calculate the difference between the preset reference value and the regression value output by the first neural network as a whole, and calculate the absolute value of the difference. To ensure the differentiability of the loss function, the absolute value is calculated by taking the square root of the difference between the regression value and the reference value, and the absolute value of the calculated difference is used as the second loss function. , with the first loss function And the second loss function The first neural network is trained together as its loss function. At this time, the trained first neural network not only has the characteristic that the input and output of any encoder layer are different and the difference is large, but also has the characteristic of outputting the above reference value no matter what data is input.
[0031] The reason for adding the fully connected layer is that although the first neural network can be trained to be used for encryption only by the first loss without including the fully connected layer, in this case, if the implementer wants to update the mapping relationship of the encoder layers in the first neural network, it is necessary to adjust the parameters of the encoder layers in the first neural network. This adjustment method is more cumbersome, so the fully connected layer and the customizable reference value are added, and the second loss function is constructed accordingly to participate in the training of the first neural network. As a result, the implementer can update the parameters of the overall model of the first neural network at any time by only adjusting the reference value, thereby improving the convenience and efficiency of updating the encryption model.
[0032] Step S102, all encoder layers in the first neural network are arranged in reverse order as encoder layers of the second neural network, any training sample of the first neural network is input into the trained first neural network to obtain stable input and stable output of each encoder layer, the stable output of encoder layers of any number of layers is used as the training sample of encoder layers of the same number of layers in the second neural network, the stable input of encoder layers of any number of layers is used as the label of encoder layers of the same number of layers in the second neural network, and the training of the second neural network is completed.
[0033] The second neural network compares the number of encoder layers of the first neural network and also includes N encoder layers. Since the second neural network serves as a decryption model to decrypt the data encrypted by the encryption model of the first neural network, the encoder layers used by the second neural network should be exactly the same as the encoder layers of the first neural network.
[0034] However, since the second neural network decrypts the encrypted data obtained by mapping the first neural network, the second neural network should be composed of all the encoder layers in the first neural network arranged in reverse order and then used as the encoder layers of the second neural network. Also because of the relationship between mapping and inverse mapping, the training of the second neural network should be: After the first neural network model is trained, any training sample of the first neural network is input into the trained first neural network to determine the input and output of each encoder layer. Since the first neural network is already trained at this time, the input and output of each encoder layer can be used as the stable input and stable output of the corresponding encoder layer respectively.
[0035] It is easy to understand that although the second neural network as a whole needs to realize the inverse mapping of the mapping result of the first neural network, then during the training process, the training data of the nth encoder layer among all N encoder layers in the first neural network should be used correspondingly in the N-n+1th encoder layer in the second neural network. However, since in the process of constructing the second neural network in this embodiment, all the encoder layers in the first neural network are pre-arranged in reverse order as the encoder layers of the second neural network, when the second neural network is actually trained, the training data of the nth encoder layer in the first neural network should be used to train the same nth encoder layer in the second neural network.
[0036] Specifically, after any training sample of the first neural network is input into the trained first neural network and the stable input and stable output of each encoder layer are determined, the stable output of the nth encoder layer in the first neural network is used as the training sample of the nth encoder layer in the second neural network, and the stable input of the nth encoder layer in the first neural network is used as the label of the nth encoder layer in the second neural network, thereby completing one training of the second neural network corresponding to any current training sample.
[0037] Since the second neural network has exactly the same number of encoder layers as the first neural network and uses exactly the same encoder layers, if the first neural network can complete training through all its training samples, then correspondingly, the second neural network can also complete training through these training samples of the same number and content, and finally a trained second neural network is obtained.
[0038] Through the above training, the trained second neural network has the following characteristics: the nth encoder layer in the second neural network can implement the reverse operation of the nth encoder layer in the first neural network.
[0039] In step S103, the sending end inputs the initial data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end receives the encrypted data and the specified number of layers via the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
[0040] The trained first neural network and the trained second neural network can be stored in the memory on the intelligent gateway side and the terminal side with computing capability, and can be called by their respective processors.
[0041] In this embodiment, the number of encoder layers in the first neural network and the second neural network is equivalent to the key. Terminal A sends initial data to terminal B. Terminal A processes the initial data using the encoder layer corresponding to its encoder layer number C in the first model to obtain first output data. This process is equivalent to the data encryption process. The first output data is sent to terminal B. Terminal B processes the first output data through the Cth encoder layer in the second model to obtain second output data. This process is equivalent to the data decryption process.
[0042] Therefore, in the process of completing the training of the first and second neural networks and actually performing data encryption transmission, a target number of encoder layers is randomly determined from the range of [1, N] as the specified number of layers, and the data sending end on the terminal side inputs the initial data to be sent into the encoder layer of the specified number of layers of the first neural network, and uses the output result as the encrypted data. Then, the data receiving end on the terminal side receives the encrypted data and the specified number of layers through the intelligent gateway, and then inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network, thereby completing the inverse operation of the encryption mapping process of the first neural network and obtaining the decrypted data.
[0043] The data encryption transmission method for the intelligent gateway in this embodiment encrypts and decrypts data through the mapping processing method of the encoder layer, which can significantly improve the computational efficiency of data encryption and decryption, and the mapping method of encryption and decryption cannot be predicted in advance, and the mapping can only be realized after the training of the two neural networks is completed. At the same time, the terminal side cannot know the specific information such as the weight parameters included in each encoder layer, but can only use the encoder layer, ensuring data security. Finally, the data encryption transmission method for the intelligent gateway in this embodiment can significantly improve the efficiency and security of data encryption transmission in the intelligent gateway.
[0044] See also Figure 3, is a flow chart of a data encryption transmission method for an intelligent gateway that can simultaneously realize data consistency verification provided by Embodiment 2 of the present invention. This method also needs to first complete the training of the first neural network and the second neural network. The training process is the same as the training process of the first neural network and the second neural network in step S101 and step S102 in the above Embodiment 1, so it will not be repeated.
[0045] After completing the training of the second neural network, the method further includes: In step S201, the sending end adds a preset data segment at a specified position of the initial data and inputs the data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data. The receiving end receives the encrypted data and the specified number of layers via the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
[0046] The encryption and decryption process constructed in this embodiment, which uses the encoder layer in the neural network to map the data, is a processing process that regards the data as a whole as a single target. It is different from the existing commonly used data encryption and decryption calculation process in which different parts of the overall data are processed separately. In this embodiment, when the data as a whole undergoes very little change, it can be identified that the overall data has changed, or it can be identified that the target has changed.
[0047] That is, existing data encryption and decryption methods have low sensitivity to slight changes in data, and changes in some data in the overall data may not be accurately and effectively identified. Therefore, before and after the data is encrypted and transmitted, it is generally necessary to perform an additional hash code calculation on the encrypted data before transmission after encryption, and a second hash code calculation on the encrypted data before decryption after transmission, and complete the data consistency check by comparing the two hash codes.
[0048] However, as mentioned above, since the encryption and decryption process of this embodiment, which maps the data through the encoder layer in the neural network, regards the data as a single target, even if the data changes slightly, the data obtained after decryption will be significantly different from the initial data before encryption. That is, the encryption and decryption method of this embodiment, like the existing hash check, has a high sensitivity to data changes.
[0049] Therefore, the sender can complete the data consistency check by adding a preset data segment at the specified position of the initial data and then encrypting it, and observing whether the preset data segment still exists at the specified position of the decrypted data after decryption, without the need for additional hash check calculations.
[0050] Specifically, in this embodiment, the designated position is preferably the front end of the initial data, and the length of the preset data segment is determined according to the accuracy requirements of the consistency check and the data transmission efficiency requirements. It is easy to understand that the longer the length of the preset data segment is, the higher its proportion relative to the initial data, and the higher the accuracy of the final consistency check; at the same time, the shorter the length of the preset data segment is, the smaller the amount of additional data added to the initial data, and the higher the data transmission efficiency.
[0051] It should be emphasized that before the data is encrypted and transmitted, the designated location and the preset data segment should be known to each terminal side, that is, they should have been agreed upon, so that consistency verification can be successfully implemented.
[0052] Then, after the sending end adds a preset data segment at the specified position of the initial data and inputs the entire data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end can receive the encrypted data and the specified number of layers through the intelligent gateway, and input the encrypted data into the encoder layer of the same specified number of layers in the second neural network to obtain decrypted data, at this time.
[0053] The designated number of layers is the same as in the previous embodiment and is also randomly generated.
[0054] Step S202, checking whether the preset data segment exists at the designated position of the decrypted data, and if not, issuing a consistency check failure warning.
[0055] After the decrypted data is obtained by decryption at the receiving end, if no errors such as malicious tampering occur during the transmission process, then the decrypted data should be exactly the same as the initial data after adding the preset data segment at the specified position. Therefore, by observing the specified position of the decrypted data, specifically the preferred embodiment of this embodiment, that is, whether the preset data segment also exists at the front end of the decrypted data, the data consistency check can be completed. It is easy to understand that if the preset data segment does not exist at this time, it indicates that an error has occurred in the transmission of the encrypted data, and the data before and after the transmission are inconsistent. At this time, an early warning of the failure of the consistency check should be issued, and the intelligent gateway can choose to notify the data sender to resend the initial data.
[0056] The embodiment of the present invention provides a consistency verification method that does not require additional hash code calculation like the existing hash verification, and can achieve the consistency detection accuracy of the existing hash verification, ultimately realizing efficient data consistency verification in the process of intelligent gateway data encryption transmission.
[0057] Corresponding to the method of the above embodiment, Figure 4The structural block diagram of the data encryption transmission device for the intelligent gateway provided by the third embodiment of the present invention is shown. The above transmission device is applied to a computer device, and the computer device is connected to the target database through a preset application program interface. When the target database is driven to perform a corresponding task, a corresponding task log will be generated, and the above task log can be collected through the API. For the convenience of explanation, only the part related to the embodiment of the present invention is shown.
[0058] See also Figure 4 , the transmission device comprises: The encryption model training module 31 is used to construct a first neural network including a plurality of encoder layers, wherein the input size and output size of each encoder layer are consistent, and the input and output gap of each encoder layer is enlarged to complete the training of the first neural network; The decryption model training module 32 is used to reverse the order of all encoder layers in the first neural network as encoder layers of the second neural network, input any training sample of the first neural network into the trained first neural network to obtain stable input and stable output of each encoder layer, use the stable output of any number of encoder layers as training samples of the same number of encoder layers in the second neural network, use the stable input of any number of encoder layers as labels of the same number of encoder layers in the second neural network, and complete the training of the second neural network; The data transmission module 33 is used for the sending end to input the initial data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end receives the encrypted data and the specified number of layers through the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
[0059] Optionally, the encryption model training module 31 includes: The first loss function construction unit is used to calculate the mean square error between the input and output of each encoder layer in the first neural network, construct a first loss function that is inversely proportional to the sum of all mean square errors, and use the first loss function for training the first neural network.
[0060] Optionally, the encryption model training module 31 further includes: A first neural network structure improvement unit, used to limit the first neural network to further include a fully connected layer, the input size of the fully connected layer is the same as the output size of the encoder layer, and the output of the fully connected layer is a single value; A second loss function construction unit is used to calculate the absolute value of the difference between the regression value obtained after the training sample is input into the first neural network and the preset reference value during the training process of the first neural network, construct a second loss function proportional to the absolute value of the difference, and use the second loss function for the training of the first neural network.
[0061] Optionally, the data transmission module 33 includes: A specified layer number generating unit is used to limit the specified number of layers to be randomly generated based on the total number of layers of all encoder layers in the first neural network.
[0062] Optionally, the encryption model training module 31 further includes: The encoder layer size determination unit is used to determine the input size and output size of the encoder layer according to the maximum data size in the historical data transmitted by the intelligent gateway.
[0063] Optionally, the transmission device further includes: A data verification and transmission module 34 for replacing the data transmission module 33, the data verification and transmission module 34 comprising: A data transmission unit, configured for a transmitting end to add a preset data segment at a specified position of the initial data and then input the data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, a receiving end to receive the encrypted data and the specified number of layers via an intelligent gateway, and input the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data; The consistency check unit is used to check whether the preset data segment exists at the designated position of the decrypted data, and if not, issue a consistency check failure warning.
[0064] It should be noted that the information interaction, execution process and other contents between the above modules are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0065] Figure 5 This is a schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. Figure 5 As shown, the computer device of this embodiment includes: at least one processor ( Figure 5 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned embodiments of the data encryption transmission method for an intelligent gateway are implemented.
[0066] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 5This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the figure, or a combination of certain components, or different components.
[0067] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0068] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments, it may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.
[0069] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0070] The present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing.
[0071] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0072] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0073] In the embodiments provided by the present invention, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0074] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0075] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A data encryption transmission method for an intelligent gateway, characterized in that: The method comprises: Constructing a first neural network including a plurality of encoder layers, wherein the input size and the output size of each encoder layer are consistent, and the training of the first neural network is completed in the expectation of increasing the gap between the input and the output of each encoder layer; Arrange all encoder layers in the first neural network in reverse order as encoder layers of the second neural network, input any training sample of the first neural network into the trained first neural network to obtain stable input and stable output of each encoder layer, use the stable output of any number of encoder layers as training samples of encoder layers with the same number of layers in the second neural network, use the stable input of any number of encoder layers as labels of encoder layers with the same number of layers in the second neural network, and complete the training of the second neural network; The sending end inputs the initial data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end receives the encrypted data and the specified number of layers via the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
2. The data encryption transmission method for intelligent gateway according to claim 1 is characterized in that: The step of completing the training of the first neural network by increasing the gap between the input and output of each encoder layer as desired includes: The mean square error between the input and output of each encoder layer in the first neural network is calculated, a first loss function inversely proportional to the sum of all mean square errors is constructed, and the first loss function is used for training the first neural network.
3. The data encryption transmission method for intelligent gateway according to claim 1 or 2, characterized in that: The first neural network further comprises a fully connected layer, the input size of the fully connected layer is the same as the output size of the encoder layer, and the output of the fully connected layer is a single value; During the training process of the first neural network, the absolute value of the difference between the regression value obtained after the training sample is input into the first neural network and the preset reference value is calculated, a second loss function proportional to the absolute value of the difference is constructed, and the second loss function is used for the training of the first neural network.
4. The data encryption transmission method for intelligent gateway according to claim 1 is characterized in that: The specified number of layers is randomly generated based on the total number of layers of all encoder layers in the first neural network.
5. The data encryption transmission method for intelligent gateway according to claim 1, characterized in that: The input size and output size of the encoder layer are determined according to the maximum data size in the historical data transmitted by the intelligent gateway.
6. The data encryption transmission method for intelligent gateway according to claim 1, characterized in that: After completing the training of the second neural network: The sending end adds a preset data segment at a specified position of the initial data and inputs the data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data. The receiving end receives the encrypted data and the specified number of layers through the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data. Check whether the preset data segment exists at the designated location of the decrypted data, and if not, issue a consistency check failure warning.
7. The data encryption transmission method for intelligent gateway according to claim 6 is characterized in that: The length of the preset data segment is determined according to the accuracy requirement of the consistency check and the data transmission efficiency requirement.
8. A data encryption transmission device for an intelligent gateway, characterized in that: The device comprises: An encryption model training module, used to construct a first neural network including a plurality of encoder layers, wherein the input size and output size of each encoder layer are consistent, and the training of the first neural network is completed in the expectation of widening the gap between the input and output of each encoder layer; a decryption model training module, configured to arrange all encoder layers in the first neural network in reverse order as encoder layers of the second neural network, input any training sample of the first neural network into the trained first neural network to obtain stable input and stable output of each encoder layer, use the stable output of encoder layers of any number of layers as training samples of encoder layers of the same number of layers in the second neural network, use the stable input of the encoder layers of any number of layers as labels of encoder layers of the same number of layers in the second neural network, and complete the training of the second neural network; The data transmission module is used for the sending end to input the initial data into the encoder layer of the specified number of layers in the first neural network to obtain encrypted data, the receiving end receives the encrypted data and the specified number of layers through the intelligent gateway, and inputs the encrypted data into the encoder layer of the specified number of layers in the second neural network to obtain decrypted data.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the data encryption transmission method for an intelligent gateway as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data encryption transmission method for an intelligent gateway as described in any one of claims 1 to 7 is implemented.