Device data encryption method, computer device, storage medium and program product
By generating a unique target key and dynamically encrypting vehicle ECU data using a random key pool file and a key index file, the problem of low data security in vehicle ECU devices is solved, achieving the effect of improving data security and cracking difficulty without changing the hardware.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2026-03-24
AI Technical Summary
In existing technologies, the data security of in-vehicle ECU devices already in use is low, and they cannot effectively prevent the illegal acquisition of sensitive information.
By generating a unique target key, using a random key pool file, random seed text, and key index file, a temporary in-memory variable is dynamically generated and hashed to encrypt device data, ensuring that the target key for each device is unique.
Without altering the device hardware, it improves the security and difficulty of cracking device data, enhances data protection capabilities, simplifies the management process, and maintains operational flexibility.
Smart Images

Figure CN119740247B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security technology, and in particular to a device data encryption method, computer equipment, storage medium, and program product. Background Technology
[0002] Today, vehicle ECUs (Electronic Control Units) store a lot of sensitive business data, such as communication keys, autonomous driving model files, driving history trajectories, and in-vehicle video recordings. If this business data is illegally obtained, it will cause automotive information security problems.
[0003] Traditional technologies require specialized hardware to protect sensitive information from unauthorized access. However, this approach is not applicable to already deployed vehicle ECUs that lack such specialized hardware.
[0004] It is evident that existing technologies still suffer from low data security in in-vehicle equipment already in use. Summary of the Invention
[0005] Therefore, it is necessary to provide a device data encryption method, computer device, storage medium, and program product that can improve the security of device data in response to the above-mentioned technical problems.
[0006] In a first aspect, this application provides a device data encryption method, the device data encryption method comprising:
[0007] In response to encryption commands, obtain the current device's random key pool file, random seed text, and key index file;
[0008] Based on the key index file and the random key pool file, generate a temporary memory variable;
[0009] Generate a target key based on the random seed text and the temporary memory variable;
[0010] The device data of the current device is encrypted based on the target key to obtain ciphertext data.
[0011] In one embodiment, the random key pool file is generated by a key pool generator outside the current device and burned into the current device; generating the random key pool file includes:
[0012] Generate a binary byte matrix based on a preset number of rows and columns;
[0013] Based on a random number generator, binary data for each element in the binary byte matrix is generated sequentially to obtain a random key pool file; the binary data is a random number of a preset byte size.
[0014] In one embodiment, obtaining the current device's random key pool file, random seed text, and key index file includes:
[0015] Retrieve the current device's random key pool file and random seed text;
[0016] Based on the matrix dimensions of the random key pool file and the random number generator, a key index file is generated.
[0017] In one embodiment, generating a key index file based on the matrix dimensions of the random key pool file and a random number generator includes:
[0018] Based on the random number generator, a first random value and a second random value are generated;
[0019] The random index x-coordinate is obtained by performing a modulo operation on the matrix column number of the random key pool file and the first random value.
[0020] The random index ordinate is obtained by performing a modulo operation on the matrix row number of the random key pool file and the second random value;
[0021] The key index file is obtained based on the horizontal and vertical coordinates of the random index.
[0022] In one embodiment, generating a temporary memory variable based on the key index file and the random key pool file includes:
[0023] The data selection range is determined based on the key index file;
[0024] Select some or all of the data in the random key pool file that corresponds to the data selection range to obtain a temporary memory variable.
[0025] In one embodiment, generating the target key based on the random seed text and the temporary memory variable includes:
[0026] The concatenated data is obtained by concatenating the random seed text and the temporary memory variable.
[0027] The target key is generated by performing a hash operation on the concatenated data.
[0028] In one embodiment, after generating the target key based on the random seed text and the memory temporary variable, the process further includes:
[0029] Delete the aforementioned temporary memory variable.
[0030] Secondly, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0031] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0032] Fourthly, this application provides a computer program product that, when executed by a processor, implements the method described above.
[0033] The aforementioned device data encryption method, computer equipment, storage medium, and program product, in response to an encryption command, obtain the current device's random key pool file, random seed text, and key index file; generate a temporary memory variable based on the key index file and the random key pool file; generate a target key based on the random seed text and the temporary memory variable; and encrypt the device data of the current device based on the target key to obtain ciphertext data. This method enables the encryption of business data without requiring hardware upgrades. Since the encryption key is generated based on the random seed text, random key pool file, and key index file, it ensures that the target key for each device is unique, achieving one key per device. This effectively increases the difficulty for third parties to crack the encryption, thereby improving device data security. Attached Figure Description
[0034] Figure 1 This is a diagram illustrating the application environment of a device data encryption method in one embodiment;
[0035] Figure 2 This is a flowchart illustrating a device data encryption method in one embodiment;
[0036] Figure 3 This is a schematic diagram of the process for generating a random key pool file in one embodiment.
[0037] Figure 4 This is a schematic diagram of the process for generating the target key in one embodiment;
[0038] Figure 5 This is a flowchart illustrating a device data encryption method in another embodiment;
[0039] Figure 6 This is a structural block diagram of a device data encryption device in one embodiment;
[0040] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0042] The device data encryption method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, it is understood that the device data encryption in this application can be limited to, but is not limited to, device data encryption of vehicle electronic control units (ECUs), and can also be applied to data encryption of other terminals. Terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated on server 104 or placed on the cloud or other network servers. In response to an encryption command, terminal 102 obtains the current device's random key pool file, random seed text, and key index file; based on the key index file and random key pool file, it generates a temporary memory variable; based on the random seed text and the temporary memory variable, it generates a target key; and based on the target key, it encrypts the current device's data to obtain ciphertext data. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.
[0043] In one embodiment, such as Figure 2 As shown, a device data encryption method is provided, which can be applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps:
[0044] Step S100: In response to the encryption command, obtain the random key pool file, random seed text, and key index file of the current device.
[0045] The random key pool file can be a pre-generated set of random keys stored in a protected storage location. These random keys can be used for subsequent encryption operations. The random key pool file can be generated by a key pool generator on an external device or by a key pool generator within the device.
[0046] The random seed text can be a random value generated by a random number generator. For example, the initial encryption can be based on an encryption instruction, and the random seed text is saved. When re-encrypting new device data or decrypting ciphertext data, the method steps of this embodiment are performed by obtaining the random seed text to generate the target key. Furthermore, when the random seed text needs to be updated, the target key can be generated and decrypted based on the original random seed text, and then a new random seed text is generated to generate an updated target key, which is then used for encryption.
[0047] The key index file is used to indicate how to select one or more keys from a random key pool file to generate the target key. It may include selection rules for one or more keys, or provide information that matches the device's built-in selection rules. For example, when it is known that the current device includes three built-in selection rules, the key index file provides information that matches the device's selection rules. This may be recording the number of one of the key selection rules, so that the current device obtains the key according to the selected built-in key selection rule.
[0048] By introducing diverse key sources, it becomes more difficult for attackers to crack the keys, thereby improving data security.
[0049] Step S200: Generate a temporary memory variable based on the key index file and the random key pool file.
[0050] The process of selecting a suitable key or key combination from the random key pool file and loading it into memory as a temporary variable can be achieved by retrieving the required data from the random key pool file based on a key index file, thus obtaining the in-memory temporary variable. This in-memory temporary variable can include some or all of the candidate keys from the random key pool file. Furthermore, after obtaining the required data, further processing can be performed on the data, such as modulo operations or hash operations, to obtain the in-memory temporary variable.
[0051] The target key is generated by extracting multiple bytes from the random key pool file using a key index file. This process, along with extracting bytes from the random key pool file using the key index file, makes it difficult for third parties to obtain the complete target key when analyzing the device. Compared to hardcoding the key into the device, this significantly increases the difficulty for third parties to analyze and obtain the target key. Dynamically constructing temporary keys reduces the risks associated with long-term storage of a single fixed key while maintaining the flexibility and security of the encryption process. Loading these temporary keys into memory as temporary variables reduces the risk of directly exposing the key; these temporary variables are cleared after the target key is generated.
[0052] Step S300: Generate a target key based on the random seed text and the temporary memory variable.
[0053] This can involve extracting a portion or all of the random seed text and temporary memory variables according to preset rules, and then using an encryption algorithm to generate the target key. The encryption algorithm can be, for example, a hash function or other form of key derivation function, and is not limited to this embodiment.
[0054] Step S400: Encrypt the device data of the current device based on the target key to obtain ciphertext data.
[0055] Device data refers to the sensitive data in the current device that needs to be encrypted. For example, device data may include communication keys used for communication and interaction with other devices, autonomous driving model files, driving history trajectories, in-vehicle video recordings, and other business data. For instance, when the communication key needs to be encrypted as device data, a target key is generated using the current device's random key pool file, random seed text, and key index file. The communication key is then encrypted using the target key to obtain ciphertext data.
[0056] Encryption using a selected target key ensures that ciphertext data can only be decrypted if the target key is correct. Device data can be encrypted using a symmetric encryption algorithm with the target key to obtain ciphertext data.
[0057] Furthermore, when device data is needed, a target key can be generated using the current device's random key pool file, random seed text, and key index file. The encrypted data can then be decrypted using this target key to obtain the device data, which can then be used and further processed.
[0058] The device data of the current device is encrypted based on the target key to obtain ciphertext data. This can be done using symmetric encryption, where the device data is encrypted with the target key so that the resulting ciphertext data cannot be read directly.
[0059] Understandably, after obtaining the encrypted data, the process also includes deleting the target key from the device's memory to prevent attackers from obtaining the target key by reading memory.
[0060] This embodiment provides a device data encryption method that, in response to an encryption command, obtains a random key pool file, a random seed text, and a key index file for the current device; generates a temporary memory variable based on the key index file and the random key pool file; generates a target key based on the random seed text and the temporary memory variable; and encrypts the device data of the current device based on the target key to obtain ciphertext data. This method enables the encryption of business data without requiring hardware upgrades. Since the encryption key is generated based on the random seed text, the random key pool file, and the key index file, it ensures that the target key for each device is unique, achieving one key per device. This effectively increases the difficulty for third parties to crack the encryption, thereby improving device data security.
[0061] In one embodiment, generating the random key pool file includes:
[0062] Generate a binary byte matrix based on a preset number of rows and columns;
[0063] Based on a random number generator, binary data for each element in the binary byte matrix is generated sequentially to obtain a random key pool file; the binary data is a random number of a preset byte size.
[0064] The random key pool file is generated by a key pool generator outside the current device and burned into the current device.
[0065] The random key pool file consists of a binary byte matrix. This matrix contains a preset number of rows × a preset number of columns of key elements, ensuring that the random key pool file contains a preset number of independent keys or key fragments. Each element can be represented using binary data.
[0066] A binary byte matrix can be generated based on a preset number of rows and columns, or an empty matrix of the corresponding size can be created based on a predetermined preset number of rows and columns.
[0067] A random number generator is an algorithm or hardware device used to generate truly random or pseudo-random values. By generating random numbers, the randomness and security of keys can be further improved.
[0068] The preset byte size can be the space occupied by each element. For example, random numbers can be generated using a length of one byte or two bytes. The length of binary data can be set according to actual needs, and this embodiment does not limit it.
[0069] By filling the created empty matrix with a verified random number generator, it can be ensured that every part of the key pool file is highly unpredictable. If the quality of the random number generator is high enough, the key pool file will be difficult to guess or copy.
[0070] Furthermore, the random key pool file can also provide information on the preset number of rows and columns before the matrix, so that the relevant information of the random key pool file can be obtained more efficiently when generating the target key, thereby improving the speed of generating the target key.
[0071] This embodiment provides a device data encryption method that generates binary data for each element in the binary byte matrix sequentially using a random number generator to obtain a random key pool file. The binary data is a random number of a preset byte size, which can significantly increase the difficulty for attackers to try to obtain the target key, and can improve data protection capabilities without changing the existing vehicle ECU hardware, thereby improving device data security.
[0072] In one embodiment, obtaining the current device's random key pool file, random seed text, and key index file includes:
[0073] Retrieve the current device's random key pool file and random seed text;
[0074] Based on the matrix dimensions of the random key pool file and the random number generator, a key index file is generated.
[0075] In this embodiment, the key index file is based on the matrix dimension of the random key pool and a random number generator. The matrix dimension is the number of rows and columns of the binary byte matrix in the random key pool file. With the row and column number information added to the preface of the random key pool file, the matrix dimension information can be obtained directly by reading the row and column numbers, thus eliminating the need to traverse the binary byte matrix to determine the matrix dimension, thereby improving the efficiency of target key generation.
[0076] The key index file may include one or more index coordinates, each of which can be used to index a specific element in the random key pool file. For example, the maximum value of the index x-coordinate and index y-coordinate can be determined based on the matrix dimensions of the random key pool file, thereby generating one or more index coordinates within the maximum value range using a random number generator. Further, the number of index coordinates to be generated can be determined based on a preset number of coordinates, and then the index coordinates can be generated.
[0077] When multiple index coordinates exist, the binary data corresponding to each index coordinate can be obtained separately, these binary data can be concatenated, and further processed, such as by hashing, to obtain a temporary memory variable; alternatively, the data at a specific position in the binary data corresponding to each index coordinate can be obtained separately and concatenated to obtain a temporary memory variable; other methods can also be used to obtain a temporary memory variable using multiple index coordinates, which are not limited in this embodiment.
[0078] This embodiment provides a device data encryption method that, by dynamically generating a key index file and combining it with a static random key pool file and a random seed text, not only improves the security of the data encryption process but also maintains a certain degree of operational flexibility. It can enhance data protection capabilities without changing existing hardware, thereby improving device data security.
[0079] In one embodiment, generating a key index file based on the matrix dimensions of the random key pool file and a random number generator includes:
[0080] Based on the random number generator, a first random value and a second random value are generated;
[0081] The random index x-coordinate is obtained by performing a modulo operation on the matrix column number of the random key pool file and the first random value.
[0082] The random index ordinate is obtained by performing a modulo operation on the matrix row number of the random key pool file and the second random value;
[0083] The key index file is obtained based on the horizontal and vertical coordinates of the random index.
[0084] In this embodiment, random index x-coordinates and random index y-coordinates are obtained through modulo operations, ensuring that neither the random index x-coordinates nor the random index y-coordinates exceed the dimension of the binary byte matrix. The first random value and the second random value can be random values generated within a preset numerical range.
[0085] The key index file is obtained based on the random index horizontal coordinate and the random index vertical coordinate. This can be achieved by combining the random index horizontal coordinate and the random index vertical coordinate to obtain the index coordinates, and then writing them into the key index file.
[0086] It is understandable that multiple sets of first and second random values can be generated based on a random number generator, and modulo operations can be performed on the number of matrix columns and the number of matrix rows respectively to obtain multiple index coordinates, so that the key index file includes multiple index coordinates.
[0087] This embodiment provides a device data encryption method that randomly selects key positions in a key pool, making it difficult for attackers to guess the actual key used even if they have access to the random key pool file. This avoids storing a large amount of fixed key index information, saves storage space, simplifies the management process, and maintains good flexibility and efficiency, thereby improving device data security.
[0088] In one embodiment, generating a temporary memory variable based on the key index file and the random key pool file includes:
[0089] The data selection range is determined based on the key index file;
[0090] Select some or all of the data in the random key pool file that corresponds to the data selection range to obtain a temporary memory variable.
[0091] When there is only one index coordinate in the key index file, the first or second part of the random key pool file divided by the index coordinate can be selected as the data selection range.
[0092] In one specific embodiment, when the matrix has 6 rows and 6 columns, and the index coordinates are (3, 2), when selecting the first part, the range within 3 rows and 2 rows of the byte matrix can be selected as the data selection range, or the range of the first 2 rows and the range of the 1st to 2nd columns of the 3rd row of the byte matrix can be selected as the data selection range; when selecting the second part, the data outside the range of 3 rows and 2 rows of the byte matrix can be selected as the selected data, or all the data in the 3rd to 6th columns of the 3rd row and the 4th to 6th rows can be selected.
[0093] When the key index file contains multiple index coordinates, the corresponding element in the random key pool file can be selected sequentially based on each index coordinate.
[0094] Select a portion or all of the data in the random key pool file that corresponds to the data selection range to obtain a temporary memory variable. Selecting a portion of the data corresponding to the data selection range can involve selecting data from a specific position within each element to obtain the temporary memory variable.
[0095] The temporary memory variable is obtained based on the selected data, which can be obtained by concatenating multiple data sets. Furthermore, the concatenation order of the multiple data sets can be based on the arrangement of elements in the random key pool file, the arrangement of multiple index coordinates in the key index file, or other preset arrangements before concatenation.
[0096] This embodiment provides a device data encryption method that obtains a temporary memory variable by selecting part or all of the data corresponding to the data selection range in the random key pool file. This allows for the efficient and secure extraction of necessary key materials from the pre-prepared random key pool file, improving the security of data processing and optimizing memory usage efficiency, thereby enhancing the security of device data.
[0097] In one embodiment, generating the target key based on the random seed text and the temporary memory variable includes:
[0098] The concatenated data is obtained by concatenating the random seed text and the temporary memory variable.
[0099] The target key is generated by performing a hash operation on the concatenated data.
[0100] One approach is to concatenate the random seed text and the temporary memory variable into a new data string or string. Another approach is to alternately insert data based on the random seed text and the temporary memory variable to obtain alternately inserted data; and then perform a hash operation based on the alternately inserted data to generate the target key.
[0101] Hash operations can be performed using existing secure hash functions, such as SHA-256 and SHA-3.
[0102] The key obtained after hashing is the target key, which represents a unique digest of the input data.
[0103] This embodiment provides a device data encryption method that combines random seed text and temporary memory variables, and performs hash operations to generate a target key that is not only difficult to guess, but also may be different each time it is generated. This increases the complexity and security of the system. Furthermore, when the input data is the same, it can ensure the consistency of the target key during the encryption and decryption process, thereby improving the security and stability of device data.
[0104] In one embodiment, after generating the target key based on the random seed text and the memory temporary variable, the process further includes:
[0105] Delete the aforementioned temporary memory variable.
[0106] Deleting temporary variables in memory can be done by overwriting or clearing them, or by using safe deletion algorithms or library functions.
[0107] This embodiment provides a device data encryption method that deletes the temporary memory variables. Since the temporary memory variables are used to generate the target key, deleting the temporary memory variables after generating the target key helps prevent attackers from obtaining sensitive information by means of memory swapping or side-channel attacks. Even if attackers can access the device's physical memory, it is difficult to recover useful information, reducing the attack surface and thus improving the security and stability of device data.
[0108] To more clearly illustrate the technical solution of this application, a detailed embodiment is also provided.
[0109] In one embodiment, a device data encryption method is provided, comprising:
[0110] I. Firmware Packaging and Burning Stage
[0111] The KPF (Key Pool File) is packaged into the firmware of the vehicle ECU and entered into the vehicle ECU during the firmware flashing process. The randomness and business independence of the KPF ensure that attackers cannot obtain the encryption key by analyzing the firmware package of the vehicle ECU (for example, it is impossible to obtain valid key information from the KPF by searching for strings).
[0112] Step S1.1, the generation process of KPF.
[0113] The maximum KPF is generated based on the available storage space of the vehicle's ECU. A larger KPF results in a longer timeframe for attackers to analyze the key. The main purpose of generating the KPF outside the vehicle is to leverage more random number generation systems, including professional true random number generators, compared to the ECU's internal random number generation capabilities. KPF generation is implemented using a Key Pool Generator (KPG), and the KPG execution steps are as follows:
[0114] a. Initialize a file to store the contents of KPF. The first line of the file records the row size (M) of the binary random byte matrix, the second line records the column size (N) of the binary random byte matrix, and the third line begins to store the contents of the binary random byte matrix.
[0115] b. A random number generator generates a 1-byte random number each time and stores it sequentially in positions 1×1, 1×2, ..., 1×N, ..., M×N;
[0116] c. Output matrix data as a KPF file.
[0117] Step S1.2: Package the KPF into the vehicle ECU firmware to form the final firmware for burning the vehicle ECU.
[0118] Step S1.3: Write the KPF data into the ECU's storage using ECU programming methods such as production line programming or OTA.
[0119] II. Vehicle ECU Key Initialization Phase
[0120] The main task of the vehicle ECU key initialization phase is to generate a random seed text (seed) and a key index file (KIF). Then, using the Multi-Dimensional Key Derivator (MDKD) with the random seed text (seed), key index file (KIF), and random key pool file (KPF) as input parameters, it generates the target key (WK) used in the third and fourth phases. Since the random seed text (seed) and KIF are independently generated within the ECU, each vehicle ECU generates a unique WK. The specific process is as follows:
[0121] Step S2.1: Generate a random seed text and store it in the ECU's storage for use when generating the target key (WK) next time. The ECU uses a random number generator to generate a 32-byte random number and stores it in the ECU's internal storage medium. Since the random seed text is generated independently by each ECU, it ensures that the target key (WK) generated by each ECU is different.
[0122] like Figure 3 As shown, step S2.2 generates a key index file KIF and stores it in the ECU's storage for use when generating the target key WK next time, including:
[0123] Step S2.2.1: Read the M in the first line and the N in the second line of the random key pool file KPF stored in the ECU storage in step S1.3.
[0124] Step S2.2.2 involves generating a 32-byte random number InRandom using a random number generator. Since each InRandom is generated independently by the ECU, it ensures that the WK generated by each ECU is different.
[0125] Step S2.2.3: Calculate the random index vertical coordinate RowStartbit = InRandom mode M, the random index horizontal coordinate ColumnStartbit = InRandom mode N, and delete InRandom to prevent attackers from performing memory dump attacks.
[0126] Step S2.2.4: Write the above random index vertical coordinate RowStartbit and random index horizontal coordinate ColumnStartbit into the key index file KIF, and store the key index file KIF in the internal storage of the ECU.
[0127] Next, the target key WK for use in stages three and four is generated by using the multidimensional key generator MDKD with random seed text seed, key index file KIF and random key pool file KPF as input parameters.
[0128] Step S2.3, generate a temporary memory variable bytes2bit-Matrix, including:
[0129] Step S2.3.1: Initialize a structure in memory, denoted as bytes2bit-Matrix.
[0130] Step S2.3.2: Read the key index file KIF generated in step S2.2, and store the random index horizontal coordinate RowStartbit and the random index vertical coordinate ColumnStartbit into a temporary memory structure, namely the index coordinates (RowStartbit, ColumnStartbit).
[0131] Step S2.3.3: Read all data after (RowStartbit, ColumnStartbit) in the third part of the random key pool file KPF stored in the ECU storage in step S1.3, and store it in the memory temporary variable bytes2bit-Matrix.
[0132] like Figure 4 As shown, step S2.4, generating WK, includes:
[0133] Step S2.4.1: Initialize a temporary variable WK in memory to store the following calculation results.
[0134] Step S2.4.2: Read step S2.1 and determine the seed value in the random seed text seed.
[0135] Step S2.4.3: Store the calculation result of the common input hash function of the bytes2bit-Matrix generated in step S2.3.3 in the target key WK.
[0136] Step S2.4.4: Delete the temporary memory variable bytes2bit-Matrix to prevent attackers from performing memory dump attacks.
[0137] III. Business Data Encryption Phase
[0138] The main task of the business encryption phase is to use the WK generated in the key generation phase as the target key to encrypt the business data (textdata) into ciphertext data (encryptedata). Then, the ciphertext data (encryptedata) is stored in the ECU's storage, and the target key WK is deleted to prevent memory dump attacks by attackers, as well as the business data (textdata). In this embodiment, the business data is the device data.
[0139] IV. Business Data Decryption Phase
[0140] The main task of the business encryption / decryption section is to use the WK generated in the key generation stage as the key to decrypt the encrypted data into business data and delete the WK to prevent attackers from performing memory dump attacks.
[0141] It is understood that the random key pool file (KPF) in this application can be generated externally to the vehicle ECU or internally. The random seed text can be a random number generated internally by the vehicle ECU, or it can be replaced by the hardware ID of the vehicle ECU.
[0142] In one specific embodiment, before the Autonomous Driving System (ADS) is installed in the vehicle, there is a business requirement that the communication key SecocKey for Security Onboard Communication (SecOC) must not be stored in plaintext. Therefore, the communication key SecocKey can be used as device data to execute the device data encryption method of any embodiment in this application, such as... Figure 5 As shown, specifically, this can be achieved in the ADS firmware system and related packaging and distribution systems:
[0143] In the KPF packaging to ADS firmware stage: the key pool generator (KPG) function is implemented in the packaging and release system, and the information security administrator uses KPG to generate the necessary random key pool file (KPF).
[0144] The ADS internal target key generation MK stage: ADS internally implements the generation of the key index file KIF, the random seed text seed, and the generation of the target key WK through the multidimensional key deriver MDKD, as well as the configuration of the general standard AES-256 encryption algorithm.
[0145] Encryption and decryption stage of equipment data: When the production line injects equipment data SeccKey into ADS, the ADS system uses the generated target key WK as the encryption key to encrypt SeccKey. The encrypted equipment data SeccKey generates ciphertext data EncryptoSecocKey, which is stored in the internal flash of ADS. At the same time, the target WK and intermediate process data are cleared from memory.
[0146] When ADS needs to use device data SecocKey, it can use the same method as in step S2 to calculate the target key WK temporarily, use the AES-256 decryption algorithm, use WK as the key and EncryptoSecocKey as the ciphertext to decrypt and obtain the device data SecocKey, and delete the target key WK and process data at the same time. The ADS system uses the device data SecocKey for normal business, and deletes the device data SecocKey after the execution is completed.
[0147] This embodiment provides a device data encryption method that, in response to an encryption command, obtains the current device's random key pool file, random seed text, and key index file; generates a temporary memory variable based on the key index file and the random key pool file; generates a target key based on the random seed text and the temporary memory variable; and encrypts the device data of the current device based on the target key to obtain ciphertext data. This method enables the encryption of business data without requiring hardware upgrades. Since the encryption key is generated based on the random seed text, random key pool file, and key index file, it ensures that the target key for each device is unique, achieving one key per device, thus effectively increasing the difficulty for third parties to crack the encryption and improving device data security. The method also involves generating binary data for each element in the binary byte matrix sequentially using a random number generator to obtain the random key pool file. The binary data is a random number of a preset byte size, significantly increasing the difficulty for attackers to obtain the target key and improving data protection capabilities without altering the existing vehicle ECU hardware, thereby enhancing device data security. Furthermore, by dynamically generating the key index file and combining it with the static random key pool file and random seed text, the method effectively prevents data encryption. This approach not only enhances the security of the data encryption process but also maintains a certain degree of operational flexibility. It can improve data protection capabilities without altering existing hardware, thus improving device data security. By randomly selecting key positions in the key pool, even if an attacker has access to the random key pool file, it remains difficult to guess the actual key used. This avoids storing large amounts of fixed key index information, saving storage space, simplifying management, and maintaining good flexibility and efficiency, thereby improving device data security. By selecting part or all of the data in the random key pool file corresponding to the selected data range to obtain a temporary memory variable, the necessary key material can be extracted efficiently and securely from the pre-prepared random key pool file, improving data processing security and optimizing memory usage efficiency, thus enhancing device data security. By combining a random seed text and a temporary memory variable, and performing a hash operation, the generated target key is not only difficult to guess but also potentially different each time it is generated. This increases system complexity and security, and ensures the consistency of the target key during encryption and decryption when the input data is the same, thereby improving device data security and stability.By deleting the temporary memory variables, which are used to generate the target key, it helps prevent attackers from obtaining sensitive information through memory dumping or side-channel attacks. Even if an attacker gains access to the device's physical memory, it is difficult to recover useful information, reducing the attack surface and thus improving the device's data security and stability.
[0148] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0149] Based on the same inventive concept, this application also provides a device data encryption apparatus for implementing the device data encryption method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more device data encryption apparatus embodiments provided below can be found in the limitations of the device data encryption method described above, and will not be repeated here.
[0150] In one embodiment, such as Figure 6 As shown, a device data encryption apparatus is provided, comprising: an acquisition module, a generation module, a key module, and an encryption module, wherein:
[0151] The acquisition module is used to acquire the random key pool file, random seed text, and key index file of the current device in response to encryption commands;
[0152] The generation module is used to generate temporary memory variables based on the key index file and the random key pool file;
[0153] A key module is used to generate a target key based on the random seed text and the temporary memory variable;
[0154] The encryption module is used to encrypt the device data of the current device based on the target key to obtain ciphertext data.
[0155] In one embodiment, the random key pool file is generated by a key pool generator outside the current device and burned into the current device; generating the random key pool file includes:
[0156] Generate a binary byte matrix based on a preset number of rows and columns;
[0157] Based on a random number generator, binary data for each element in the binary byte matrix is generated sequentially to obtain a random key pool file; the binary data is a random number of a preset byte size.
[0158] In one embodiment, the acquisition module is further configured to:
[0159] Retrieve the current device's random key pool file and random seed text;
[0160] Based on the matrix dimensions of the random key pool file and the random number generator, a key index file is generated.
[0161] In one embodiment, the acquisition module is further configured to:
[0162] Based on the random number generator, a first random value and a second random value are generated;
[0163] The random index x-coordinate is obtained by performing a modulo operation on the matrix column number of the random key pool file and the first random value.
[0164] The random index ordinate is obtained by performing a modulo operation on the matrix row number of the random key pool file and the second random value;
[0165] The key index file is obtained based on the horizontal and vertical coordinates of the random index.
[0166] In one embodiment, the generation module is further configured to:
[0167] The data selection range is determined based on the key index file;
[0168] Select some or all of the data in the random key pool file that corresponds to the data selection range to obtain a temporary memory variable.
[0169] In one embodiment, the key module is further configured to:
[0170] The concatenated data is obtained by concatenating the random seed text and the temporary memory variable.
[0171] The target key is generated by performing a hash operation on the concatenated data.
[0172] In one embodiment, the key module is further configured to:
[0173] Delete the aforementioned temporary memory variable.
[0174] Each module in the aforementioned data encryption device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0175] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores a random key pool file, a random seed text, and a key index file. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a device data encryption method.
[0176] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0177] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the device data encryption method of any of the above embodiments.
[0178] In response to encryption commands, obtain the current device's random key pool file, random seed text, and key index file;
[0179] Based on the key index file and the random key pool file, generate a temporary memory variable;
[0180] Generate a target key based on the random seed text and the temporary memory variable;
[0181] The device data of the current device is encrypted based on the target key to obtain ciphertext data.
[0182] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the device data encryption method of any of the above embodiments:
[0183] In response to encryption commands, obtain the current device's random key pool file, random seed text, and key index file;
[0184] Based on the key index file and the random key pool file, generate a temporary memory variable;
[0185] Generate a target key based on the random seed text and the temporary memory variable;
[0186] The device data of the current device is encrypted based on the target key to obtain ciphertext data.
[0187] In one embodiment, a computer program product is provided, wherein when the computer program is executed by a processor, it implements the device data encryption method of any of the above embodiments:
[0188] In response to encryption commands, obtain the current device's random key pool file, random seed text, and key index file;
[0189] Based on the key index file and the random key pool file, generate a temporary memory variable;
[0190] Generate a target key based on the random seed text and the temporary memory variable;
[0191] The device data of the current device is encrypted based on the target key to obtain ciphertext data.
[0192] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0193] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0194] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0195] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for encrypting device data, characterized in that, The device data encryption method includes: In response to an encryption command, the system obtains the current device's random key pool file, random seed text, and key index file; obtaining the current device's random key pool file, random seed text, and key index file includes: obtaining the current device's random key pool file and random seed text; and generating a key index file based on the matrix dimensions of the random key pool file and a random number generator; Based on the key index file and the random key pool file, a temporary memory variable is generated; the generation of the temporary memory variable based on the key index file and the random key pool file includes: determining a data selection range based on the key index file; selecting part or all of the data in the random key pool file that corresponds to the data selection range to obtain the temporary memory variable; Generate a target key based on the random seed text and the temporary memory variable; The device data of the current device is encrypted based on the target key to obtain ciphertext data.
2. The device data encryption method according to claim 1, characterized in that, The random key pool file is generated by a key pool generator outside the current device and burned into the current device; Generating the random key pool file includes: Generate a binary byte matrix based on a preset number of rows and columns; Based on a random number generator, binary data for each element in the binary byte matrix is generated sequentially to obtain a random key pool file; the binary data is a random number of a preset byte size.
3. The device data encryption method according to claim 1, characterized in that, The key index file is generated based on the matrix dimension and random number generator of the random key pool file, including: Based on the random number generator, a first random value and a second random value are generated; The random index x-coordinate is obtained by performing a modulo operation on the matrix column number of the random key pool file and the first random value. The random index ordinate is obtained by performing a modulo operation on the matrix row number of the random key pool file and the second random value; The key index file is obtained based on the horizontal and vertical coordinates of the random index.
4. The device data encryption method according to claim 1, characterized in that, The generation of the target key based on the random seed text and the temporary memory variable includes: The concatenated data is obtained by concatenating the random seed text and the temporary memory variable. The target key is generated by performing a hash operation on the concatenated data.
5. The device data encryption method according to claim 1, characterized in that, After generating the target key based on the random seed text and the temporary memory variable, the process further includes: Delete the aforementioned temporary memory variable.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 5.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 5.
8. A computer program product, characterized in that, When the computer program product is executed by a processor, it implements the method of any one of claims 1 to 5.
Citation Information
Patent Citations
5G module based on quantum key, communication system, method and application
CN115567204A
Data transmission management method, and data processing method and apparatus
WO2024060630A1