Data transmission method, electronic equipment and storage medium

By using the serial number of the electronic device to perform an XOR operation on the data to be processed, the problem of high hardware performance requirements of the encryption algorithm in the prior art is solved, and secure data transmission and energy consumption reduction are achieved on low-power devices.

CN120811697APending Publication Date: 2025-10-17UBTECH ROBOTICS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511047830.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the existing technology, encryption algorithms with high computational complexity, such as RSA, have high requirements on device hardware performance and high energy consumption. They are not suitable for low-power devices with limited resources, resulting in data transmission security and energy consumption issues.

Method used

By using the unique serial number of each electronic device to perform XOR operations on multiple bytes in each frame of data to be processed, encryption and decryption are performed to ensure the uniqueness of the encryption key and reduce the complexity and energy consumption of encryption calculations.

Benefits of technology

It achieves safe and reliable data transmission on low-power devices, ensures the security of data transmission, and reduces the complexity and energy consumption of encryption calculations. It is suitable for a variety of devices and server architectures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120811697A_ABST
    Figure CN120811697A_ABST
Patent Text Reader

Abstract

The invention provides a data transmission method, electronic equipment and a storage medium, and belongs to the technical field of information security, and the method comprises the following steps: when to-be-processed data needs to be sent to second electronic equipment, obtaining a serial number of first electronic equipment, the serial number being a unique identification code allocated by the first electronic equipment during production, the second electronic device is a device associated with the first electronic device and used for data processing; for each frame of data in the to-be-processed data, according to the serial number, performing XOR operation on a plurality of bytes in each frame of to-be-processed data to obtain encrypted to-be-processed data; and sending the encrypted to-be-processed data to the second electronic equipment. Through the scheme, the security of data transmission is ensured, and meanwhile, the complexity of encryption calculation is reduced, so that the energy consumption generated in the encryption process is reduced, and the method is more suitable for low-power-consumption equipment.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of information security, and particularly relates to a data transmission method, an electronic device and a storage medium. BACKGROUND

[0002] With the increasing demand for information security, data security in the data transmission process has become an important link to ensure information security. Encrypting data before data transmission has become an important means to ensure information security.

[0003] In the related art, in order to improve the security of data transmission, an encryption algorithm with large computational complexity is used for encryption, for example, a Rivest-Shamir-Adleman (RSA) asymmetric encryption algorithm. However, since such an algorithm has large computational complexity, it has high requirements on the hardware performance of a device, occupies too much processing time of a processor, and has high energy consumption, and is not suitable for low-power devices with limited resources. SUMMARY

[0004] The present application aims to provide a data transmission method, an electronic device and a storage medium, and aims to solve the problem that the encryption of data in the traditional data transmission process has high requirements on a device.

[0005] A first aspect of an embodiment of the present application provides a data transmission method, which is applied to a first electronic device, and the method comprises:

[0006] When it is necessary to send to-be-processed data to a second electronic device, a serial number of the first electronic device is obtained, the serial number being a unique identification code allocated to the first electronic device when the first electronic device is produced, and the second electronic device being a device associated with the first electronic device and used for data processing;

[0007] For each frame of data in the to-be-processed data, a plurality of bytes in each frame of to-be-processed data are subjected to an exclusive-OR operation according to the serial number, to obtain encrypted to-be-processed data;

[0008] The encrypted to-be-processed data is sent to the second electronic device.

[0009] In some embodiments, the exclusive-OR operation of the plurality of bytes in each frame of to-be-processed data according to the serial number to obtain the encrypted to-be-processed data comprises:

[0010] Starting from the last byte of each frame of to-be-processed data and the last byte of the serial number, an i-th byte of each frame of to-be-processed data is subjected to an exclusive-OR operation with an i-th byte of the serial number, to obtain an encrypted field of each frame of to-be-processed data;

[0011] Replace the N bytes in each frame of the to-be-processed data with the encryption field to obtain encrypted to-be-processed data, where the N bytes are bytes subjected to the XOR operation.

[0012] In some embodiments, the method further includes:

[0013] When the first electronic device is powered on, the device information of the first electronic device is sent to the second electronic device, and the device information includes the serial number and the device identifier of the first electronic device.

[0014] In some embodiments, after the encrypted to-be-processed data is sent to the second electronic device, the method includes:

[0015] The backhaul data sent by the second electronic device is received.

[0016] The backhaul data is decrypted according to the serial number.

[0017] The decrypted backhaul data is parsed to obtain a processing result.

[0018] A second aspect of the embodiments of the present application provides a data transmission method, which is applied to a second electronic device, and includes:

[0019] When the encrypted to-be-processed data sent by a first electronic device is received, a serial number of the first electronic device is obtained, the serial number is a unique identifier code allocated to the first electronic device when the first electronic device is produced, and the first electronic device is an electronic device associated with the second electronic device and used to generate to-be-processed data.

[0020] For each frame of data in the to-be-processed data, a plurality of bytes in the encrypted to-be-processed data are subjected to an XOR operation based on the serial number to obtain decrypted to-be-processed data.

[0021] In some embodiments, the serial number of the first electronic device is obtained by:

[0022] The encrypted to-be-processed data is parsed to obtain a device identifier of a first electronic device that sends the encrypted to-be-processed data.

[0023] Based on the device identifier, a serial number corresponding to the device identifier is queried.

[0024] In some embodiments, the method further includes:

[0025] The device information sent by the first electronic device is received, and the device information includes the device identifier and the serial number of the first electronic device.

[0026] The device identification and serial number of the first electronic device are correspondingly stored.

