Data transmission method, data transmission device, data transmission equipment and vehicle

By flexibly changing the encryption key length according to the target data length, the problem of excessively long ciphertext data after CANFD bus data encryption is solved, achieving high efficiency and reliability in data transmission and avoiding transmission delay and packet loss.

CN116647331BActive Publication Date: 2026-02-10BYD CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210506355.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-02-15
Filing Date
2022-05-10
Publication Date
2026-02-10
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

In existing CANFD bus data encryption methods, the fixed-length key results in excessively long encrypted data that cannot be sent within a single data frame, leading to increased transmission load and potential data reception delays and packet loss.

Method used

The length of the encryption key can be flexibly adjusted according to the length of the target data to make the length of the encryption key equal to the length of the target data, so that the generated target ciphertext data will not be too long. Encryption and decryption are performed by XOR operation to ensure that no load is added during data transmission.

Benefits of technology

It effectively reduces the data transmission load, avoids data reception delay and packet loss problems, and improves the reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116647331B_ABST
    Figure CN116647331B_ABST
Patent Text Reader

Abstract

The application provides a data transmission method for realizing encryption and sending of data, comprising the following steps: determining the length of target data; processing a first key according to the length of the target data to obtain an encryption key, the length of the encryption key being greater than or equal to the length of the target data and less than or equal to the length of the first key; encrypting the target data by using the encryption key to obtain target ciphertext data, the length of the target ciphertext data being equal to the length of the encryption key; and sending the target ciphertext data to a receiving end. The application also provides a transmission method for realizing receiving and decryption of data, and a data transmission device, a transmission equipment and a vehicle. According to the data transmission method, the length of the encryption key is changed according to the length of the target data, so that the problems of data receiving delay, packet loss and the like can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information security technology, and in particular to a data transmission method, data transmission device, data transmission equipment, and vehicle. Background Technology

[0002] With the connectivity of automobiles, the CANFD (Controller Area Network with Flexible Data Rate) bus data may be obtained and leaked by remote servers, posing risks such as tampering, replay attacks, and hacker attacks. To ensure the CANFD bus data is not leaked, encryption is typically used. However, existing encryption methods generally use fixed-length keys (e.g., 128, 256, 512, 1024, 2048 bits) to encrypt the CANFD bus data. The length of the ciphertext data obtained after encryption with a fixed-length key is fixed. If the ciphertext data is too long, a single encrypted frame cannot be transmitted in one frame and must be sent in packets. This places a significant transmission load on the frequently used CANFD bus, easily leading to problems such as CANFD bus data reception delays and packet loss. Summary of the Invention

[0003] To address the aforementioned technical problems, this application provides a data transmission method, a data transmission device, a data transmission equipment, and a vehicle. The length of the encryption key can be varied according to the length of the target data, ensuring that the target ciphertext data obtained by encrypting with the encryption key is not too long. This reduces the transmission load when transmitting the target ciphertext data and avoids problems such as data reception delay and data packet loss.

[0004] This application provides a first data transmission method applied to a first data transmission device connected to a receiving end. The first data transmission device stores target data to be transmitted. The first data transmission method includes: determining the length of the target data; processing the first key according to the length of the target data to obtain an encryption key, wherein the length of the encryption key is greater than or equal to the length of the target data and less than or equal to the length of the first key; encrypting the target data using the encryption key to obtain target ciphertext data, wherein the length of the target ciphertext data is equal to the length of the encryption key; and sending the target ciphertext data to the receiving end.

[0005] A second aspect of this application provides a first data transmission apparatus connected to a receiving end. The first data transmission apparatus stores target data to be transmitted and includes a processing module. The processing module is configured to determine the length of the target data, process a first key according to the length of the target data to obtain an encryption key, wherein the length of the encryption key is greater than or equal to the length of the target data and less than or equal to the length of the first key, encrypt the target data using the encryption key to obtain target ciphertext data, wherein the length of the target ciphertext data is equal to the length of the encryption key, and control the transmission of the target ciphertext data to the receiving end.

[0006] The first data transmission method and first data transmission device provided in this application obtain the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is less than or equal to the length of the first key. Therefore, the length of the encryption key can be flexibly changed according to the length of the target data, so that the target ciphertext data obtained by encrypting with the encryption key is not too long, which can reduce the transmission load during transmission and avoid problems such as data reception delay and data packet loss.

[0007] A third aspect of this application provides a second data transmission method applied to a second data transmission device, the second data transmission device being connected to a transmitting end, the transmitting end storing target ciphertext data obtained by encrypting target data to be transmitted, the second data transmission method comprising the following steps: upon receiving the target ciphertext data, determining the length of the target ciphertext data; processing a first key according to the length of the target ciphertext data to obtain a decryption key, the length of the decryption key being equal to the length of the target ciphertext data and less than or equal to the length of the first key; and using the decryption key to decrypt the target ciphertext data to obtain the target data.

[0008] A fourth aspect of this application provides a second data transmission apparatus connected to a transmitting end. The transmitting end stores target ciphertext data obtained by encrypting target data to be transmitted. The second data transmission apparatus includes a processing module. The processing module is configured to, upon receiving the target ciphertext data, determine the length of the target ciphertext data, process a first key according to the length of the target ciphertext data to obtain a decryption key, wherein the length of the decryption key is equal to the length of the target ciphertext data and less than or equal to the length of the first key, and use the decryption key to decrypt the target ciphertext data to obtain the target data.

[0009] The second data transmission method and the second data transmission device provided in this application can process the first key according to the length of the target ciphertext data to obtain a decryption key with a length less than or equal to the first key, which can be used to decrypt the target ciphertext data. This realizes the flexible change of the length of the decryption key according to the length of the target ciphertext data. Thus, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device, reducing the transmission load of the transmission bus and avoiding data reception delay, packet loss, etc.

[0010] The fifth aspect of this application provides a vehicle, the vehicle including the first data transmission device as described above and / or the second data transmission device as described above.

[0011] The first data transmission device for the vehicle provided in this application embodiment obtains the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is greater than or equal to the length of the target data. Therefore, the length of the encryption key can be flexibly changed according to the length of the target data, so that the target ciphertext data obtained by encrypting with the encryption key is not too long, which can reduce the transmission load during transmission and avoid problems such as data reception delay and data packet loss.

[0012] The second data transmission device for the vehicle provided in this application embodiment can process the first key according to the length of the target ciphertext data to obtain a decryption key with a length equal to that of the target ciphertext data, which is used to decrypt the target ciphertext data. This realizes the flexible change of the length of the decryption key according to the length of the target ciphertext data. Thus, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device, reducing the transmission load of the transmission bus and avoiding data reception delays, packet loss, etc.

[0013] A sixth aspect of this application provides a data transmission device, the data transmission device including a memory and a processor, the memory storing a computer program, the computer program being invoked and executed by the processor to implement the first data transmission method as described above and / or the second data transmission method as described above.

[0014] The data transmission device provided in this application embodiment can obtain the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is less than or equal to the length of the first key. This allows for flexible adjustment of the encryption key length based on the target data length, ensuring that the target ciphertext data encrypted using the encryption key is not too long. This reduces the transmission load during transmission and avoids problems such as data reception delay and packet loss. And / or, it can process the first key according to the length of the target ciphertext data to obtain a decryption key with a length less than or equal to the first key, which is then used to decrypt the target ciphertext data. This achieves flexible adjustment of the decryption key length based on the length of the target ciphertext data, allowing for the transmission of shorter target ciphertext data to the second data transmission device during data transmission, reducing the transmission load on the transmission bus and avoiding data reception delay and packet loss.

[0015] A seventh aspect of this application provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the first data transmission method and / or the second data transmission method as described above. Attached Figure Description

[0016] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 A flowchart of a first data transmission method provided in an embodiment of this application.

[0018] Figure 2 This is a structural block diagram of a first data transmission device provided in an embodiment of this application.

[0019] Figure 3 A flowchart of a second data transmission method provided in an embodiment of this application.

[0020] Figure 4 This is a structural block diagram of the second data transmission device provided in an embodiment of this application.

[0021] Figure 5 This is a structural block diagram of a vehicle provided in an embodiment of this application.

[0022] Explanation of reference numerals in the attached drawings: 100-First data transmission device; 10-First generation module; 20-First processing module; 30-First storage module; 40-First communication module; 200-Second data transmission device; 50-Second generation module; 60-Second processing module; 70-Second storage module; 80-Second communication module; 300-Vehicle. Detailed Implementation

[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0024] In the description of this application, the terms "first," "second," "third," "fourth," "fifth," etc., are used to distinguish different objects, rather than to describe a specific order, and therefore should not be construed as limiting this application.

[0025] In the description of this application, unless otherwise expressly specified and limited, the term "connection" should be interpreted broadly. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium; it can also refer to the internal connection of two components; it can be a communication connection; or it can be an electrical connection. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0026] Please see Figure 1 as well as Figure 2 , Figure 1 A flowchart of the first data transmission method provided in the embodiments of this application. Figure 2 This is a structural block diagram of a first data transmission device 100 provided in an embodiment of this application. The first data transmission method is used to encrypt and transmit data. The first data transmission method is applied to, for example... Figure 2 The first data transmission device 100 shown stores target data to be transmitted. Figure 1 As shown, the first data transmission method includes the following steps:

[0027] S101: Determine the length of the target data.

[0028] S102: The first key is processed according to the length of the target data to obtain an encryption key, wherein the length of the encryption key is greater than or equal to the length of the target data and less than or equal to the length of the first key.

[0029] S103: The target data is encrypted using the encryption key to obtain target ciphertext data, the length of which is equal to the length of the encryption key.

[0030] S104: Send the target encrypted data to the receiving end.

[0031] In some embodiments, before processing the first key according to the length of the target data to obtain the encryption key, the first data transmission method further includes: generating a second key, the second key comprising a first preset number of random numbers, the first preset number of random numbers being sequentially sorted, each random number being one byte in length; and concatenating the first preset number of random numbers of the second key end-to-end and shifting them in the same direction by a second preset number of bits to obtain the first key, the first key comprising a reordered first preset number of random numbers, the second preset number being less than or equal to the first preset number, and the length of the first key being the first preset number of bytes. By shifting all the random numbers of the randomly generated second key to shuffle the order of the random numbers of the second key, the complexity of the generated first key is increased, making it more difficult to crack.

[0032] In some embodiments, the first data transmission device 100 is applied to a vehicle, and generating the second key includes: generating the second key based on a timestamp, the vehicle's identification code, and a random function. The timestamp is the interval between a specific moment and the moment the second key is generated; for example, the timestamp is the total number of seconds from January 1, 1970 (00:00:00 GMT) to the moment the second key is generated. The timestamp, obtained by calculating the interval between a specific moment and the moment the second key is generated, is unique and can be used to generate the random number. The vehicle's identification code contains information such as the vehicle's manufacturer, year, model, body style, engine code, and assembly location, equivalent to a vehicle's identification number, and is unique within a certain period (e.g., 30 years), and can be used to generate the random number. Generating a first preset number of random numbers based on the timestamp, the vehicle's identification code, and the random function makes it less likely for duplicate random numbers to appear among the first preset number of random numbers, thereby increasing the difficulty of cracking the second key.

[0033] In some embodiments, the second key is a first preset number of random numbers.

[0034] The step of concatenating the first and last random numbers of the second key with their heads and tails and shifting them in the same direction by a second preset number of positions to obtain the first key may include: forming a string of random numbers by concatenating the first preset number of random numbers with their heads and tails together, and shifting the string of random numbers clockwise or counterclockwise by a second preset number of positions, wherein each random number in the string is shifted by the second preset number of positions clockwise or counterclockwise to obtain the first key. For example, if the second key is {2,3,6,4,9,5,7,1,8,3,5}, shifting each random number of the second key two positions clockwise yields the first key {3,5,2,3,6,4,9,5,7,1,8}, or shifting each random number of the second key three positions counterclockwise yields the first key {4,9,5,7,1,8,3,5,2,3,6}. It should be noted that the above example is only for explaining how to obtain the first key by concatenating the first and last of a first preset number of random numbers of the second key and shifting them in the same direction by a second preset number of positions, and is not intended to limit the second key. Obtaining the first key by reordering the first preset number of random numbers of the second key increases the complexity of the first key, making the subsequently generated encryption key more complex and increasing the difficulty of cracking it.

[0035] In some embodiments, the first preset quantity is sixty-four, and the length of both the second key and the first key is sixty-four bytes.

[0036] The length of the target data is the number of bytes in the target data.

[0037] In some embodiments, encrypting the target data using the encryption key to obtain target ciphertext data specifically involves performing an XOR operation on the target data using the encryption key to obtain the target ciphertext data.

[0038] In some embodiments, the target data is vehicle bus data, such as CANFD (Controller Area Network with Flexible Data Rate) bus data.

[0039] In some embodiments, the first data transmission device 100 transmits the target encrypted data to the receiving end via a CANFD bus.

[0040] The receiving end may be as follows: Figure 4 The second data transmission device 200 shown.

[0041] In some embodiments, the first data transmission device 100 may be a device inside the vehicle, such as an engine controller, instrumentation device, multimedia device, etc.

[0042] The target data may include vehicle-related information, such as the status information or fault information of the first data transmission device 100. Furthermore, the target data may also include the driver's identity information.

[0043] The first data transmission method provided in this application obtains the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is less than or equal to the length of the first key. Therefore, the length of the encryption key can be flexibly changed according to the length of the target data, so that the target ciphertext data obtained by encrypting with the encryption key is not too long. This reduces the transmission load during transmission and avoids problems such as data reception delay and data packet loss.

[0044] In some embodiments, each random number includes eight sequentially arranged sub-random numbers, and the first key includes a first preset number of random numbers after reordering, i.e., eight times the first preset number of sub-random numbers. Each random number has a length of one byte, each byte has eight bits, and each sub-random number has a length of one bit. Each random number of the first key includes a four-bit sub-random number in the high-order bits, i.e., the high four-bit sub-random number, and a four-bit sub-random number in the low-order bits, i.e., the low four-bit sub-random number.

[0045] In some embodiments, in step S102, processing the first key according to the length of the target data to obtain the encryption key includes: when it is determined that the length of the target data is less than or equal to a third preset number of bytes, extracting an encryption key of a length of a third preset number of bytes from the first key, wherein the third preset number is less than the first preset number.

[0046] In some embodiments, step S102, processing the first key according to the length of the target data to obtain the encryption key, includes the following steps:

[0047] S1021: When it is determined that the length of the target data is less than or equal to a third preset number of bytes, a third key is obtained by extracting four-bit sub-random numbers from each random number of the first key. The third key includes a fourth preset number of preprocessed random numbers, and each preprocessed random number includes eight-bit preprocessed sub-random numbers arranged in sequence. The third preset number is less than the first preset number.

[0048] S1022: Extract the four-bit preprocessed sub-random number from each preprocessed random number of the third key to obtain the encryption key.

[0049] The step of extracting a four-digit sub-random number from each random number of the first key may include: extracting any four-digit sub-random number from each random number of the first key. This arbitrary four-digit sub-random number may be a consecutive four-digit sub-random number, a non-consecutive four-digit sub-random number, or a four-digit sub-random number composed of consecutive and non-consecutive partial-digit random numbers.

[0050] The step of extracting a four-bit preprocessed sub-random number from each preprocessed random number of the third key may include: extracting any four-bit preprocessed sub-random number from each random number of the third key. This arbitrary four-bit preprocessed sub-random number may be a consecutive four-bit preprocessed sub-random number, a non-consecutive four-bit preprocessed sub-random number, or a four-bit preprocessed sub-random number composed of consecutive and non-consecutive preprocessed sub-random numbers.

[0051] In some embodiments, the third preset quantity may be one-quarter of the first preset quantity.

[0052] In some embodiments, the first preset quantity is 64, and the third preset quantity is 16.

[0053] In some embodiments, obtaining a third key by extracting a four-digit sub-random number from each random number of the first key includes: extracting a first consecutive four-digit sub-random number from each random number of the first key, and sorting the first consecutive four-digit sub-random numbers of all extracted random numbers according to the order of each random number in the first key to obtain the third key, wherein the fourth preset quantity is half of the first preset quantity.

[0054] In some embodiments, the first four consecutive bits of each random number can be either the high four bits or the low four bits of each random number. Obviously, the first four consecutive bits of each random number can also be any four consecutive bits of each random number, that is, the first four consecutive sub-random bits of each random number can also be any four consecutive sub-random bits of each random number.

[0055] In some embodiments, obtaining the encryption key by extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key includes: extracting the second consecutive four-bit preprocessed sub-random numbers from each preprocessed random number of the third key, and sorting the second consecutive four-bit preprocessed sub-random numbers of all extracted preprocessed random numbers according to the order of each preprocessed random number in the third key to obtain the encryption key, wherein the length of the encryption key is a target number of bytes, and the target number is one-quarter of the first preset number.

[0056] In some embodiments, the second four consecutive bits of each preprocessed random number are either the high four bits or the low four bits of each preprocessed random number. Obviously, the second four consecutive bits of each preprocessed random number can also be any four consecutive bits of each preprocessed random number, that is, the second four consecutive bits of the preprocessed sub-random number of each preprocessed random number can also be any four consecutive bits of the preprocessed sub-random number of each preprocessed random number.

[0057] In some embodiments, the first preset quantity is 64, the third preset quantity is 16, and the target quantity is 16. When it is determined that the number of bytes of the target data is less than or equal to 16 bytes, the first four consecutive sub-random numbers of each random number in the first key are extracted, and the first four consecutive sub-random numbers of all extracted random numbers are sorted according to the order of each random number in the first key to obtain a third key with a length of 32 bytes. The second four consecutive preprocessed sub-random numbers of each preprocessed random number in the third key are extracted, and the second four consecutive preprocessed sub-random numbers of all extracted preprocessed random numbers are sorted according to the order of each preprocessed random number in the third key to obtain the encryption key with a length of 16 bytes.

[0058] In this embodiment, when the length of the target data is less than or equal to the third preset number of bytes, the first preset number of random numbers of the first key are extracted to obtain a third key with a length of half the first preset number of bytes, and the third key is extracted to obtain an encryption key with a length of one-quarter the first preset number of bytes. By performing these two extraction processes on the first key, the generated encryption key will not be too long. This not only realizes the determination of the length of the generated encryption key based on the length of the target data, but also ensures that the length of the target ciphertext data obtained by encrypting with the encryption key is the same as the length of the encryption key. Thus, the length of the target ciphertext data will not be too long, avoiding problems such as data reception delay and data packet loss during data transmission.