[0027] In some embodiments, after performing an XOR operation on multiple bytes in the encrypted data based on the serial number to obtain decrypted data to be processed, the method further includes:

[0028] Based on the decrypted data to be processed, the target task function is executed to obtain the return data corresponding to the data to be processed;

[0029] performing an XOR operation on multiple bytes in the returned data based on the serial number of the first electronic device to obtain encrypted returned data;

[0030] Send the encrypted return data to the first electronic device.

[0031] A third aspect of an embodiment of the present application provides a data transmission device, which is deployed in a first electronic device and includes:

[0032] a first acquiring unit, configured to acquire, when data to be processed needs to be sent to a second electronic device, a serial number of the first electronic device, the serial number being a unique identification code assigned to the first electronic device when it is manufactured, the second electronic device being a device associated with the first electronic device and used for data processing;

[0033] a first encryption unit, configured to perform an XOR operation on a plurality of bytes in each frame of data to be processed according to the sequence number, to obtain encrypted data to be processed;

[0034] The first sending unit is configured to send the encrypted data to be processed to the second electronic device.

[0035] In some embodiments, the first encryption unit is used to start from the last byte of each frame of data to be processed and the last byte of the serial number, and perform an XOR operation on the i-th byte of each frame of data to be processed and the i-th byte of the serial number to obtain an encrypted field of each frame of data to be processed; replace N bytes in each frame of data to be processed with the encrypted field to obtain encrypted data to be processed, and the N bytes are the bytes to be XORed.

[0036] In some embodiments, the first sending unit is further configured to send device information of the first electronic device to the second electronic device when the first electronic device is turned on, where the device information includes a serial number and a device identifier of the first electronic device.

[0037] In some embodiments, the apparatus comprises:

[0038] The first receiving unit is configured to receive backhaul data sent by the second electronic device.

[0039] The first decryption unit is configured to decrypt the backhaul data according to the serial number.

[0040] The first data processing unit is configured to perform parsing processing on the decrypted backhaul data to obtain a processing result.

[0041] A fourth aspect of the embodiment of the present application provides a data transmission device, which is deployed in a second electronic device, and the device comprises:

[0042] The second obtaining unit is configured to obtain a serial number of a first electronic device when receiving encrypted to-be-processed data sent by the first electronic device, the serial number being a unique identification code allocated to the first electronic device when the first electronic device is produced, and the first electronic device being an electronic device associated with the second electronic device and used to generate to-be-processed data.

[0043] The second decryption unit is configured to, for each frame of data in the to-be-processed data, perform an exclusive or operation on a plurality of bytes in the encrypted to-be-processed data based on the serial number to obtain decrypted to-be-processed data.

[0044] In some embodiments, the second obtaining unit is configured to parse the encrypted to-be-processed data to obtain a device identification of the first electronic device that sends the encrypted to-be-processed data, and query a serial number corresponding to the device identification based on the device identification.

[0045] In some embodiments, the device further comprises:

[0046] The second receiving unit is configured to receive device information sent by the first electronic device, the device information comprising a device identification and a serial number of the first electronic device.

[0047] The storage unit is configured to store the device identification and the serial number of the first electronic device correspondingly.

[0048] In some embodiments, the device further comprises:

[0049] The second data processing unit is configured to perform a target task function based on the decrypted to-be-processed data to obtain backhaul data corresponding to the to-be-processed data.

[0050] The second encryption unit is configured to perform an exclusive or operation on a plurality of bytes in the backhaul data based on the serial number of the first electronic device to obtain encrypted backhaul data.

[0051] The second sending unit is configured to send the encrypted backhaul data to the first electronic device.

[0052] A fifth aspect of the embodiments of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the data transmission method as described above when executing the computer program.

[0053] A sixth aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the data transmission method as described above.

[0054] A seventh aspect of the embodiments of the present application provides a computer program product, which, when running on an electronic device, causes the electronic device to execute the data transmission method as described above.

[0055] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0056] In the embodiments of the present application, the serial number of the first electronic device is stored, when it is needed to send the to-be-processed data to the second electronic device, the plurality of bytes in each frame of data of the to-be-processed data are subjected to an XOR operation according to the stored serial number of the first electronic device, to obtain encrypted to-be-processed data, and then the encrypted to-be-processed data is sent to the second electronic device, so that the data to be transmitted is encrypted, the encryption key of each first electronic device is ensured to be unique, the security of data transmission is ensured, and the XOR operation of the bytes in the to-be-processed data by the serial number of the first electronic device is simple in calculation, reduces the complexity of encryption calculation, thereby reducing the energy consumption generated in the encryption process, and is more suitable for low-power devices, and the to-be-processed data is encrypted by using the serial number of the first electronic device, since the serial numbers of different electronic devices are different, that is, the serial numbers are unique, therefore, the encryption mode of the data is also unique, and the security of encryption is further ensured. BRIEF DESCRIPTION OF DRAWINGS

[0057] Figure 1 FIG. 1 shows a schematic diagram of a data transmission system involved in a data transmission method provided by an example embodiment;

[0058] Figure 2 FIG. 2 shows a schematic diagram of the interaction between a first electronic device and a second electronic device provided by an example embodiment;

[0059] Figure 3 FIG. 3 shows a flowchart of a data transmission method provided by an example embodiment;

[0060] Figure 4 FIG. 4 shows a flowchart of a data transmission method provided by an example embodiment;

[0061] Figure 5 A flowchart of a data transmission method provided by an example embodiment is shown;

[0062] Figure 6 A structural diagram of a data transmission device provided by an example embodiment is shown;

[0063] Figure 7 A structural diagram of a data transmission device provided by an example embodiment is shown;