[0059] In some other embodiments, the third preset quantity may be one-eighth, three-eighths, one-half, etc. of the first preset quantity.

[0060] In some embodiments, in step S102, the step of processing the first key according to the length of the target data to obtain the encryption key includes step S1023: when it is determined that the length of the target data is a target number of bytes and the target number is greater than a fifth preset number, extracting a target number of consecutive random numbers from the first key to obtain the encryption key, wherein the fifth preset number is less than the first preset number.

[0061] In some embodiments, the fifth preset quantity is one-quarter of the first preset quantity. In some embodiments, the first preset quantity is 64, and the fifth preset quantity is 16. For example, when the target data is determined to be 32 bytes (greater than 16 bytes), 32 consecutive random numbers are extracted from the first key to obtain the encryption key with a length of 32 bytes. In other embodiments, the fifth preset quantity may also be one-eighth, three-eighths, one-half, etc., of the first preset quantity.

[0062] In this embodiment, when the length of the target data is greater than the fifth preset number of bytes, the target number of random numbers are extracted from the first key to obtain the encryption key. By truncating the first key, the encryption key with a length equal to the length of the target data is obtained. This not only realizes the determination of the length of the generated encryption key based on the length of the target data, but also ensures that the length of the target ciphertext data obtained by encrypting with the encryption key is the same as the length of the encryption key. As a result, the length of the target ciphertext data will not be too long, avoiding problems such as data reception delay and data packet loss during data transmission.

[0063] In some embodiments, the length of the encryption key is a target number of bytes, and the step of encrypting the target data with the encryption key to obtain target ciphertext data includes: encrypting the target data once with the encryption key to obtain first ciphertext data as target ciphertext data, or further processing the first ciphertext data obtained after encrypting the target data once with the encryption key to obtain the target ciphertext data.

[0064] The length of the first ciphertext data obtained by encrypting the target data once using the encryption key is the target number of bytes.

[0065] In some embodiments, the target data can be encrypted once using the encryption key to obtain the first ciphertext data, and the first ciphertext data can be directly sent to the receiving end as the target ciphertext data, which can reduce computational costs.

[0066] In other embodiments, the first ciphertext data may be further processed to obtain the target ciphertext data, and the target ciphertext data may be sent to the receiving end. Obtaining the target ciphertext data through further processing of the first ciphertext data increases the security and confidentiality of the target ciphertext data, and increases the difficulty of cracking it.

[0067] In some embodiments, the first ciphertext data includes a target number of sub-first ciphertext data, which are sequentially ordered. Each sub-first ciphertext data has a length of one byte. Further processing of the first ciphertext data obtained by encrypting the target data once with the encryption key to obtain the target ciphertext data includes: concatenating the first and last parts of the target number of sub-first ciphertext data and shifting them along a first direction by a sixth preset number of positions to obtain second ciphertext data as the target ciphertext data. The second ciphertext data includes the reordered target number of sub-first ciphertext data. The length of the data is the target number of bytes, and the sixth preset number is less than or equal to the target number; or, the first and last parts of the target number of sub-first ciphertext data are concatenated, and the data is shifted along the first direction by the sixth preset number of positions to obtain the second ciphertext data, the second ciphertext data including the target number of reordered sub-first ciphertext data, the length of the second ciphertext data is the target number of bytes, the sixth preset number is less than or equal to the target number, and the second ciphertext data is encrypted using the encryption key to obtain the third ciphertext data as the target ciphertext data, the length of the third ciphertext data being the target number of bytes.

[0068] In some embodiments, obtaining the second ciphertext data by concatenating the first and last parts of the target number of sub-first ciphertext data and shifting them along a first direction by a sixth preset number of positions may include: forming a concatenated sub-first ciphertext data string from the target number of sub-first ciphertext data, and shifting the sub-first ciphertext data string clockwise or counterclockwise by the sixth preset number of positions, wherein each sub-first ciphertext data in the sub-first ciphertext data string is shifted clockwise or counterclockwise by the sixth preset number of positions to obtain the second ciphertext data. In this embodiment, the first direction may be clockwise or counterclockwise. Obtaining the second ciphertext data by shifting the first ciphertext data increases the complexity of the second ciphertext data, thereby increasing the security and confidentiality of the target ciphertext data when it is transmitted as the target ciphertext data.

[0069] In some embodiments, encrypting the second ciphertext data using the encryption key to obtain the third ciphertext data may include: performing an XOR operation on the second ciphertext data using the encryption key to obtain the third ciphertext data. By further encrypting the second ciphertext data to obtain the third ciphertext data, the complexity of the third ciphertext data can be further increased. Therefore, when the third ciphertext data is transmitted as target ciphertext data, the security and confidentiality of the target ciphertext data can be further increased, making the target ciphertext data more difficult to crack.

[0070] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0071] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0072] Please refer to it again. Figure 2 , Figure 2 The first data transmission device 100 shown is connected to a receiving end, and the first data transmission device 100 stores target data to be transmitted. The first data transmission device 100 includes a first processing module 20. The first processing module 20 is used to determine the length of the target data, process a first key according to the length of the target data to obtain an encryption key, the length of the encryption key being greater than or equal to the length of the target data and less than or equal to the length of the first key, encrypt the target data using the encryption key to obtain target ciphertext data, the length of the target ciphertext data being equal to the length of the encryption key, and control the transmission of the target ciphertext data to the receiving end.

[0073] In some embodiments, such as Figure 2 As shown, the first data transmission device 100 further includes a first generation module 10, which generates a second key. The second key includes a first preset number of random numbers, which are sequentially sorted. Each random number has a length of one byte. The first generation module 10 also generates a second key by concatenating the first preset number of random numbers of the second key end-to-end and shifting them in the same direction by a second preset number of positions. The first key includes the reordered first preset number of random numbers, and the second preset number is less than or equal to the first preset number. By shifting all the random numbers of the randomly generated second key to shuffle the order of the random numbers, the complexity of the generated first key is increased, making it more difficult to crack.

[0074] In some embodiments, such as Figure 2As shown, the first data transmission device 100 further includes a first storage module 30 and a first communication module 40. The first storage module 30 is used to store the first key and the target data. The first communication module 40 is used to communicate with the receiving end, and the first processing module 20 can send the target encrypted data to the receiving end through the first communication module 40.

[0075] In some embodiments, the receiving end may be as follows: Figure 4 The second data transmission device 200 shown.

[0076] In some embodiments, the first data transmission device 100 may be a device inside the vehicle, such as an engine controller, instrumentation device, multimedia device, etc.

[0077] In some embodiments, the target data may be vehicle-related information, such as the status information or fault information of the first data transmission device 100. Furthermore, the target data may also be driver identification information.

[0078] In some embodiments, the first generation module 10 and the first processing module 20 may be processing chips such as processors, microcontrollers, and controllers, and the first generation module 10 and the first processing module 20 may be separate processing chips or integrated processing chips.