[0064] Figure 8 A structural diagram of an electronic device provided by an example embodiment is shown. DETAILED DESCRIPTION

[0065] In order to make the technical problems to be solved by the present application, technical solutions and beneficial effects clearer, the present application will be further described in detail below with reference to the drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.

[0066] In addition, the terms "first", "second" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features limited by "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.

[0067] In some application scenarios, an electronic device needs to transmit to-be-processed data to other electronic devices or servers, and perform corresponding special functions based on the to-be-processed data through the other electronic devices or servers. In the embodiments of the present application, the electronic device that sends the to-be-processed data is defined as a first electronic device, and the electronic device that receives the to-be-processed data is defined as a second electronic device. Correspondingly, the first electronic device can be a client, a host device, etc.; and the second electronic device can be a server, a slave device, etc.

[0068] When the first electronic device and the second electronic device perform data transmission, there may be a problem that the data is intercepted in the process of data transmission. If encryption means is not used, the data is easily read and tampered after being intercepted, especially in a public network environment, the data security risk is extremely high.

[0069] In some embodiments, in order to improve the security of data transmission, a large-computational-complexity encryption algorithm is used for encryption, for example, an asymmetric encryption algorithm (Rivest-Shamir-Adleman, RSA). However, since such an algorithm has large computational complexity, it has high requirements on the hardware performance of a device, occupies too much processing time of a processor, causes high energy consumption, and is not suitable for low-power-consumption devices with limited resources.

[0070] To sum up, in order to improve the security of data transmission and reduce the complexity of encryption calculation, so that the energy consumption of the encryption process is small and the encryption process is suitable for low-power-consumption devices, the present application provides a data transmission method, an electronic device, and a storage medium. By storing the serial number of the first electronic device, when it is necessary to send the to-be-processed data to the second electronic device, the plurality of bytes in each frame of data of the to-be-processed data are subjected to an exclusive-OR operation according to the stored serial number of the first electronic device, to obtain encrypted to-be-processed data, and then the encrypted to-be-processed data is sent to the second electronic device. In this way, the data to be transmitted is encrypted, the encryption key of each first electronic device is ensured to be unique, the security of data transmission is ensured, and the complexity of encryption calculation is reduced by performing the exclusive-OR operation on the bytes in the to-be-processed data by using the serial number of the first electronic device, thereby reducing the energy consumption generated in the encryption process, and the method is more suitable for low-power-consumption devices. Moreover, the to-be-processed data is encrypted by using the serial number of the first electronic device, since the serial numbers of different electronic devices are different, that is, the serial numbers are unique, the encryption method for the data is also unique, and the security of encryption is further ensured.

[0071] The present application will be described below in conjunction with specific embodiments. First, the application scenario of the present application is described. Referring to Figure 1 which shows a schematic diagram of a data transmission system designed by the data transmission method provided in an example embodiment. Parameters Figure 1 The data transmission system includes a first electronic device 10 and a second electronic device 20. A communication connection is established between the first electronic device 10 and the second electronic device 20. It should be noted that the communication connection between the first electronic device 10 and the second electronic device 20 can be in the form of a serial port wire or a wireless network, and in the embodiments of the present application, the communication connection mode between the first electronic device 10 and the second electronic device 20 is not limited.

[0072] Before data transmission, the first electronic device 10 establishes an association relationship with the second electronic device 20, so that the first electronic device 10 and the second electronic device 20 can perform encrypted data transmission. In the embodiments of the present application, the process of establishing an association relationship between the first electronic device 10 and the second electronic device 20 is not specifically limited. For example, the first electronic device 10 can install a target application, and the second electronic device 20 can be a server device of the target application. Accordingly, the first electronic device 10 can establish an association relationship with the second electronic device 20 by logging in an account of the target application.

[0073] The second electronic device 20 can establish an association relationship with at least one first electronic device 10. Therefore, after the first electronic device 10 establishes an association relationship with the second electronic device 20, the first electronic device 10 sends device information of the first electronic device 10 to the second electronic device 20, where the device information includes a serial number and a device identifier of the first electronic device 10. Accordingly, the second electronic device 20 receives the device information sent by the first electronic device 10, and stores the serial number and the device identifier in the device information, so that in subsequent decryption of encrypted to-be-processed data sent by the first electronic device 10, the serial number of the first electronic device 10 is determined according to the device identifier carried by the data, and the encrypted to-be-processed data is decrypted according to the serial number.

[0074] It should be noted that the device information can also include information such as the hardware version and the software version of the first electronic device 10. Since the hardware version information and the software version information of the first electronic device 10 and the like can be changed due to updates and the like during the running of the first electronic device 10, the first electronic device 10 needs to send updated device information to the second electronic device 20.

[0075] Accordingly, in some embodiments, when the first electronic device 10 detects software or hardware updates, the first electronic device 10 sends updated device information to the second electronic device 20. In other embodiments, the first electronic device 10 sends current device information to the second electronic device 20 every preset time interval. In other embodiments, the first electronic device 10 sends current device information to the second electronic device 20 every time it is powered on. In the embodiments of the present application, the timing of the first electronic device 10 sending device information to the second electronic device 20 is not specifically limited.

[0076] In the embodiments of the present application, the electronic device that sends to-be-processed data is defined as the first electronic device 10, and the electronic device that receives to-be-processed data is defined as the second electronic device 20. Accordingly, the first electronic device 10 can be a client, a host device, or the like; and the second electronic device 20 can be a server, a slave device, or the like. See Figure 2Fig. 1 shows a schematic diagram of the interaction between the first electronic device 10 and the second electronic device 20 according to an example embodiment. Referring to Fig. 1, Figure 2 The first electronic device 10 and the second electronic device 20 comprise a serial number storage module, a data encryption module, a data decryption module and a data processing module.