[0079] In some embodiments, the first storage module 30 may be a non-volatile memory, such as FRAM (Ferroelectric Random Access Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM (Erasable Programmable Read Only Memory), etc.

[0080] In some embodiments, the first communication module 40 may be a CANFD (Controller Area Network with Flexible Data Rate) bus.

[0081] The first data transmission device 100 provided in this application embodiment obtains the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is less than or equal to the length of the first key. Therefore, the length of the encryption key can be flexibly changed according to the length of the target data, so that the target ciphertext data obtained by encrypting with the encryption key is not too long, which can reduce the transmission load during transmission and avoid problems such as data reception delay and data packet loss.

[0082] In some embodiments, each random number includes eight sequentially arranged sub-random numbers, and the first key includes a first preset number of random numbers after reordering, i.e., eight times the first preset number of sub-random numbers. Each random number has a length of one byte, each byte has eight bits, and each sub-random number has a length of one bit. Each random number of the first key includes a four-bit sub-random number in the high-order bits, i.e., the high four-bit sub-random number, and a four-bit sub-random number in the low-order bits, i.e., the low four-bit sub-random number.

[0083] In some embodiments, the first processing module 20 processes the first key according to the length of the target data to obtain an encryption key, including: when the first processing module 20 determines that the length of the target data is less than or equal to a third preset number of bytes, the first processing module 20 extracts an encryption key of a length of a third preset number of bytes from the first key, wherein the third preset number is less than the first preset number.

[0084] In some embodiments, the first processing module 20 processes the first key according to the length of the target data to obtain an encryption key, including: when the first processing module 20 determines that the length of the target data is less than or equal to a third preset number of bytes, extracting four-bit sub-random numbers from each random number of the first key to obtain a third key, the third key including a fourth preset number of preprocessed random numbers, each preprocessed random number including eight-bit preprocessed sub-random numbers arranged in sequence, the third preset number being less than the first preset number, and extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key to obtain the encryption key.

[0085] The step of extracting a four-digit sub-random number from each random number of the first key may include: extracting any four-digit sub-random number from each random number of the first key. This arbitrary four-digit sub-random number may be a consecutive four-digit sub-random number, a non-consecutive four-digit sub-random number, or a four-digit sub-random number composed of consecutive and non-consecutive partial-digit random numbers.

[0086] The step of extracting a four-bit preprocessed sub-random number from each preprocessed random number of the third key may include: extracting any four-bit preprocessed sub-random number from each random number of the third key. This arbitrary four-bit preprocessed sub-random number may be a consecutive four-bit preprocessed sub-random number, a non-consecutive four-bit preprocessed sub-random number, or a four-bit preprocessed sub-random number composed of consecutive and non-consecutive preprocessed sub-random numbers.

[0087] In some embodiments, the third preset quantity may be one-quarter of the first preset quantity.

[0088] In some embodiments, obtaining a third key by extracting four-digit sub-random numbers from each random number of the first key includes: extracting the first consecutive four-digit sub-random numbers from each random number of the first key, and sorting the first consecutive four-digit sub-random numbers of all extracted random numbers according to the order of each random number in the first key to obtain a third key. The third key includes a fourth preset number of preprocessed random numbers, each preprocessed random number including eight preprocessed sub-random numbers arranged in sequence, and the fourth preset number is half of the first preset number.

[0089] In some embodiments, the first four consecutive bits of each random number are either the high four bits or the low four bits of each random number. Obviously, the first four consecutive bits of each random number can also be any four consecutive bits of each random number, that is, the first four consecutive sub-random bits of each random number can also be any four consecutive sub-random bits of each random number.

[0090] In some embodiments, obtaining the encryption key by extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key includes: extracting the second consecutive four-bit preprocessed sub-random numbers from each preprocessed random number of the third key, and sorting the second consecutive four-bit preprocessed sub-random numbers of all extracted preprocessed random numbers according to the order of each preprocessed random number in the third key to obtain the encryption key, wherein the length of the encryption key is a target number of bytes, and the target number is one-quarter of the first preset number.

[0091] In some embodiments, the second four consecutive bits of each preprocessed random number are either the high four bits or the low four bits of each preprocessed random number. Obviously, the second four consecutive bits of each preprocessed random number can also be any four consecutive bits of each preprocessed random number, that is, the second four consecutive bits of the preprocessed sub-random number of each preprocessed random number can also be any four consecutive bits of the preprocessed sub-random number of each preprocessed random number.

[0092] In this embodiment, when the length of the target data is less than or equal to a third preset number of bytes, the first preset number of random numbers of the first key are extracted to obtain a third key with a length of half a first preset number of bytes, and the third key is extracted to obtain an encryption key with a length of one-quarter of a first preset number of bytes. By performing these two extraction processes on the first key, the length of the generated encryption key will not be too long. This not only realizes the determination of the length of the generated encryption key based on the length of the target data, but also ensures that the length of the target ciphertext data obtained by encrypting with the encryption key is the same as the length of the encryption key. Thus, the length of the target ciphertext data will not be too long, avoiding problems such as data reception delay and data packet loss during data transmission.

[0093] In some other embodiments, the third preset quantity may be one-eighth, three-eighths, one-half, etc. of the first preset quantity.

[0094] In some embodiments, the first processing module 20 processes the first key according to the length of the target data to obtain an encryption key, including: when it is determined that the length of the target data is a target number of bytes and the target number is greater than a fifth preset number, extracting a target number of consecutive random numbers from the first key to obtain the encryption key, wherein the fifth preset number is less than the first preset number.

[0095] In some embodiments, the fifth preset quantity is one-quarter of the first preset quantity. In other embodiments, the fifth preset quantity may also be one-eighth, three-eighths, one-half, etc., of the first preset quantity.

[0096] In this embodiment, when the length of the target data is greater than the fifth preset number of bytes, the target number of random numbers are extracted from the first key to obtain the encryption key. By truncating the first key, the encryption key with a length equal to the length of the target data is obtained. This not only realizes the determination of the length of the generated encryption key based on the length of the target data, but also ensures that the length of the target ciphertext data obtained by encrypting with the encryption key is the same as the length of the encryption key. As a result, the length of the target ciphertext data will not be too long, avoiding problems such as data reception delay and data packet loss during data transmission.

[0097] In some embodiments, the length of the encryption key is a target number of bytes. The first processing module 20 uses the encryption key to encrypt the target data to obtain target ciphertext data, including: the first processing module 20 encrypts the target data once using the encryption key to obtain first ciphertext data as the target ciphertext data, or further processes the first ciphertext data obtained after encrypting the target data once with the encryption key to obtain the target ciphertext data. Wherein, the length of the first ciphertext data is the target number of bytes.

[0098] In some embodiments, the first processing module 20 can use the encryption key to encrypt the target data once to obtain the first ciphertext data, and control the first ciphertext data to be sent directly to the receiving end as the target ciphertext data, which can reduce computational costs.

[0099] In other embodiments, the first processing module 20 may further process the first ciphertext data to obtain the target ciphertext data, and control the transmission of the target ciphertext data to the receiving end. The target ciphertext data obtained by further processing the first ciphertext data increases the security and confidentiality of the target ciphertext data, and increases the difficulty of cracking it.

[0100] In some embodiments, the first ciphertext data includes a target number of sub-first ciphertext data, which are sequentially ordered. Each sub-first ciphertext data has a length of one byte. The first processing module 20 further processes the first ciphertext data obtained by encrypting the target data once with the encryption key to obtain the target ciphertext data. This process includes: the first processing module 20 concatenates the first and last parts of the target number of sub-first ciphertext data and shifts them along a first direction by a sixth preset number of positions to obtain second ciphertext data as the target ciphertext data. The second ciphertext data includes the reordered target number of sub-first ciphertext data. According to the above, the length of the second ciphertext data is the target number of bytes, and the sixth preset number is less than or equal to the target number; or, the first and last parts of the target number of sub-first ciphertext data are concatenated, and the second ciphertext data is obtained by shifting it along the first direction by the sixth preset number of positions. The second ciphertext data includes the target number of sub-first ciphertext data after reordering. The length of the second ciphertext data is the target number of bytes, and the sixth preset number is less than or equal to the target number. The second ciphertext data is then encrypted using the encryption key to obtain the third ciphertext data as the target ciphertext data. The length of the third ciphertext data is the target number of bytes.

[0101] In some embodiments, the second ciphertext data is obtained by shifting the first ciphertext data, which increases the complexity of the second ciphertext data. This increases the security and confidentiality of the target ciphertext data when the second ciphertext data is transmitted as the target ciphertext data.

[0102] In some embodiments, by encrypting the second ciphertext data again to obtain the third ciphertext data, the complexity of the third ciphertext data can be further increased. Thus, when the third ciphertext data is transmitted as target ciphertext data, the security and confidentiality of the target ciphertext data can be further increased, making the target ciphertext data more difficult to crack.

[0103] It should be noted that the first data transmission device 100 corresponds to the aforementioned first data transmission method. For a more detailed description, please refer to the contents of the various embodiments of the aforementioned first data transmission method. The contents of the first data transmission device 100 and the aforementioned first data transmission method can also be referred to each other.

[0104] Please see Figure 3 as well as Figure 4 , Figure 3 A flowchart of the second data transmission method provided in the embodiments of this application. Figure 4 This is a structural block diagram of a second data transmission device 200 provided in an embodiment of this application. The second data transmission method is used to receive and decrypt data. The second data transmission method is applied to, for example... Figure 4 The second data transmission device 200 shown is connected to a transmitting end, which stores target data to be transmitted and target ciphertext data obtained by encrypting the target data. Figure 3 As shown, the second data transmission method includes the following steps:

[0105] S201: Upon receiving the target ciphertext data, determine the length of the target ciphertext data.

[0106] S202: The first key is processed according to the length of the target ciphertext data to obtain a decryption key, wherein the length of the decryption key is equal to the length of the target ciphertext data and less than or equal to the length of the first key.

[0107] S203: Use the decryption key to decrypt the target ciphertext data to obtain the target data.

[0108] In some embodiments, before processing the first key according to the length of the target data to obtain the encryption key, the second data transmission method further includes: generating a second key, the second key comprising a first preset number of random numbers, the first preset number of random numbers being sequentially sorted, each random number being one byte in length; concatenating the first preset number of random numbers of the second key end-to-end and shifting them in the same direction by a second preset number of bits to obtain the first key, the first key comprising a reordered first preset number of random numbers, the second preset number being less than or equal to the first preset number, and the length of the first key being the first preset number of bytes. By shifting all the random numbers of the randomly generated second key to shuffle the order of the random numbers of the second key, the complexity of the generated first key is increased, making it more difficult to crack.

[0109] In some embodiments, the decryption key in step S202 is the same as the encryption key in step S102 described above.

[0110] In some embodiments, the second data transmission device 200 is applied to a vehicle, and generating the second key includes: generating the second key based on a timestamp, the vehicle's identification code, and a random function. The timestamp is the interval between a specific moment and the moment the second key is generated; for example, the timestamp is the total number of seconds from January 1, 1970 (00:00:00 GMT) to the moment the second key is generated. The timestamp, obtained by calculating the interval between a specific moment and the moment the second key is generated, is unique and can be used to generate the random number. The vehicle's identification code contains information such as the vehicle's manufacturer, year, model, body style, engine code, and assembly location, equivalent to a vehicle's identification number, and is unique within a certain period (e.g., 30 years), and can be used to generate the random number. Generating a first preset number of random numbers based on the timestamp, the vehicle's identification code, and the random function makes it less likely for duplicate random numbers to appear among the first preset number of random numbers, thereby increasing the difficulty of cracking the second key.

[0111] In some embodiments, the second key is a first preset number of random numbers.

[0112] The step of concatenating the first preset number of random numbers end-to-end and shifting them in the same direction by a second preset number of positions to obtain the first key may include: forming a string of random numbers by concatenating the first preset number of random numbers end-to-end, and shifting the string of random numbers clockwise or counterclockwise by a second preset number of positions, wherein each random number in the string is shifted by the second preset number of positions clockwise or counterclockwise to obtain the first key. For example, if the second key is {2,3,6,4,9,5,7,1,8,3,5}, shifting each random number in the second key two positions clockwise yields the first key {3,5,2,3,6,4,9,5,7,1,8}, or shifting each random number in the second key three positions counterclockwise yields the first key {4,9,5,7,1,8,3,5,2,3,6}. It should be noted that the above example is only for explaining how to obtain the first key by concatenating the first and last of a first preset number of random numbers of the second key and shifting them in the same direction by a second preset number of positions, and is not intended to limit the second key. Obtaining the first key by reordering the first preset number of random numbers of the second key increases the complexity of the first key, making the subsequently generated encryption key more complex and increasing the difficulty of cracking it.

[0113] In some embodiments, the first preset quantity is sixty-four, and the length of both the second key and the first key is sixty-four bytes.

[0114] The length of the target data is the number of bytes in the target data.

[0115] In some embodiments, the target data may be vehicle bus data, such as CANFD (Controller Area Network with Flexible Data Rate) bus data.

[0116] The target data may be vehicle-related information, such as the status information or fault information of the first data transmission device 100. Additionally, the target data may also include the driver's identity information.

[0117] The sending end may be the aforementioned first data transmission device 100.

[0118] In some embodiments, the second data transmission device 200 may be a device inside the vehicle, such as a T-BOX (Telematics BOX, vehicle communication terminal), a vehicle controller, etc.

[0119] The second data transmission method provided in this application embodiment can process the first key according to the length of the target ciphertext data to obtain a decryption key with a length equal to that of the target ciphertext data, which can be used to decrypt the target ciphertext data. This realizes the flexible change of the length of the decryption key according to the length of the target ciphertext data. Thus, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device 200, reducing the transmission load of the transmission bus and avoiding data reception delay, packet loss, etc.

[0120] In some embodiments, each random number includes eight sequentially arranged sub-random numbers, and the first key includes a first preset number of random numbers after reordering, i.e., eight times the first preset number of sub-random numbers. Each random number has a length of one byte, each byte has eight bits, and each sub-random number has a length of one bit. Each random number of the first key includes a four-bit sub-random number in the high-order bits, i.e., the high four-bit sub-random number, and a four-bit sub-random number in the low-order bits, i.e., the low four-bit sub-random number.

[0121] In some embodiments, processing the first key according to the length of the target ciphertext data to obtain the decryption key includes: when the length of the target ciphertext data is determined to be equal to one-quarter of a first preset number of bytes, extracting four-bit sub-random numbers from each random number of the first key to obtain a third key, the third key including a fourth preset number of preprocessed random numbers, each preprocessed random number including eight-bit preprocessed sub-random numbers arranged sequentially, the third preset number being less than the first preset number; and extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key to obtain the decryption key. In some embodiments, the decryption key is the same as the encryption key in the aforementioned step S1022.

[0122] In some embodiments, the step of extracting four-digit sub-random numbers from each random number of the first key to obtain the third key includes: extracting the first consecutive four-digit sub-random numbers from each random number of the first key, and sorting the first consecutive four-digit sub-random numbers of all extracted random numbers according to the order of each random number in the first key to obtain the third key, wherein the fourth preset quantity is half of the first preset quantity.

[0123] In some embodiments, the first four consecutive bits of each random number are either the high four bits or the low four bits of each random number. Obviously, the first four consecutive bits of each random number can also be any four consecutive bits of each random number, that is, the first four consecutive sub-random bits of each random number can also be any four consecutive sub-random bits of each random number.

[0124] In some embodiments, obtaining the decryption key by extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key includes: extracting the second consecutive four-bit preprocessed sub-random numbers from each preprocessed random number of the third key, and sorting the second consecutive four-bit preprocessed sub-random numbers of all extracted preprocessed random numbers according to the order of each preprocessed random number in the third key to obtain the decryption key, wherein the length of the decryption key is a target number of bytes, and the target number is one-quarter of the first preset number.

[0125] In some embodiments, the second four consecutive bits of each preprocessed random number are either the high four bits or the low four bits of each preprocessed random number. Obviously, the second four consecutive bits of each preprocessed random number can also be any four consecutive bits of each preprocessed random number, that is, the second four consecutive bits of the preprocessed sub-random number of each preprocessed random number can also be any four consecutive bits of the preprocessed sub-random number of each preprocessed random number.

[0126] In some embodiments, the first preset quantity is 64, and the target quantity is 16. When the number of bytes of the target ciphertext data is determined to be equal to 16 bytes, the first four consecutive sub-random numbers of each random number in the first key are extracted, and the first four consecutive sub-random numbers of all extracted random numbers are sorted according to the order of each random number in the first key to obtain a third key with a length of 32 bytes. Then, the second four consecutive preprocessed sub-random numbers of each preprocessed random number in the third key are extracted, and the second four consecutive preprocessed sub-random numbers of all extracted preprocessed random numbers are sorted according to the order of each preprocessed random number in the third key to obtain the decryption key with a length of 16 bytes.

[0127] In this embodiment, when the length of the target ciphertext data is equal to one-quarter of a first preset number of bytes, the first preset number of random numbers of the first key are extracted to obtain a third key with a length of one-half of a first preset number of bytes, and the third key is extracted to obtain an encryption key with a length of one-quarter of a first preset number of bytes. By performing these two extraction processes on the first key, a decryption key with a length equal to the length of the target ciphertext data is obtained. This realizes the flexible variation of the length of the decryption key according to the length of the target ciphertext data. Therefore, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device 200, reducing the transmission load of the transmission bus and avoiding data reception delays, packet loss, etc.

[0128] In some embodiments, processing the first key according to the length of the target ciphertext data to obtain the decryption key includes: when the length of the target ciphertext data is determined to be a target number of bytes and the target number is greater than a fifth preset number, extracting a target number of consecutive random numbers from the first key to obtain the decryption key, wherein the fifth preset number is less than the first preset number. In some embodiments, the decryption key is the same as the encryption key in the aforementioned step S1023.

[0129] In some embodiments, the fifth preset quantity is one-quarter of the first preset quantity. In some embodiments, the first preset quantity is 64, and the fifth preset quantity is 16. For example, when the number of bytes of the target ciphertext data is determined to be 32 bytes (greater than 16 bytes), 32 consecutive random numbers are extracted from the first key to obtain the decryption key with a length of 32 bytes. In other embodiments, the fifth preset quantity may also be one-eighth, three-eighths, one-half, etc., of the first preset quantity.

[0130] In this embodiment, when the length of the target ciphertext data is greater than the fifth preset number of bytes, the target number of random numbers are extracted from the first key to obtain the decryption key. By truncating the first key, a decryption key with a length equal to the length of the target ciphertext data is obtained. This realizes the flexible variation of the length of the decryption key according to the length of the target ciphertext data. Thus, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device 200, reducing the transmission load of the transmission bus and avoiding data reception delays, packet loss, etc.

[0131] In some embodiments, the step of decrypting the target ciphertext data using the decryption key to obtain the target data includes: decrypting the target ciphertext data once using the decryption key to obtain the target data; or, preprocessing the target ciphertext data to obtain first ciphertext data, and decrypting the first ciphertext data using the decryption key to obtain the target data.

[0132] In some embodiments, the step of decrypting the target ciphertext data once using the decryption key to obtain the target data may include: performing an XOR operation on the target ciphertext data using the decryption key to obtain the target data.

[0133] In some embodiments, as described above, the target ciphertext data is obtained by encrypting the target data once using an encryption key. When the second data transmission device 200 decrypts the target ciphertext data, it can use the decryption key to decrypt the target ciphertext data once to obtain the target data. Obtaining the target data through a single decryption reduces the computational cost of the decryption process.

[0134] In other embodiments, as described above, the target ciphertext data is obtained by encrypting the target data once using an encryption key to obtain first ciphertext data, and then further processing the first ciphertext data to obtain the target ciphertext data. When decrypting the target ciphertext data, the second data transmission device 200 can preprocess the target ciphertext data to obtain the first ciphertext data, and then decrypt the first ciphertext data once using the decryption key to obtain the target data. In this embodiment, the process of obtaining the target data involves preprocessing the target ciphertext data to obtain the first ciphertext data and then decrypting the first ciphertext data to obtain the target data, which increases the complexity of the decryption process and the difficulty of decryption.

[0135] In some embodiments, the target ciphertext data includes a target number of sub-target ciphertext data, which are sequentially ordered, each sub-target ciphertext data having a length of one byte. The preprocessing of the target ciphertext data to obtain the first ciphertext data includes:

[0136] The first ciphertext data is obtained by concatenating the first and last parts of the target number of sub-target ciphertext data and shifting them along the second direction by a sixth preset number of positions, wherein the sixth preset number is less than or equal to the target number; or, the target ciphertext data is obtained by decrypting it using the decryption key, wherein the second ciphertext data includes the target number of sub-second ciphertext data, wherein the target number of sub-second ciphertext data are ordered sequentially, and each sub-second ciphertext data is one byte in length, wherein the first ciphertext data is obtained by concatenating the first and last parts of the target number of sub-second ciphertext data and shifting them along the second direction by a sixth preset number of positions.

[0137] The second direction is the opposite of the first direction mentioned above.

[0138] In some embodiments, the step of decrypting the target ciphertext data using the decryption key to obtain the second ciphertext data may include: performing an XOR operation on the target ciphertext data using the decryption key to obtain the second ciphertext data.

[0139] In some embodiments, the step of concatenating the first and last ends of the target number of sub-target ciphertext data and shifting them along a second direction by a sixth preset number of positions to obtain the first ciphertext data may include: forming a concatenated sub-target ciphertext data string from the target number of sub-target ciphertext data, and shifting the sub-target ciphertext data string clockwise or counterclockwise by the sixth preset number of positions, wherein each sub-target ciphertext data in the sub-target ciphertext data string is shifted clockwise or counterclockwise by the sixth preset number of positions to obtain the first ciphertext data. In this embodiment, the second direction may be clockwise or counterclockwise. The second direction is the opposite of the aforementioned first direction; for example, when the aforementioned first direction is clockwise, the second direction is counterclockwise. In this embodiment, when preprocessing the target ciphertext data to obtain the first ciphertext data, shifting the target ciphertext data is required to obtain the first ciphertext data, which increases the complexity of the decryption process and the difficulty of decryption.

[0140] In some embodiments, the step of concatenating the first and last ends of the target number of sub-second ciphertext data and shifting them along a second direction by a sixth preset number of positions to obtain the first ciphertext data may include: forming a concatenated sub-second ciphertext data string from the target number of sub-second ciphertext data, and shifting the sub-second ciphertext data string clockwise or counterclockwise by the sixth preset number of positions, wherein each sub-second ciphertext data in the sub-second ciphertext data string is shifted clockwise or counterclockwise by the sixth preset number of positions to obtain the first ciphertext data. In this embodiment, the second direction may be clockwise or counterclockwise. The second direction is the opposite of the aforementioned first direction; for example, when the aforementioned first direction is clockwise, the second direction is counterclockwise. In this embodiment, when preprocessing the target ciphertext data to obtain the first ciphertext data, the first ciphertext data is obtained only by decrypting the target ciphertext data and shifting the second ciphertext data, which increases the complexity and difficulty of the decryption process.

[0141] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0142] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0143] Please refer to it again. Figure 4 , Figure 4 The second data transmission device 200 shown is connected to a transmitting end, which stores target data to be transmitted and target ciphertext data obtained by encrypting the target data. The second data transmission device 200 includes a second processing module 60. The second processing module 60 is used to, upon receiving the target ciphertext data, determine the length of the target ciphertext data, process a first key according to the length of the target ciphertext data to obtain a decryption key, wherein the length of the decryption key is equal to the length of the target ciphertext data and less than or equal to the length of the first key, and use the decryption key to decrypt the target ciphertext data to obtain the target data.

[0144] In some embodiments, such as Figure 4 As shown, the second data transmission device 200 further includes a second generation module 50, which generates a second key. The second key includes a first preset number of random numbers, which are sequentially sorted. Each random number has a length of one byte. The second generation module 50 also generates a first key by concatenating the first preset number of random numbers of the second key end-to-end and shifting them in the same direction by a second preset number of bits. The first key includes the reordered first preset number of random numbers, where the second preset number is less than or equal to the first preset number, and the length of the first key is the first preset number of bytes. By shifting all the random numbers of the randomly generated second key to shuffle their order, the complexity of the generated first key is increased, making it more difficult to crack.

[0145] In some embodiments, the decryption key obtained by processing the first key according to the length of the target ciphertext data is the same as the encryption key in the aforementioned step S102.

[0146] In some embodiments, the second key is a first preset number of random numbers.

[0147] In some embodiments, the first preset quantity is sixty-four, and the length of both the second key and the first key is sixty-four bytes.

[0148] The length of the target data is the number of bytes in the target data.

[0149] In some embodiments, such as Figure 4As shown, the second data transmission device 200 further includes a second storage module 70 and a second communication module 80. The second storage module 70 is used to store the first key and the target ciphertext data, and the second communication module 80 is used to communicate with the sending end to receive the target ciphertext data sent by the sending end.