[0077] The first electronic device 10 stores the serial number assigned at the time of production in the serial number storage module, and reports the serial number and other device information to the second electronic device 20 when the first electronic device 10 is powered on. Correspondingly, the second electronic device 20 stores the device information reported by the first electronic device 10 in the serial number storage module when the device information is received. When the first electronic device 10 generates data to be processed, the first electronic device 10 encrypts the data to be processed through the data encryption module, and sends the data to be processed encrypted by the serial number to the second electronic device 20. The second electronic device 20 receives the encrypted data to be processed, decrypts the data to be processed through the data decryption module, and then analyzes and processes the decrypted data to be processed through the data processing module.

[0078] In some embodiments, the second electronic device 20 needs to send the processing result corresponding to the data to be processed to the first electronic device 10 as return data. Correspondingly, the second electronic device 20 encrypts the return data through the data encryption module, and then sends the encrypted data to the first electronic device 10. The first electronic device 10 decrypts the return data through the data decryption module, and then analyzes and processes the decrypted return data through the data processing module, thereby realizing the data interaction between the first electronic device 10 and the second electronic device 20.

[0079] It should be noted that the second electronic device 20 can use the serial number of the first electronic device 10 to decrypt the return data when encrypting the return data. In other embodiments, the second electronic device 20 can send the serial number of the second electronic device 20 to the first electronic device 10 in advance. Correspondingly, the second electronic device 20 can use the serial number of the second electronic device 20 to decrypt the return data, and the principle of this process is the same as that of using the serial number of the first electronic device 10 to encrypt, which will not be described here.

[0080] The data transmission method will be described below in conjunction with specific embodiments. Referring to Fig. 2, Figure 3 Fig. 2 shows a schematic diagram of a flowchart of a data transmission method according to an example embodiment. As an example and not limitation, the method is applied to a first electronic device.

[0081] S301, when it is necessary to send data to be processed to a second electronic device, the first electronic device obtains the serial number of the first electronic device, which is a unique identification code assigned to the first electronic device during production. The second electronic device is a device associated with the first electronic device and used for data processing.

[0082] The serial number is a unique identification code assigned by First Electronics and the device during production. The serial number is generally composed of multiple bytes. The length of the serial number can be any number of bytes. For example, the length of the serial number can be 17 bytes, 18 bytes, or 19 bytes. In the embodiments of the present application, the length of the serial number is not specifically limited.

[0083] The first electronic device is assigned a serial number during production, and the first electronic device can store this serial number in a serial number storage module. The serial number storage module can be a memory device within the first electronic device, such as a flash memory. In this step, when the first electronic device needs to send data to be processed to the second electronic device, the first electronic device obtains the serial number of the first electronic device from the serial number storage module.

[0084] One thing that needs to be explained is that in order to ensure that the second electronic device can correctly decrypt the encrypted data to be processed sent by the first electronic device, the first electronic device sends the device information of the first electronic device to the second electronic device when the first electronic device is turned on. The device information includes the serial number and device identification of the first electronic device.

[0085] The first electronic device may send the device information of the first electronic device to the second electronic device in a preset data format. The preset data format may be set as needed. In the embodiments of the present application, the preset data format is not specifically limited. For example, the preset data format may be JSON format or other custom format.

[0086] S302 : For each frame of data in the data to be processed, the first electronic device performs an XOR operation on multiple bytes in each frame of data to be processed according to the serial number to obtain encrypted data to be processed.

[0087] For each frame of data in the data to be processed, the first electronic device can perform an XOR operation on a plurality of bytes at a target position in each frame of data to be processed according to the serial number, thereby achieving encryption of the data to be processed. The plurality of bytes at the target position in each frame of data to be processed can be set as needed, and the target position in each frame of data to be processed can be the same or different. In the embodiments of the present application, the target position is not specifically limited. For example, the target position can be a specified position in the data to be processed set by a user. Alternatively, the target position can be the position of the last plurality of bytes of each frame of data to be processed.

[0088] Correspondingly, the step can be that the first electronic device starts from the last byte of each frame of data to be processed and the last byte of the serial number, performs an XOR operation on the i th byte of each frame of data to be processed and the i th byte of the serial number, and obtains an encryption field of each frame of data to be processed; replaces N bytes in each frame of data to be processed with the encryption field, and obtains encrypted data to be processed, the N bytes being the bytes subjected to the XOR operation.

[0089] In the implementation mode, each frame of data to be processed is encrypted in a right-justified mode. For example, the length of the serial number is 17 bytes, and correspondingly, the last 17 bytes of each frame of data to be processed are subjected to an XOR operation with the bytes at the corresponding positions in the serial number, and then the data of the plurality of bytes subjected to the XOR operation is replaced with the plurality of bytes in the original data to complete the encryption. It should be noted that when the length of the data to be processed is less than the length of the serial number, the bytes in the data to be processed are subjected to an XOR operation with the low-order bytes in the serial number in sequence.

[0090] In the implementation mode, a plurality of bytes in the data to be processed are subjected to an XOR operation with the serial number, and then the bytes subjected to the XOR operation are replaced with the plurality of bytes in the original data, thereby achieving encryption of the data to be processed. In this way, the data to be processed is subjected to an XOR operation with the serial number, which does not depend on a complex encryption protocol, is suitable for various devices and server architectures, is easy to integrate and promote, can be easily implemented on embedded devices or high-performance servers, has wide applicability, high compatibility and universality, and the XOR operation is a basic logical operator of a computer, has low computational complexity and low energy consumption, is suitable for low-power devices, can prolong battery life, and reduce operating costs.