[0150] In some embodiments, the second generation module 50 and the second processing module 60 may be processing chips such as processors, microcontrollers, and controllers, and the second generation module 50 and the second processing module 60 may be separate processing chips or integrated processing chips.

[0151] In some embodiments, the second storage module 70 may be a non-volatile memory, such as FRAM (Ferroelectric Random Access Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM (Erasable Programmable Read Only Memory), etc.

[0152] In some embodiments, the second communication module 80 may be a CANFD (Controller Area Network with Flexible Data Rate) bus.

[0153] The sending end may be the aforementioned first data transmission device 100.

[0154] In some embodiments, the second data transmission device 200 may be a device inside the vehicle, such as a T-BOX (Telematics BOX, vehicle communication terminal), a vehicle controller, etc.

[0155] In some embodiments, the target data may be vehicle-related information, such as status information or fault information of the first data transmission device 100. Furthermore, the target data may also be driver identification information.

[0156] The second data transmission device 200 provided in this application embodiment can process the first key according to the length of the target ciphertext data to obtain a decryption key with a length equal to that of the target ciphertext data, which can be used to decrypt the target ciphertext data. This realizes the flexible change of the length of the decryption key according to the length of the target ciphertext data. Thus, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device 200, reducing the transmission load of the transmission bus and avoiding data reception delay, packet loss, etc.

[0157] In some embodiments, each random number includes eight sequentially arranged sub-random numbers, and the first key includes a first preset number of random numbers after reordering, i.e., eight times the first preset number of sub-random numbers. Each random number has a length of one byte, each byte has eight bits, and each sub-random number has a length of one bit. Each random number of the first key includes a four-bit sub-random number in the high-order bits, i.e., the high four-bit sub-random number, and a four-bit sub-random number in the low-order bits, i.e., the low four-bit sub-random number.

[0158] In some embodiments, the second processing module 60 processes the first key according to the length of the target ciphertext data to obtain a decryption key, including: when the second processing module 60 determines that the length of the target ciphertext data is equal to a first preset number of bytes (one-quarter of the target ciphertext data), extracting four-bit sub-random numbers from each random number of the first key to obtain a third key, the third key including a fourth preset number of preprocessed random numbers, each preprocessed random number including eight-bit preprocessed sub-random numbers arranged sequentially, the third preset number being less than the first preset number; and extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key to obtain the decryption key. In some embodiments, the decryption key is the same as the encryption key in the aforementioned step S1022.

[0159] In some embodiments, the step of extracting four-digit sub-random numbers from each random number of the first key to obtain the third key includes: extracting the first consecutive four-digit sub-random numbers from each random number of the first key, and sorting the first consecutive four-digit sub-random numbers of all extracted random numbers according to the order of each random number in the first key to obtain the third key, wherein the fourth preset quantity is half of the first preset quantity.

[0160] In some embodiments, the first four consecutive bits of each random number are either the high four bits or the low four bits of each random number. Obviously, the first four consecutive bits of each random number can also be any four consecutive bits of each random number, that is, the first four consecutive sub-random bits of each random number can also be any four consecutive sub-random bits of each random number.

[0161] In some embodiments, obtaining the decryption key by extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key includes: extracting the second consecutive four-bit preprocessed sub-random numbers from each preprocessed random number of the third key, and sorting the second consecutive four-bit preprocessed sub-random numbers of all extracted preprocessed random numbers according to the order of each preprocessed random number in the third key to obtain the decryption key, wherein the length of the decryption key is a target number of bytes, and the target number is one-quarter of the first preset number.

[0162] In some embodiments, the second four consecutive bits of each preprocessed random number are either the high four bits or the low four bits of each preprocessed random number. Obviously, the second four consecutive bits of each preprocessed random number can also be any four consecutive bits of each preprocessed random number, that is, the second four consecutive bits of the preprocessed sub-random number of each preprocessed random number can also be any four consecutive bits of the preprocessed sub-random number of each preprocessed random number.

[0163] In this embodiment, when the length of the target ciphertext data is equal to one-quarter of a first preset number of bytes, the first preset number of random numbers of the first key are extracted to obtain a third key with a length of one-half of a first preset number of bytes, and the third key is extracted to obtain an encryption key with a length of one-quarter of a first preset number of bytes. By performing these two extraction processes on the first key, a decryption key with a length equal to the length of the target ciphertext data is obtained. This realizes the flexible variation of the length of the decryption key according to the length of the target ciphertext data. Therefore, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device 200, reducing the transmission load of the transmission bus and avoiding data reception delays, packet loss, etc.

[0164] In some embodiments, the second processing module 60 processes the first key according to the length of the target ciphertext data to obtain a decryption key, including: when the second processing module 60 determines that the length of the target ciphertext data is a target number of bytes and the target number is greater than a fifth preset number, the second processing module 60 extracts a target number of consecutive random numbers from the first key to obtain the decryption key, wherein the fifth preset number is less than the first preset number. In some embodiments, the decryption key is the same as the encryption key in the aforementioned step S1023.

[0165] In some embodiments, the fifth preset quantity is one-quarter of the first preset quantity. In other embodiments, the fifth preset quantity may also be one-eighth, three-eighths, one-half, etc., of the first preset quantity.

[0166] In this embodiment, when the length of the target ciphertext data is greater than the fifth preset number of bytes, the target number of random numbers are extracted from the first key to obtain the decryption key. By truncating the first key, a decryption key with a length equal to the length of the target ciphertext data is obtained. This realizes the flexible variation of the length of the decryption key according to the length of the target ciphertext data. Thus, when transmitting data, shorter target ciphertext data can be sent to the second data transmission device 200, reducing the transmission load of the transmission bus and avoiding data reception delays, packet loss, etc.

[0167] In some embodiments, the second processing module 60 uses the decryption key to decrypt the target ciphertext data to obtain the target data, including: the second processing module 60 uses the decryption key to decrypt the target ciphertext data once to obtain the target data; or, the target ciphertext data is preprocessed to obtain first ciphertext data, and the first ciphertext data is decrypted using the decryption key to obtain the target data.

[0168] In some embodiments, the second processing module 60 uses the decryption key to decrypt the target ciphertext data once to obtain the target data, which may include: the second processing module 60 using the decryption key to perform an XOR operation on the target ciphertext data to obtain the target data.

[0169] In some embodiments, as described above, the target ciphertext data is obtained by encrypting the target data once using an encryption key. When the second data transmission device 200 decrypts the target ciphertext data, it can use the decryption key to decrypt the target ciphertext data once to obtain the target data. Obtaining the target data through a single decryption reduces the computational cost of the decryption process.

[0170] In other embodiments, as described above, the target ciphertext data is obtained by encrypting the target data once using an encryption key to obtain first ciphertext data, and then further processing the first ciphertext data to obtain the target ciphertext data. When decrypting the target ciphertext data, the second data transmission device 200 can preprocess the target ciphertext data to obtain the first ciphertext data, and then decrypt the first ciphertext data once using the decryption key to obtain the target data. In this embodiment, the process of obtaining the target data involves preprocessing the target ciphertext data to obtain the first ciphertext data and then decrypting the first ciphertext data to obtain the target data, which increases the complexity of the decryption process and the difficulty of decryption.

[0171] In some embodiments, the target ciphertext data includes a target number of sub-target ciphertext data, which are sequentially ordered, each sub-target ciphertext data having a length of one byte. The second processing module 60 preprocesses the target ciphertext data to obtain first ciphertext data, including:

[0172] The second processing module 60 concatenates the first and last parts of the target number of sub-target ciphertext data and shifts them along the second direction by a sixth preset number of positions to obtain the first ciphertext data, wherein the sixth preset number is less than or equal to the target number; or, the second processing module 60 uses the decryption key to decrypt the target ciphertext data to obtain the second ciphertext data, wherein the second ciphertext data includes the target number of sub-second ciphertext data, wherein the target number of sub-second ciphertext data are ordered sequentially, each sub-second ciphertext data having a length of one byte, and the first ciphertext data is obtained by concatenating the first and last parts of the target number of sub-second ciphertext data and shifting them along the second direction by a sixth preset number of positions.

[0173] The second direction is the opposite of the first direction mentioned above.

[0174] In some embodiments, the second processing module 60 uses the decryption key to decrypt the target ciphertext data to obtain the second ciphertext data, which may include: the second processing module 60 using the decryption key to perform an XOR operation on the target ciphertext data to obtain the second ciphertext data.

[0175] It should be noted that the second data transmission device 200 corresponds to the aforementioned second data transmission method. For a more detailed description, please refer to the contents of the various embodiments of the aforementioned second data transmission method. The contents of the second data transmission device 200 and the aforementioned second data transmission method can also be referred to each other.

[0176] This application also provides a vehicle, which includes the first data transmission device 100 provided in any of the foregoing embodiments and / or the second data transmission device 200 provided in any of the foregoing embodiments.

[0177] like Figure 5 As shown, in some embodiments, the vehicle 300 includes the first data transmission device 100 provided in any of the foregoing embodiments and the second data transmission device 200 provided in any of the foregoing embodiments. The first data transmission device 100 and the second data transmission device 200 may be independent transmission devices or integrated into a single data transmission device.

[0178] The first data transmission device 100 of the vehicle 300 provided in this application embodiment obtains the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is less than or equal to the length of the first key. Therefore, the length of the encryption key can be flexibly changed according to the length of the target data, so that the target ciphertext data obtained by encrypting with the encryption key is not too long, which can reduce the transmission load during transmission and avoid problems such as data reception delay and data packet loss.

[0179] The second data transmission device 200 of the vehicle 300 provided in this application embodiment obtains a decryption key with a length equal to that of the target ciphertext data by processing the first key according to the length of the target ciphertext data, so as to decrypt the target ciphertext data.

[0180] This application embodiment also provides a data transmission device, which includes a memory and a processor. The memory stores a computer program, which is executed by the processor to implement the aforementioned first data transmission method and / or the aforementioned second data transmission method.

[0181] The data transmission device provided in this application embodiment can obtain the encryption key by processing the first key according to the length of the target data, such that the length of the encryption key is less than or equal to the length of the first key. Therefore, the length of the encryption key can be flexibly changed according to the length of the target data, ensuring that the target ciphertext data obtained by encrypting with the encryption key is not too long. This reduces the transmission load during transmission and avoids problems such as data reception delay and data packet loss. And / or, a decryption key with a length equal to the target ciphertext data can be obtained by processing the first key according to the length of the target ciphertext data, for use in decrypting the target ciphertext data.

[0182] This application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the first data transmission method provided in any of the foregoing embodiments and / or the second data transmission method provided in any of the foregoing embodiments.

[0183] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage device, which may include: a flash drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk, etc.

[0184] The above are the implementation methods of the embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the embodiments of this application, and these improvements and modifications are also considered to be within the protection scope of this application.

Claims

1. A data transmission method applied to a data transmission device, the data transmission device being connected to a receiving end, the data transmission device storing target data, characterized in that, The data transmission method includes the following steps: Determine the length of the target data; An encryption key is obtained by processing the first key according to the length of the target data, wherein the length of the encryption key is greater than or equal to the length of the target data and less than or equal to the length of the first key; The target data is encrypted using the encryption key to obtain target ciphertext data, wherein the length of the target ciphertext data is equal to the length of the encryption key; and The target encrypted data is sent to the receiving end; Before processing the first key according to the length of the target data to obtain the encryption key, the data transmission method further includes: Generate a second key, which includes a first preset number of random numbers, the first preset number of random numbers being sorted sequentially, and each random number having a length of one byte; The first key is obtained by concatenating the first and last of a first preset number of random numbers of the second key and shifting them in the same direction by a second preset number of positions. The first key includes a first preset number of random numbers after being rearranged, wherein the second preset number is less than or equal to the first preset number.

2. The data transmission method according to claim 1, characterized in that, The first key includes a first preset number of random numbers, each random number being one byte in length. The step of processing the first key according to the length of the target data to obtain the encryption key includes: When the length of the target data is determined to be less than or equal to a third preset number of bytes, an encryption key of a length of a third preset number of bytes is extracted from the first key, wherein the third preset number is less than the first preset number.

3. The data transmission method according to claim 2, characterized in that, Each random number in the first key comprises an eight-bit sub-random number arranged in sequence. The process of processing the first key according to the length of the target data to obtain the encryption key includes: When the length of the target data is determined to be less than or equal to a third preset number of bytes, a third key is obtained by extracting four-bit sub-random numbers from each random number of the first key. The third key includes a fourth preset number of preprocessed random numbers, each of which includes eight-bit preprocessed sub-random numbers arranged in sequence. The third preset number is less than the first preset number. The encryption key is obtained by extracting the four-bit preprocessed sub-random number from each preprocessed random number of the third key.

4. The data transmission method according to claim 3, characterized in that, The step of extracting a four-bit sub-random number from each random number of the first key to obtain the third key includes: Extract the first four consecutive sub-random numbers of each random number in the first key, and sort the first four consecutive sub-random numbers of all extracted random numbers according to the order of each random number in the first key to obtain the third key. The fourth preset number is half of the first preset number. The encryption key is obtained by extracting four-bit preprocessed sub-random numbers from each preprocessed random number of the third key, including: Extract the second four consecutive preprocessed sub-random numbers of each preprocessed random number of the third key, and sort the second four consecutive preprocessed sub-random numbers of all extracted preprocessed random numbers according to the order of each preprocessed random number in the third key to obtain the encryption key. The length of the encryption key is a target number of bytes, and the target number is one-quarter of the first preset number.

5. The data transmission method according to claim 4, characterized in that, The first four consecutive bits of each random number are either the high four bits or the low four bits of each random number, and the second four consecutive bits of each preprocessed random number are either the high four bits or the low four bits of each preprocessed random number.

6. The data transmission method according to claim 2, characterized in that, The step of processing the first key according to the length of the target data to obtain the encryption key further includes: When the length of the target data is determined to be greater than a third preset number of bytes, the encryption key is obtained by extracting the target number of consecutive random numbers from the first key.

7. The data transmission method according to claim 1, characterized in that, The first key includes a first preset number of random numbers, each random number being one byte in length. The step of processing the first key according to the length of the target data to obtain the encryption key includes: When the length of the target data is determined to be the target number of bytes and the target number is greater than the fifth preset number, the encryption key is obtained by extracting the target number of consecutive random numbers from the first key, wherein the fifth preset number is less than the first preset number.

8. The data transmission method according to claim 1, characterized in that, The length of the encryption key is the target number of bytes, and the step of encrypting the target data using the encryption key to obtain the target ciphertext data includes: The target data is encrypted once using the encryption key to obtain the first ciphertext data as the target ciphertext data, or the first ciphertext data obtained by encrypting the target data once using the encryption key is further processed to obtain the target ciphertext data, wherein the length of the first ciphertext data is the target number of bytes.

9. The data transmission method according to claim 8, characterized in that, The first ciphertext data includes a target number of sub-first ciphertext data, which are ordered sequentially. Each sub-first ciphertext data has a length of one byte. The process of further processing the first ciphertext data obtained by encrypting the target data once with the encryption key to obtain the target ciphertext data includes: The first ciphertext data of the target number of sub-first ciphertext data are concatenated end to end and shifted along the first direction by a sixth preset number of positions to obtain the second ciphertext data as the target ciphertext data. The length of the second ciphertext data is the target number of bytes, and the sixth preset number is less than or equal to the target number; or The first ciphertext data of the target number of sub-first ciphertext data is concatenated end to end and shifted by a sixth preset number of positions along the first direction to obtain the second ciphertext data. The second ciphertext data is then encrypted using the encryption key to obtain the third ciphertext data, which is the target ciphertext data. The length of the third ciphertext data is the target number of bytes.

10. The data transmission method according to claim 2 or 7, characterized in that, The first preset quantity is sixty-four.

11. The data transmission method according to claim 7, characterized in that, The fifth preset quantity is one-quarter of the first preset quantity.

12. The data transmission method according to claim 2, characterized in that, The third preset quantity is one-quarter of the first preset quantity.

13. The data transmission method according to claim 1, characterized in that, The data transmission device is applied to the vehicle, and the generation of the second key includes: The second key is generated based on the timestamp, the vehicle's identification code, and a random function.

14. A data transmission method applied to a data transmission device, the data transmission device being connected to a transmitting end, the transmitting end storing target ciphertext data obtained by encrypting target data, characterized in that, The data transmission method includes the following steps: Upon receiving the target ciphertext data, determine the length of the target ciphertext data; A decryption key is obtained by processing the first key according to the length of the target ciphertext data, wherein the length of the decryption key is equal to the length of the target ciphertext data and less than or equal to the length of the first key; and The target data is obtained by decrypting the target ciphertext data using the decryption key. Before processing the first key according to the length of the target ciphertext data to obtain the decryption key, the data transmission method further includes: Generate a second key, which includes a first preset number of random numbers, the first preset number of random numbers being sorted sequentially, and each random number having a length of one byte; The first key is obtained by concatenating the first and last of a first preset number of random numbers of the second key and shifting them in the same direction by a second preset number of positions. The first key includes a first preset number of random numbers after being rearranged, wherein the second preset number is less than or equal to the first preset number.

15. The data transmission method according to claim 14, characterized in that, Each random number in the first key comprises an eight-bit sub-random number arranged in sequence. The process of processing the first key according to the length of the target ciphertext data to obtain the decryption key includes: When the length of the target ciphertext data is determined to be equal to a first preset number of bytes equal to one-quarter, a third key is obtained by extracting four-bit sub-random numbers from each random number of the first key. The third key includes a fourth preset number of preprocessed random numbers, and each preprocessed random number includes eight-bit preprocessed sub-random numbers arranged in sequence. The decryption key is obtained by extracting the four-bit preprocessed sub-random number from each preprocessed random number of the third key.

16. The data transmission method according to claim 15, characterized in that, The step of extracting a four-bit sub-random number from each random number of the first key to obtain the third key includes: Extract the first four consecutive sub-random numbers of each random number in the first key, and sort the first four consecutive sub-random numbers of all extracted random numbers according to the order of each random number in the first key to obtain the third key. The fourth preset number is half of the first preset number. The process of extracting a four-bit preprocessed sub-random number from each preprocessed random number of the third key to obtain the decryption key includes: Extract the second four consecutive preprocessed sub-random numbers of each preprocessed random number of the third key, and sort the second four consecutive preprocessed sub-random numbers of all extracted preprocessed random numbers according to the order of each preprocessed random number in the third key to obtain the decryption key. The length of the decryption key is the target number of bytes, and the target number is one-quarter of the first preset number.

17. The data transmission method according to claim 16, characterized in that, The first four consecutive bits of each random number are either the high four bits or the low four bits of each random number, and the second four consecutive bits of each preprocessed random number are either the high four bits or the low four bits of each preprocessed random number.

18. The data transmission method according to claim 14, characterized in that, The first key includes a first preset number of random numbers, each random number being one byte in length. The step of processing the first key according to the length of the target ciphertext data to obtain the decryption key includes: When the length of the target ciphertext data is determined to be the target number of bytes and the target number is greater than the fifth preset number, the decryption key is obtained by extracting the target number of consecutive random numbers from the first key, wherein the fifth preset number is less than the first preset number.

19. The data transmission method according to claim 14, characterized in that, The step of decrypting the target ciphertext data using the decryption key to obtain the target data includes: decrypting the target ciphertext data once using the decryption key to obtain the target data; or, preprocessing the target ciphertext data to obtain first ciphertext data, and decrypting the first ciphertext data using the decryption key to obtain the target data.

20. The data transmission method according to claim 19, characterized in that, The target ciphertext data includes a target number of sub-target ciphertext data, which are sequentially ordered. Each sub-target ciphertext data has a length of one byte. The preprocessing of the target ciphertext data to obtain the first ciphertext data includes: The first ciphertext data is obtained by concatenating the first and last parts of the target number of sub-target ciphertext data and shifting them along the second direction by a sixth preset number of positions, wherein the sixth preset number is less than or equal to the target number; or, the target ciphertext data is obtained by decrypting it using the decryption key, wherein the second ciphertext data includes the target number of sub-second ciphertext data, wherein the target number of sub-second ciphertext data are ordered sequentially, and each sub-second ciphertext data is one byte in length, wherein the first ciphertext data is obtained by concatenating the first and last parts of the target number of sub-second ciphertext data and shifting them along the second direction by a sixth preset number of positions.

21. The data transmission method according to claim 15 or 18, characterized in that, The first preset quantity is sixty-four.

22. The data transmission method according to claim 18, characterized in that, The fifth preset quantity is one-quarter of the first preset quantity.

23. The data transmission method according to claim 14, characterized in that, The data transmission device is applied to the vehicle, and the generation of the second key includes: The second key is generated based on the timestamp, the vehicle's identification code, and a random function.

24. A data transmission device, the data transmission device being connected to a receiving end, the data transmission device storing target data, characterized in that, The data transmission device includes: The processing module is configured to determine the length of the target data, process the first key according to the length of the target data to obtain an encryption key, wherein the length of the encryption key is greater than or equal to the length of the target data and less than or equal to the length of the first key, encrypt the target data using the encryption key to obtain target ciphertext data, wherein the length of the target ciphertext data is equal to the length of the encryption key, and control the sending of the target ciphertext data to the receiving end. The data transmission device further includes a generation module for generating a second key. The second key includes a first preset number of random numbers, which are sequentially sorted. Each random number has a length of one byte. The generation module is also used to concatenate the first preset number of random numbers of the second key and shift them in the same direction by a second preset number of positions to obtain the first key. The first key includes the first preset number of random numbers after reordering. The second preset number is less than or equal to the first preset number.

25. A data transmission apparatus, wherein the data transmission apparatus is connected to a transmitting end, the transmitting end storing target ciphertext data obtained by encrypting target data, characterized in that, The data transmission device includes: The processing module is configured to, upon receiving the target ciphertext data, determine the length of the target ciphertext data, process a first key according to the length of the target ciphertext data to obtain a decryption key, wherein the length of the decryption key is equal to the length of the target ciphertext data and less than or equal to the length of the first key, and use the decryption key to decrypt the target ciphertext data to obtain the target data. The data transmission device further includes a generation module for generating a second key. The second key includes a first preset number of random numbers, which are sequentially sorted. Each random number has a length of one byte. The generation module is also used to concatenate the first preset number of random numbers of the second key and shift them in the same direction by a second preset number of positions to obtain the first key. The first key includes the first preset number of random numbers after reordering. The second preset number is less than or equal to the first preset number.

26. A vehicle, characterized in that, The vehicle includes the data transmission device as described in claim 24 and / or the data transmission device as described in claim 25.

27. A data transmission device, characterized in that, The data transmission device includes a memory and a processor. The memory stores a computer program, which is executed by the processor to implement the data transmission method as described in any one of claims 1-13 and / or the data transmission method as described in any one of claims 14-23.

28. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is executed by a processor to implement the data transmission method as described in any one of claims 1-13 and / or the data transmission method as described in any one of claims 14-23.

Citation Information

Patent Citations

  • Variable-length key cryptosystem

    US20020101996A1