[0091] S303, the first electronic device sends the encrypted data to be processed to the second electronic device.

[0092] The first electronic device can send the encrypted to-be-processed data to the second electronic device in a wired form through a serial port, or send the encrypted to-be-processed data to the second electronic device in a wireless form through a wireless network, which is not limited in the embodiment of the present application.

[0093] It should be noted that after the second electronic device receives the encrypted to-be-processed data sent by the first electronic device, the second electronic device decrypts the to-be-processed data based on the stored serial number of the first electronic device, analyzes and processes the decrypted to-be-processed data, obtains a processing result, and sends the processing result as feedback data to the first electronic device. In order to ensure the security of data transmission, the second electronic device also encrypts the feedback data. Correspondingly, the first electronic device decrypts the received feedback data to obtain the processing result corresponding to the to-be-processed data. The process includes: the first electronic device receives the feedback data sent by the second electronic device; the feedback data is decrypted according to the serial number, and the decrypted feedback data is analyzed and processed to obtain a processing result.

[0094] It should be noted that when the second electronic device encrypts the feedback data, the serial number of the first electronic device can be used to decrypt the feedback data. In another embodiment, the second electronic device can send the serial number of the second electronic device to the first electronic device in advance. Correspondingly, the second electronic device can use the serial number of the second electronic device to decrypt the feedback data. The principle of this process is the same as that of using the serial number of the first electronic device to encrypt, which will not be described here.

[0095] In the embodiment of the present application, by storing the serial number of the first electronic device, when it is necessary to send to-be-processed data to the second electronic device, the serial number of the first electronic device is used to perform an exclusive OR operation on a plurality of bytes in each frame of to-be-processed data to obtain encrypted to-be-processed data, and then the encrypted to-be-processed data is sent to the second electronic device. In this way, the data to be transmitted is encrypted, ensuring that the encryption key of each first electronic device is unique and ensuring the security of data transmission. Moreover, the exclusive OR operation on the bytes in the to-be-processed data by using the serial number of the first electronic device is simple in calculation, reduces the complexity of encryption calculation, thereby reducing the energy consumption generated in the encryption process, and is more suitable for low-power devices. Moreover, the serial number of the first electronic device is used to encrypt the to-be-processed data. Since the serial numbers of different electronic devices are different, that is, the serial numbers are unique, the encryption method of the data is also unique, further ensuring the security of encryption.

[0096] After the first electronic device sends the encrypted to-be-processed data to the second electronic device, the second electronic device decrypts the to-be-processed data based on the stored serial number of the first electronic device. Referring to Figure 4FIG. 1 shows a schematic diagram of a data transmission method flowchart provided by an exemplary embodiment. By way of example and not limitation, the method is applied to a second electronic device.

[0097] S401, when receiving the encrypted to-be-processed data sent by the first electronic device, the second electronic device acquires the serial number of the first electronic device, which is a unique identification code assigned to the first electronic device at production, and the first electronic device is an electronic device associated with the second electronic device and used to generate the to-be-processed data.

[0098] The to-be-processed data carries device information of the first electronic device, such as device identification, hardware version, software version, etc. of the first electronic device. Accordingly, after receiving the to-be-processed data, the second electronic device queries the corresponding serial number according to the device information such as the device identification carried by the to-be-processed data. The process can be: the second electronic device parses the encrypted to-be-processed data to obtain the device identification of the first electronic device sending the encrypted to-be-processed data; based on the device identification, the serial number corresponding to the device identification is queried.

[0099] The second electronic device stores the correspondence between the device identification and the serial number. Before this step, the second electronic device receives the device information sent by the first electronic device, which includes the device identification and the serial number of the first electronic device; and the device identification and the serial number of the first electronic device are stored correspondingly.

[0100] The second electronic device can be connected with multiple first electronic devices, and correspondingly, the second electronic device can store multiple sets of correspondence between the device identification and the serial number, and in the embodiments of the present application, the storage mode of the device identification and the serial number is not specifically limited. For example, the second electronic device correspondingly stores the device identification and the serial number in the form of a relationship table. The second electronic device can store the correspondence between the hardware version, the software version, etc. of the first electronic device and the serial number, which is not specifically limited in the embodiments of the present application.

[0101] S402, for each frame of data in the to-be-processed data, the second electronic device performs an exclusive or operation on multiple bytes in the encrypted to-be-processed data based on the serial number to obtain decrypted to-be-processed data.

[0102] The second electronic device performs an exclusive OR operation on a plurality of bytes in the encrypted to-be-processed data based on the serial number, replaces the plurality of bytes after the exclusive OR operation with corresponding bytes in the original data, and obtains decrypted to-be-processed data. The selection manner of the plurality of bytes is the same as the selection manner of the plurality of bytes in step S302, and will not be described again here. For example, still taking the 17-byte serial number as an example, the second electronic device extracts the last 17 bytes of each frame of data in the encrypted to-be-processed data, performs an exclusive OR operation on the last 17 bytes of the serial number of the first electronic device, and replaces the last 17 bytes of the original data with the data after the exclusive OR operation, thereby recovering the original data.

[0103] After the second electronic device decrypts the to-be-processed data, the second electronic device performs a corresponding target task function based on the to-be-processed data, obtains corresponding return data, encrypts the return data, and returns the encrypted return data to the first electronic device. This step can be: the second electronic device performs a target task function based on the decrypted to-be-processed data, obtains return data corresponding to the to-be-processed data, performs an exclusive OR operation on a plurality of bytes in the return data based on the serial number of the first electronic device, obtains encrypted return data, and sends the encrypted return data to the first electronic device.

[0104] In the embodiments of the present application, the serial number of the first electronic device is stored. When it is necessary to send to-be-processed data to the second electronic device, an exclusive OR operation is performed on a plurality of bytes in each frame of data of the to-be-processed data based on the stored serial number of the first electronic device, encrypted to-be-processed data is obtained, and the encrypted to-be-processed data is sent to the second electronic device. In this way, the data to be transmitted is encrypted, the encryption key of each first electronic device is unique, the security of data transmission is ensured, and the exclusive OR operation on the bytes in the to-be-processed data based on the serial number of the first electronic device is simple to calculate, reduces the complexity of encryption calculation, thereby reducing the energy consumption generated in the encryption process, and is more suitable for low-power devices. In addition, the serial number of the first electronic device is used to encrypt the to-be-processed data. Since the serial numbers of different electronic devices are different, that is, the serial numbers are unique, the encryption manner of the data is also unique, and the security of the encryption is further ensured.

[0105] The data transmission method will be described below in combination with the flow of interaction between the first electronic device and the second electronic device. Referring to Figure 5 which shows a flow diagram of a data transmission method provided by an example embodiment.

[0106] S501, when it is necessary to send to-be-processed data to the second electronic device, the first electronic device obtains a serial number of the first electronic device.

[0107] This step has the same principle as step S301 and will not be described again here.

[0108] S502, for each frame of data in the to-be-processed data, the first electronic device performs XOR operation on a plurality of bytes in each frame of to-be-processed data according to the serial number, to obtain encrypted to-be-processed data.

[0109] The principle of this step is the same as that of step S302, and will not be repeated here.

[0110] S503, the first electronic device sends the encrypted to-be-processed data to the second electronic device.

[0111] The principle of this step is the same as that of step S303, and will not be repeated here.

[0112] S504, when receiving the encrypted to-be-processed data sent by the first electronic device, the second electronic device obtains the serial number of the first electronic device.

[0113] The principle of this step is the same as that of step S401, and will not be repeated here.

[0114] S505, for each frame of data in the to-be-processed data, the second electronic device performs XOR operation on a plurality of bytes in the encrypted data based on the serial number, to obtain decrypted to-be-processed data.

[0115] The principle of this step is the same as that of step S402, and will not be repeated here.

[0116] S506, the second electronic device executes a target task function based on the decrypted to-be-processed data, to obtain return data corresponding to the to-be-processed data.

[0117] The data processing function is deployed in the second electronic device, and in this step, the second electronic device executes the corresponding target task function to obtain the processing result of the to-be-processed data, and generates return data based on the processing result.

[0118] S507, the second electronic device performs XOR operation on a plurality of bytes in the return data based on the serial number of the first electronic device, to obtain encrypted return data.

[0119] The principle of this step is the same as that of step S302, and will not be repeated here.

[0120] S508, the second electronic device sends the encrypted return data to the first electronic device.

[0121] The principle of this step is the same as that of step S303, and will not be repeated here.

[0122] S509, the first electronic device receives the return data sent by the second electronic device.

[0123] S510, the first electronic device decrypts the backhaul data according to the serial number.

[0124] The principle of this step is the same as that of step S402, and will not be repeated here.

[0125] S511, the first electronic device parses the decrypted backhaul data to obtain a processing result. In the embodiments of the present application, by storing the serial number of the first electronic device, when it is necessary to send the to-be-processed data to the second electronic device, the serial number of the first electronic device is stored, and the plurality of bytes in each frame of data of the to-be-processed data are subjected to an XOR operation according to the stored serial number of the first electronic device, to obtain encrypted to-be-processed data, and then the encrypted to-be-processed data is sent to the second electronic device. In this way, the data to be transmitted is encrypted, ensuring that the encryption key of each first electronic device is unique, ensuring the security of data transmission, and by using the serial number of the first electronic device to XOR the bytes in the to-be-processed data, the calculation is simple, reducing the complexity of encryption calculation, thereby reducing the energy consumption generated in the encryption process, and being more suitable for low-power devices. Moreover, using the serial number of the first electronic device to encrypt the to-be-processed data, since the serial numbers of different electronic devices are different, i.e., the serial numbers are unique, the encryption method of the data is also unique, further ensuring the security of encryption.

[0126] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0127] Referring to Figure 6 , which shows a structure schematic diagram of a data transmission device provided by the present application, each unit included is used to execute each step in the above embodiments, referring to Figure 6 , the data transmission device comprises:

[0128] The first acquisition unit 601 is configured to acquire the serial number of the first electronic device when it is necessary to send to-be-processed data to the second electronic device, the serial number being a unique identification code allocated to the first electronic device at the time of production, and the second electronic device being a device associated with the first electronic device and used for data processing;

[0129] The first encryption unit 602 is configured to, for each frame of data in the to-be-processed data, perform an XOR operation on a plurality of bytes in each frame of to-be-processed data according to the serial number, to obtain encrypted to-be-processed data.

[0130] The first sending unit 603 is configured to send the encrypted to-be-processed data to the second electronic device.

[0131] In some embodiments, the first encryption unit 602 is configured to perform an exclusive-OR operation between the i th byte of each frame of the to-be-processed data and the i th byte of the sequence number, to obtain an encrypted field of each frame of the to-be-processed data, starting from the last byte of each frame of the to-be-processed data and the last byte of the sequence number; and replace N bytes in each frame of the to-be-processed data with the encrypted field, to obtain encrypted to-be-processed data, the N bytes being the bytes subjected to the exclusive-OR operation.

[0132] In some embodiments, the first sending unit 603 is further configured to send, to the second electronic device, device information of the first electronic device when the first electronic device is powered on, the device information including the sequence number and a device identifier of the first electronic device.

[0133] In some embodiments, the apparatus includes:

[0134] The first receiving unit is configured to receive the backhaul data sent by the second electronic device.

[0135] The first decryption unit is configured to decrypt the backhaul data according to the sequence number.

[0136] The first data processing unit is configured to perform parsing processing on the decrypted backhaul data, to obtain a processing result.

[0137] In the embodiments of the present application, the sequence number of the first electronic device is stored, when to-be-processed data needs to be sent to the second electronic device, an exclusive-OR operation is performed on a plurality of bytes in each frame of the to-be-processed data according to the stored sequence number of the first electronic device, to obtain encrypted to-be-processed data, and then the encrypted to-be-processed data is sent to the second electronic device, so that the data to be transmitted is encrypted, ensuring that the encryption key of each first electronic device is unique, and ensuring the security of data transmission. Moreover, the exclusive-OR operation is performed on the bytes in the to-be-processed data by using the sequence number of the first electronic device, the calculation is simple, the complexity of encryption calculation is reduced, thereby reducing the energy consumption generated in the encryption process, and the method is more suitable for low-power devices. Furthermore, the to-be-processed data is encrypted by using the sequence number of the first electronic device, since the sequence numbers of different electronic devices are different, i.e., the sequence numbers are unique, the encryption method of the data is also unique, further ensuring the security of encryption.

[0138] Referring to Figure 7 which shows a structure diagram of a data transmission apparatus provided by the present application, each unit included in the data transmission apparatus is configured to perform each step in the above embodiments, referring to Figure 7 The data transmission apparatus includes:

[0139] The second obtaining unit 701 is configured to obtain a serial number of a first electronic device when receiving encrypted to-be-processed data sent by the first electronic device, the serial number being a unique identification code allocated to the first electronic device in production, and the first electronic device being an electronic device associated with the second electronic device and used to generate the to-be-processed data.

[0140] The second decryption unit 702 is configured to, for each frame of data in the to-be-processed data, perform an exclusive or operation on a plurality of bytes in the encrypted to-be-processed data based on the serial number, to obtain decrypted to-be-processed data.

[0141] In some embodiments, the second obtaining unit 701 is configured to parse the encrypted to-be-processed data to obtain a device identification of the first electronic device sending the encrypted to-be-processed data, and query a serial number corresponding to the device identification based on the device identification.

[0142] In some embodiments, the apparatus further includes:

[0143] The second receiving unit is configured to receive device information sent by the first electronic device, the device information including a device identification and a serial number of the first electronic device.

[0144] The storage unit is configured to store the device identification and the serial number of the first electronic device correspondingly.

[0145] In some embodiments, the apparatus further includes:

[0146] The second data processing unit is configured to perform a target task function based on the decrypted to-be-processed data, to obtain return data corresponding to the to-be-processed data.

[0147] The second encryption unit is configured to perform an exclusive or operation on a plurality of bytes in the return data based on the serial number of the first electronic device, to obtain encrypted return data.

[0148] The second sending unit is configured to send the encrypted return data to the first electronic device.

[0149] In an embodiment of the present application, by storing the serial number of the first electronic device, when it is necessary to send the data to be processed to the second electronic device, an XOR operation is performed on multiple bytes in each frame of the data to be processed according to the stored serial number of the first electronic device to obtain the encrypted data to be processed, and then the encrypted data to be processed is sent to the second electronic device. In this way, the data to be transmitted is encrypted, which ensures that the encryption key of each first electronic device is unique and the security of data transmission is guaranteed. In addition, by performing an XOR operation on the bytes in the data to be processed using the serial number of the first electronic device, the calculation is simple, which reduces the complexity of the encryption calculation, thereby reducing the energy consumption generated by the encryption process, and is more suitable for low-power devices. In addition, the serial number of the first electronic device is used to encrypt the data to be processed. Since the serial numbers of different electronic devices are different, that is, the serial numbers are unique, the encryption method of the data is also unique, which further ensures the security of the encryption.

[0150] Figure 8 Schematic diagram of an electronic device provided by an exemplary embodiment of the present application. The electronic device may be a first electronic device or a second electronic device. Figure 8 As shown, the electronic device 8 of this embodiment includes: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80, such as a data transmission program. When the processor 80 executes the computer program 82, the steps in the above-mentioned various data transmission method embodiments are implemented, such as Figure 5 Alternatively, when the processor 80 executes the computer program 82, the functions of each unit in the above-mentioned device embodiments are realized, for example Figure 6 The functions of the units 601 to 803 shown, or the implementation of Figure 7 Functions of units 701 to 702 are shown.

[0151] Exemplarily, the computer program 82 may be divided into one or more units, which are stored in the memory 81 and executed by the processor 80 to complete the present application. The one or more units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 82 in the electronic device 8. For example, the computer program 82 may be divided into a first acquisition unit, a first encryption unit, and a first sending unit, and the specific functions of each module are as follows:

[0152] A first acquiring unit 601 is configured to acquire a serial number of the first electronic device when sending data to be processed to the second electronic device. The serial number is a unique identification code assigned to the first electronic device during production. The second electronic device is a device associated with the first electronic device and used for data processing.

[0153] The first encryption unit 602 is configured to, for each frame of data in the to-be-processed data, perform an exclusive OR operation on a plurality of bytes in each frame of to-be-processed data according to the serial number, to obtain encrypted to-be-processed data.

[0154] The first sending unit 603 is configured to send the encrypted to-be-processed data to the second electronic device. The computer program 82 can be divided into a second acquisition unit and a second decryption unit, and specific functions of each module are as follows.

[0155] The second acquisition unit 701 is configured to, when receiving the encrypted to-be-processed data sent by the first electronic device, acquire a serial number of the first electronic device, the serial number being a unique identification code allocated to the first electronic device at production, and the first electronic device being an electronic device associated with the second electronic device and used to generate to-be-processed data.

[0156] The second decryption unit 702 is configured to, for each frame of data in the to-be-processed data, perform an exclusive OR operation on a plurality of bytes in the encrypted to-be-processed data based on the serial number, to obtain decrypted to-be-processed data.

[0157] The electronic device 8 can be any electronic device with a control function. The electronic device 8 can include, but is not limited to, a processor 80 and a memory 81. Those skilled in the art can understand that the processor 80 can be configured to perform the functions of the first acquisition unit 601, the first encryption unit 602, the first sending unit 603, the second acquisition unit 701, and the second decryption unit 702. Figure 8 The electronic device 8 is only an example and does not constitute a limitation on the electronic device 8, and can include more or fewer components than shown, or combine certain components, or different components, for example, the electronic device 8 can also include an input / output device, a network access device, a bus, etc.

[0158] The processor 80 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0159] The memory 81 can be an internal storage unit of the electronic device 8, for example, a hard disk or a memory of the electronic device 8. The memory 81 can also be an external storage device of the electronic device 8, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 8. Further, the memory 81 can also include both the internal storage unit and the external storage device of the electronic device 8. The memory 81 is used to store the computer program and other programs and data required by the terminal device. The memory 81 can also be used to temporarily store data that has been output or will be output.

[0160] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, 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. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0161] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can refer to the relevant description of other embodiments.

[0162] Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the application.

[0163] In the embodiments of the present application, it should be understood that the disclosed apparatus / terminal device and method can be implemented in other manners. For example, the embodiments of the apparatus / terminal device described above are merely schematic, and the division of the modules or units is merely logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0164] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0165] In addition, each functional unit in the various embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0166] The integrated module / unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. The computer program can implement the steps of each method embodiment when executed by a processor. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer readable medium can include or exclude contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0167] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps in the above-mentioned various method embodiments.

[0168] The embodiment of the present application further provides a computer program product. When the computer program product is run on a mobile terminal, the mobile terminal is enabled to implement the steps in the above-mentioned various method embodiments.

[0169] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalent features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A data transmission method, characterized in that: The method is applied to a first electronic device, and includes: When it is necessary to send data to be processed to a second electronic device, obtaining the serial number of the first electronic device, where the serial number is a unique identification code assigned to the first electronic device when it is manufactured, and the second electronic device is a device associated with the first electronic device and used for data processing; For each frame of data in the data to be processed, performing an XOR operation on multiple bytes in each frame of data to be processed according to the sequence number to obtain encrypted data to be processed; The encrypted data to be processed is sent to the second electronic device.

2. The method according to claim 1, wherein The method of performing an XOR operation on multiple bytes in each frame of the data to be processed according to the sequence number to obtain encrypted data to be processed includes: Starting from the last byte of each frame of data to be processed and the last byte of the sequence number, performing an XOR operation on the i-th byte of each frame of data to be processed and the i-th byte of the sequence number to obtain an encrypted field of each frame of data to be processed; The N bytes in each frame of data to be processed are replaced with the encryption field to obtain encrypted data to be processed, wherein the N bytes are bytes to be subjected to XOR processing.

3. The method according to any one of claims 1 or 2, wherein: The method further comprises: When the first electronic device is turned on, device information of the first electronic device is sent to the second electronic device, where the device information includes the serial number and device identification of the first electronic device.

4. The method according to any one of claims 1 or 2, wherein: After sending the encrypted data to be processed to the second electronic device, the method includes: receiving the returned data sent by the second electronic device; Decrypting the returned data according to the serial number; The decrypted returned data is parsed and processed to obtain the processing result.

5. A data transmission method, characterized in that: The method is applied to a second electronic device, and includes: Upon receiving the encrypted data to be processed sent by the first electronic device, obtaining the serial number of the first electronic device, where the serial number is a unique identification code assigned to the first electronic device when it was manufactured, and the first electronic device is an electronic device associated with the second electronic device and used to generate the data to be processed; For each frame of data in the data to be processed, an XOR operation is performed on multiple bytes in the encrypted data to be processed based on the sequence number to obtain decrypted data to be processed.

6. The method according to claim 5, wherein The obtaining the serial number of the first electronic device includes: Parsing the encrypted data to be processed to obtain a device identification of a first electronic device that sends the encrypted data to be processed; Based on the device identification, a serial number corresponding to the device identification is queried.

7. The method according to claim 6, wherein The method further comprises: receiving device information sent by the first electronic device, the device information including a device identification and a serial number of the first electronic device; The device identification and serial number of the first electronic device are correspondingly stored.

8. The method according to any one of claims 5 to 7, wherein: After performing an XOR operation on multiple bytes in the encrypted data based on the serial number to obtain decrypted data to be processed, the method further includes: Based on the decrypted data to be processed, the target task function is executed to obtain the return data corresponding to the data to be processed; performing an XOR operation on multiple bytes in the returned data based on the serial number of the first electronic device to obtain encrypted returned data; Send the encrypted return data to the first electronic device.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data transmission method according to any one of claims 1 to 8 when executing the computer program.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data transmission method according to any one of claims 1 to 8 is implemented.