A data processing method, system, computer program product, device and medium
By using the combination and redundancy mechanism of built-in key memory and external key memory in the data processing method, the data encryption and decryption stability problem caused by key memory failure is solved, and higher key acquisition stability and data encryption and decryption operation stability are achieved.
Patent Information
- Application Number
- CN202411996505.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-12-30
AI Technical Summary
In the prior art, the key memory may fail the key due to loss of contact or deletion operations, resulting in poor stability of the data encryption and decryption operations.
Provide a data processing method, through the combination and redundancy mechanism of built-in key memory and external key memory, to ensure that even if a single key memory is abnormal, the target key can be restored through redundant results, thereby achieving the stability of data encryption and decryption operations.
It improves the stability of obtaining keys, avoids the situation where the key cannot be obtained when a single key memory is abnormal, and thus improves the stability of data encryption and decryption operations.
Smart Images

Figure CN119397583B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data security technology, and more specifically, to a data processing method, system, computer program product, device and medium. Background Art
[0002] Currently, the key can be stored in a key storage device. When data needs to be encrypted or decrypted, the key is read from the key storage device to perform the corresponding operation on the data. However, the key storage device may become invalid due to loss of connection or deletion, making it impossible to encrypt or decrypt the data, resulting in poor stability of the data encryption and decryption operation.
[0003] In summary, how to improve the stability of obtaining keys is a problem that currently needs to be solved urgently by those skilled in the art. Summary of the invention
[0004] The purpose of the present invention is to provide a data processing method, which can solve the technical problem of how to improve the stability of obtaining a key to a certain extent. The present invention also provides a data processing system, a computer program product, an electronic device and a computer-readable storage medium.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] In a first aspect, a data processing method is provided, comprising:
[0007] Obtain target data to be processed;
[0008] In response to the built-in key memory and the external key memory being normal, obtaining the first key data stored in the built-in key memory, obtaining the second key data stored in the external key memory, and combining the first key data and the second key data to obtain a target key;
[0009] In response to the built-in key memory being normal and the external key memory being abnormal, acquiring the first key data and the first key redundancy result stored in the built-in key memory, and restoring the target key according to the first key data and the first key redundancy result;
[0010] In response to the built-in key memory being abnormal and the external key memory being normal, acquiring the second key data and the second key redundancy result stored in the external key memory, and restoring the target key according to the second key data and the second key redundancy result;
[0011] Processing the target data based on the target key;
[0012] Among them, the first key redundancy result includes the result obtained after redundancy of the second key data; the second key redundancy result includes the result obtained after redundancy of the first key data.
[0013] On the other hand, before obtaining the target data to be processed, it also includes:
[0014] generating the target key;
[0015] Encrypting the target key to obtain an encryption key;
[0016] Splitting the encryption key into a first encryption subkey and a second encryption subkey;
[0017] storing the first encryption subkey in the built-in key storage;
[0018] The second encryption subkey is stored in the external key storage.
[0019] In another aspect, splitting the encryption key into a first encryption subkey and a second encryption subkey comprises:
[0020] Generate and store digital marks of characters at each character position of the encryption key;
[0021] grouping the digital tags into two tag groups;
[0022] The characters corresponding to the digital marks in each of the mark groups are combined to obtain the corresponding first encryption subkey and second encryption subkey.
[0023] In another aspect, the digital tags are grouped into two tag groups, including:
[0024] The digital marks of type even are grouped into one mark group, and the digital marks of type odd are grouped into one mark group.
[0025] On the other hand, obtaining the first key data stored in the built-in key memory, obtaining the second key data stored in the external key memory, and combining the first key data and the second key data to obtain the target key includes:
[0026] Acquire a first encryption subkey stored in the built-in key storage;
[0027] Obtaining a second encryption subkey stored in the external key storage device;
[0028] combining the first encryption subkey and the second encryption subkey according to the digital mark to obtain the encryption key;
[0029] The encryption key is decrypted to obtain the target key.
[0030] On the other hand, after storing the second encryption subkey in the external key storage, the method further includes:
[0031] Encrypting the second encryption subkey to obtain a redundancy result of the first key;
[0032] Encrypting the first encryption subkey to obtain the second key redundancy result;
[0033] Storing the first key redundancy result in the built-in key memory;
[0034] The second key redundancy result is stored in the external key storage.
[0035] On the other hand, the encryption subkey is encrypted to obtain a key redundancy result, including:
[0036] The encrypted subkey is used as a pending subkey;
[0037] Obtain a character conversion table for converting the subkey to be processed;
[0038] The subkey to be processed is subjected to character conversion according to the character conversion table to obtain a key redundancy result.
[0039] On the other hand, character conversion is performed on the subkey to be processed according to the character conversion table to obtain a key redundancy result, including:
[0040] Get the set data length value;
[0041] The subkeys to be processed are grouped according to the data length values to obtain a key group to be processed;
[0042] Generate a first sum value of the first character and the last character in the key group to be processed;
[0043] Generate the second sum of all characters in the key group to be processed;
[0044] Using the first sum value as the row number and the second sum value as the column number;
[0045] In the character conversion table, find the target character located at the position corresponding to the row number and the column number;
[0046] Determine the converted character corresponding to the key group to be processed according to the target character;
[0047] All the converted characters are combined to obtain a key redundancy result.
[0048] On the other hand, determining the converted character corresponding to the key group to be processed according to the target character includes:
[0049] A first type of base conversion is performed on the target character to obtain a converted character corresponding to the key group to be processed.
[0050] On the other hand, the subkeys to be processed are grouped according to the data length values to obtain a key group to be processed, including:
[0051] Performing a second type of base conversion on the subkey to be processed to obtain a converted subkey;
[0052] The converted subkeys are grouped according to the data length values to obtain a key group to be processed.
[0053] On the other hand, all the converted characters are combined to obtain a key redundancy result, including:
[0054] Combining all the converted characters to obtain a combined character;
[0055] Accumulate the real-time number of character conversions of the subkey to be processed;
[0056] Detecting whether the real-time number value is equal to the set number value;
[0057] In response to the real-time number value being less than the set number value, the combined character is used as the subkey to be processed, and the step of obtaining the set data length value is returned to be executed;
[0058] In response to the real-time number value being equal to the set number value, the combined character is used as a key redundancy result.
[0059] In a second aspect, a data processing system is provided, including a storage controller, a host and a data storage device connected to the storage controller, and a built-in key storage and an external key storage connected to the storage controller;
[0060] The storage controller is used to: obtain target data to be processed, the target data including data sent by the host or data stored in the data storage device; in response to the built-in key memory and the external key memory being normal, obtain the first key data stored in the built-in key memory, obtain the second key data stored in the external key memory, and combine the first key data and the second key data to obtain a target key; in response to the built-in key memory being normal and the external key memory being abnormal, obtain the first key data and the first key redundancy result stored in the built-in key memory, and restore the target key according to the first key data and the first key redundancy result; in response to the built-in key memory being abnormal and the external key memory being normal, obtain the second key data and the second key redundancy result stored in the external key memory, and restore the target key according to the second key data and the second key redundancy result; process the target data based on the target key;
[0061] Among them, the first key redundancy result includes the result obtained after redundancy of the second key data; the second key redundancy result includes the result obtained after redundancy of the first key data.
[0062] According to a third aspect, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the steps of any of the above-mentioned data processing methods.
[0063] In a fourth aspect, an electronic device is provided, including:
[0064] Memory for storing computer programs;
[0065] A processor is used to implement the steps of any of the above data processing methods when executing the computer program.
[0066] According to a fifth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above data processing methods are implemented.
[0067] A data processing method provided by the present invention obtains target data to be processed; in response to both a built-in key memory and an external key memory being normal, obtains first key data stored in the built-in key memory, obtains second key data stored in the external key memory, and combines the first key data and the second key data to obtain a target key; in response to the built-in key memory being normal and the external key memory being abnormal, obtains first key data and a first key redundant result stored in the built-in key memory, and restores the target key according to the first key data and the first key redundant result; in response to the built-in key memory being abnormal and the external key memory being normal, obtains second key data and a second key redundant result stored in the external key memory, and restores the target key according to the second key data and the second key redundant result; processes the target data based on the target key; wherein the first key redundant result includes a result obtained after redundancy of the second key data; and the second key redundant result includes a result obtained after redundancy of the first key data.
[0068] The beneficial effects of the present invention are as follows: the first key data and the first key redundancy result are stored in the built-in key memory, and the second key data and the second key redundancy result are stored in the external key memory. When both the built-in key memory and the external key memory are normal, the key data stored in the built-in key memory and the external key memory can be used to combine the target key. When only one of the built-in key memory or the external key memory is normal, the key data and the key redundancy data stored in the normal key memory can be used to restore the target key, thus realizing the dual control of the key by means of the built-in key memory and the external key memory. In this way, as long as one of the key memories is normal, the target key can be obtained, thus avoiding the situation where the key cannot be obtained when a single key memory is abnormal, improving the stability of obtaining the key, and thus improving the stability of the data encryption and decryption operation. The data processing system, computer program product, electronic device and computer-readable storage medium provided by the present invention all solve the above technical problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0070] Figure 1 A flowchart of a data processing method provided by an embodiment of the present invention;
[0071] Figure 2A schematic diagram of the structure of a data processing system provided by an embodiment of the present invention;
[0072] Figure 3 It is a schematic diagram of data storage;
[0073] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0074] Figure 5 Another structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0076] See also Figure 1 , Figure 1 A flowchart of a data processing method provided by an embodiment of the present invention.
[0077] A data processing method provided by an embodiment of the present invention may include the following steps:
[0078] Step S101: Acquire target data to be processed.
[0079] In practical applications, the target data to be processed can be obtained first, and the type and content of the target data can be flexibly determined according to the application scenario. For example, the target data can be text data, image data, digital data, etc.
[0080] Step S102: In response to both the built-in key memory and the external key memory being normal, the first key data stored in the built-in key memory is obtained, the second key data stored in the external key memory is obtained, and the first key data and the second key data are combined to obtain a target key.
[0081] Step S103: In response to the built-in key memory being normal but the external key memory being abnormal, the first key data and the first key redundancy result stored in the built-in key memory are obtained, and the target key is restored according to the first key data and the first key redundancy result.
[0082] Step S104: In response to the internal key memory being abnormal but the external key memory being normal, the second key data and the second key redundancy result stored in the external key memory are obtained, and the target key is restored according to the second key data and the second key redundancy result.
[0083] Step S105: Process the target data based on the target key; wherein the first key redundancy result includes the result obtained after redundancy of the second key data; and the second key redundancy result includes the result obtained after redundancy of the first key data.
[0084] In practical applications, the present invention is preset with a built-in key storage device and an external key storage device to store key-related information, the built-in key storage device includes a Universal Serial Bus (USB) driver, etc., and the external key storage device includes a key storage server and / or a cloud server, etc.; and the built-in key storage device stores first key data and a first key redundancy result, and the external key storage device stores second key data and a second key redundancy result, the first key redundancy result includes a result obtained after redundancy of the second key data, and the second key redundancy result includes a result obtained after redundancy of the first key data, so that the corresponding key data can be obtained by simply restoring the key redundancy result, thereby restoring the target key. In this way, when both the built-in key memory and the external key memory are normal, the first key data stored in the built-in key memory can be obtained, the second key data stored in the external key memory can be obtained, and the first key data and the second key data can be combined to obtain the target key; when the built-in key memory is normal and the external key memory is abnormal, the first key data and the first key redundant result stored in the built-in key memory can be obtained, and the target key can be restored according to the first key data and the first key redundant result; when the built-in key memory is abnormal and the external key memory is normal, the second key data and the second key redundant result stored in the external key memory can be obtained, and the target key can be restored according to the second key data and the second key redundant result. After that, the target data can be processed based on the target key, and the processing method can be encryption or decryption.
[0085] It should be noted that the key data in the present invention can be the key itself, for example, the first key data can be the first subkey, the second key data can be the second subkey, and the first subkey and the second subkey can be combined into a target key. Of course, the data can also be the encryption result of the key, and the key redundancy result is used to redundancy the key data, and the redundancy method can be flexibly selected, for example, the key data can be redundancy by encryption, etc. It can be understood that, in the case where the first key data is the first subkey and the second key data is the second subkey, in the process of restoring the target key according to the first key data and the first key redundancy result, the first key redundancy result can be restored to obtain the second subkey, and the first subkey and the second subkey can be combined to obtain the target key.
[0086] In practical applications, before obtaining the target data to be processed, a target key can also be generated. The method for generating the target key can be flexibly selected according to needs. For example, a key generation algorithm such as the SM2 algorithm and the SM4 algorithm can be used to generate a 128-bit target key. After the target key is generated, considering that there is a risk of leakage when storing the original target key, in order to avoid this situation, the target key can be stored with the help of encryption means, that is, the target key can be encrypted to obtain an encryption key, so as to ensure the security of the target key with the help of the encryption key; the encryption key is split into a first encryption subkey and a second encryption subkey; the first encryption subkey is stored as the first key data in the built-in key storage device; the second encryption subkey is stored as the second key data in the external key storage device.
[0087] In a specific application scenario, in the process of splitting the encryption key into the first encryption subkey and the second encryption subkey, digital marks of the characters on each character position of the encryption key can be generated and stored, wherein the digital marks can start from 0 and increase by 1. At this time, the digital marks of the characters on each character position of the encryption key are 0, 1, 2, 3... etc. Of course, there can also be other ways to generate digital marks; the digital marks are grouped into two mark groups, so that the digital marks in the two mark groups are different, but the two mark groups can still restore all the digital marks; since each digital mark corresponds to a character in the encryption key, the characters in the encryption key corresponding to the digital marks in each mark group are combined to obtain the corresponding first encryption subkey and second encryption subkey, for example, the digital marks are grouped into mark group 1 and mark group 2, and the characters in the encryption key corresponding to the digital marks in mark group 1 are combined to obtain the corresponding first encryption subkey, and the characters in the encryption key corresponding to the digital marks in mark group 2 are combined to obtain the corresponding second encryption subkey.
[0088] From the implementation process, it can be known that the present invention generates and stores corresponding digital marks for the characters on each character position of the encryption key, so that the corresponding characters can be determined according to the digital marks. In this way, the digital marks only need to be grouped into two mark groups, and the characters in the encryption key corresponding to the digital marks in each mark group can be combined to obtain the corresponding first encryption subkey and second encryption subkey. Since the grouping method of the digital marks is not limited by the position of the characters in the encryption key, compared with directly splitting the encryption key, the present invention can group the digital marks more flexibly, so that the encryption key can be split more flexibly, and after obtaining the encryption subkey, the corresponding characters can be combined according to the digital marks corresponding to the encryption key to obtain the encryption key. For ease of understanding, assuming that the encryption key is ACBDF, the corresponding digital mark is 01234, and the mark groups are 104 and 23 respectively, then the encryption subkeys are CAF and BD respectively. When the encryption subkeys are combined later, the encryption subkeys can be restored by combining the encryption subkeys according to the digital marks 01234 corresponding to the encryption key.
[0089] In a specific application scenario, in the process of grouping digital tags into two tag groups, 2 can be assigned to the generated variable; the digital tag is used as a tag to be processed; the ratio of the total number of digital tags to the total number is generated, and the ratio is taken downward to obtain the retrieval value; it is detected whether the generated variable is equal to one. If the generated variable is not equal to one, the retrieval value of non-repeating digital tags are randomly selected from the tags to be processed as a tag group, the value of the generated variable is reduced by one, and the step of detecting whether the generated variable is equal to one is returned; if the generated variable is equal to one, the tags to be processed are taken as a tag group to obtain a total number of tag groups.
[0090] From the implementation process, it can be seen that the present invention assigns 2 to the generated variable, and uses the generated variable to mark the number of the generated tag group; uses the digital tag as the tag to be processed; generates a ratio of the total number of digital tags to the total number, and takes the ratio downward to obtain a search value; detects whether the generated variable is equal to one, if the generated variable is not equal to one, randomly takes out the search value of non-repeating digital tags from the tags to be processed as a tag group, subtracts one from the value of the generated variable, and returns to execute the step of detecting whether the generated variable is equal to one. At this time, there is no digital tag that has been included in the tag group in the tags to be processed, and the digital tag that is subsequently taken out will not be repeated with the digital tag in the tag group that has been obtained; if the generated variable is equal to one, the tags to be processed are taken as a tag group to obtain a total number of tag groups. The tag group is generated by randomly selecting digital tags, so that the digital tags in the tag group are more flexible and difficult to determine, which improves the security of the tag group, and further improves the security of the encryption subkey.
[0091] In a specific application scenario, in the process of grouping digital tags into two tag groups, the digital tags can be split by using an even-odd separation method, that is, digital tags of even type can be combined into one tag group, and digital tags of odd type can be combined into one tag group. For ease of understanding, assuming that the encryption key is 01 ... As an encryption subkey, select 64 numbers with odd subscripts, i.e. 1, 3, 5, 7, ... 127, as an encryption subkey. Then the first encryption subkey can be 000000000000000000000000000000000000000000000000000000000000000000000000000000, and the second encryption subkey can be 1 ...
[0092] In a specific application scenario, in the process of obtaining the first key data stored in the built-in key memory, obtaining the second key data stored in the external key memory, and combining the first key data and the second key data to obtain the target key, the first encryption subkey stored in the built-in key memory can be obtained; the second encryption subkey stored in the external key memory can be obtained; according to the digital mark, the first encryption subkey and the second encryption subkey are combined to obtain the encryption key; the encryption key is decrypted to obtain the target key.
[0093] In actual applications, after storing the second encryption subkey in an external key memory, the second encryption subkey can also be encrypted to obtain a redundant result of the first key; the first encryption subkey can be encrypted to obtain a redundant result of the second key; the redundant result of the first key can be stored in a built-in key memory; and the redundant result of the second key can be stored in an external key memory.
[0094] In a specific application scenario, in the process of encrypting an encryption subkey and obtaining the corresponding key redundancy result, that is, in the process of encrypting the second encryption subkey and obtaining the first key redundancy result, and in the process of encrypting the first encryption subkey and obtaining the second key redundancy result, the encryption subkey to be encrypted can be used as the subkey to be processed; a character conversion table for converting the subkey to be processed is obtained; and the subkey to be processed is converted into characters according to the character conversion table to obtain the key redundancy result. In this way, the subkey to be processed can be redundant by only setting up the character conversion table, and the security of the redundancy process and the key redundancy result can be guaranteed by only ensuring the security of the character conversion table.
[0095] In a specific application scenario, in the process of converting characters of the subkey to be processed according to the character conversion table to obtain the key redundancy result, the set data length value can be obtained; the subkey to be processed is grouped according to the data length value to obtain the key group to be processed, at this time, the length value of the data in each key group to be processed is close to the data length value, that is, when the length value of the data in the subkey to be processed is an integer multiple of the data length value, the length of the data in each key group to be processed is the data length value, otherwise the length of the data in some key groups to be processed is the data length value, and the length value of the data in some key groups to be processed fluctuates around the data length value; for each key group to be processed, a first sum value of the first character and the last character in the key group to be processed is generated, a second sum value of all characters in the key group to be processed is generated, the first sum value is used as the row number, and the second sum value is used as the column number, in the character conversion table, the target character located at the position corresponding to the row number and the column number is found, and the converted character corresponding to the key group to be processed is determined according to the target character; all the converted characters are combined to obtain the key redundancy result. It should be noted that the subkey to be processed can be restored by simply performing the reverse operation according to the generation process of the key redundancy result, that is, splitting the key redundancy result to obtain the converted characters corresponding to the key group to be processed, and determining the target character according to the converted characters; according to the row number and column number of the target character in the character conversion table, determine the first sum value of the first character and the last character of the key group to be processed and the second sum value of all characters, and according to the first sum value, the second sum value and the length value of the data in the key group to be processed, the key group to be processed can be restored, and then the key group to be processed can be combined to obtain the subkey to be processed. It should also be noted that the data length value will affect the difficulty of restoring the key group to be processed, so the data length value can be determined according to the processing performance of the device, for example, the data length value can be 2 bits, 3 bits, 4 bits, etc.
[0096] It can be seen from the implementation process that, in the process of converting the characters of the subkeys to be processed according to the character conversion table to obtain the key redundancy result, the present invention groups the subkeys to be processed according to the set data length value to obtain the key group to be processed, so as to increase the single subkey to be processed into multiple key groups to be processed by grouping; generates the first sum value of the first character and the last character in the key group to be processed, generates the second sum value of all the characters in the key group to be processed, takes the first sum value as the row number, takes the second sum value as the column number, finds the target character at the position corresponding to the row number and the column number in the character conversion table, that is, for a single key group to be processed, finds the corresponding target character in the character conversion table according to the first sum value of the first character and the last character in the key group to be processed and the second sum value of all the characters, so as to perform conversion encryption on the key group to be processed with the help of the target character; finally, determines the converted character corresponding to the key group to be processed according to the target character, and combines all the converted characters to obtain the key redundancy result, so that when the attacker does not know the character conversion table, the character conversion method and the combination method, it is difficult to crack the key redundancy result to obtain the target key.
[0097] In a specific application scenario, in the process of determining the converted character corresponding to the key group to be processed according to the target character, the target character can be subjected to a first type of base conversion to obtain the converted character corresponding to the key group to be processed. Correspondingly, in the process of grouping the subkeys to be processed according to the data length value to obtain the key group to be processed, the subkeys to be processed can be subjected to a second type of base conversion to obtain the converted subkeys; the converted subkeys are grouped according to the data length value to obtain the key group to be processed. The data can be further encrypted with the help of base conversion to ensure the security of the key, and both the first type of base conversion and the second type of base conversion can be flexibly selected, for example, both the first type of base conversion and the second type of base conversion can be binary conversion, quaternary conversion, decimal conversion, etc.
[0098] In order to facilitate understanding of the character conversion process of the present invention, it is assumed that both the first type of base conversion and the second type of base conversion are binary conversions, and the data length value is 4 bits, and the subkey to be processed is 1101 1011 1111 0011 11001011 1110 1001 1111 0111 1110 1101 1100 1111 0000 1111 1111 0111 1110 11011100 1111 0000 1111 1101 1011 1111 0011 1100 1011 1110 1001, the character conversion table is shown in Table 1. The leftmost column represents the sum of the first and last two digits of every four digits, and the top row represents the sum of every four digits. The numbers in the corresponding rows and columns are the processed numbers. Taking the first four digits of the subkey to be processed, 1101, as an example, the sum of the first and last digits is 3, and the sum of the four digits is 13. Then the number it corresponds to is 0 with row number 3 and column number 13, which is converted into a binary number of 0000. By analogy, the key redundancy value after processing by the character conversion table is: 0000 1110 1101 0100 0011 1110 0101 1011 1101 0001 01010000 0011 1101 1110 1101 0001 0101 0000 0011 1101 1110 1101 0000 11101101 0100 0011 1110 0101 1011. The spaces between characters indicate grouping intervals.
[0099] Table 1 Character conversion table
[0100]
[0101] In a specific application scenario, in the process of combining all converted characters to obtain a key redundancy result, multiple character conversion tables can be applied to convert the subkey to be processed multiple times, so as to further improve the security of the key redundancy result by increasing the number of conversions, that is, all converted characters can be combined to obtain a combined character; the real-time number of times the subkey to be processed is accumulated; whether the real-time number is equal to the set number is detected; in response to the real-time number being less than the set number, the combined character is used as the subkey to be processed, and the step of obtaining the set data length value is returned; in response to the real-time number being equal to the set number, the combined character is used as the key redundancy result. The set number can be flexibly determined as needed, for example, it can be 5, 7, 8, etc. The character conversion table applied for each character conversion can be the same or different, and the key redundancy result can be restored by decrypting the corresponding character conversion table layer by layer to restore the subkey to be processed. The principle of applying the character conversion table for decryption each time is as described in the above embodiment, and will not be repeated here.
[0102] A data processing method provided by the present invention obtains target data to be processed; in response to both a built-in key memory and an external key memory being normal, obtains first key data stored in the built-in key memory, obtains second key data stored in the external key memory, and combines the first key data and the second key data to obtain a target key; in response to the built-in key memory being normal and the external key memory being abnormal, obtains first key data and a first key redundant result stored in the built-in key memory, and restores the target key according to the first key data and the first key redundant result; in response to the built-in key memory being abnormal and the external key memory being normal, obtains second key data and a second key redundant result stored in the external key memory, and restores the target key according to the second key data and the second key redundant result; processes the target data based on the target key; wherein the first key redundant result includes a result obtained after redundancy of the second key data; and the second key redundant result includes a result obtained after redundancy of the first key data. The beneficial effects of the present invention are as follows: the first key data and the first key redundant result are stored in the built-in key memory, and the second key data and the second key redundant result are stored in the external key memory. When both the built-in key memory and the external key memory are normal, the target key can be combined by applying the key data stored in the built-in key memory and the external key memory respectively. When only one of the built-in key memory or the external key memory is normal, the target key can be restored by applying the key data and the key redundant data stored in the normal key memory, thereby realizing dual control of the key with the help of the built-in key memory and the external key memory. In this way, as long as one of the key memories is normal, the target key can be obtained, thereby avoiding the situation where the key cannot be obtained when a single key memory is abnormal, improving the stability of obtaining the key, and further improving the stability of the data encryption and decryption operation.
[0103] Based on the above embodiments, the present invention further provides a data processing system, which may include a storage controller, a host and a data storage device connected to the storage controller, a built-in key storage and an external key storage connected to the storage controller;
[0104] The storage controller is used to: obtain target data to be processed, the target data including data sent by a host or data stored in a data storage device; in response to both a built-in key memory and an external key memory being normal, obtain first key data stored in the built-in key memory, obtain second key data stored in the external key memory, and combine the first key data and the second key data to obtain a target key; in response to the built-in key memory being normal and the external key memory being abnormal, obtain first key data and a first key redundant result stored in the built-in key memory, and restore the target key according to the first key data and the first key redundant result; in response to the built-in key memory being abnormal and the external key memory being normal, obtain second key data and a second key redundant result stored in the external key memory, and restore the target key according to the second key data and the second key redundant result; process the target data based on the target key; wherein the first key redundant result includes a result obtained after redundancy of the second key data; and the second key redundant result includes a result obtained after redundancy of the first key data.
[0105] The functional description of each device in the data processing system provided by the present invention can refer to the corresponding description in the above embodiments, which will not be repeated here.
[0106] In order to facilitate understanding of the data processing scheme of the present invention, it is assumed that the data processing system is as follows Figure 2 As shown in Figure 3 As shown, assuming that it is applied to a storage controller, the following steps are included:
[0107] Activate encryption function: Generate a unique activation code based on the device code that needs to activate the encryption function, and use this activation code to enable the encryption function of the device;
[0108] Enable dual key management: Enable key storage server and USB driver;
[0109] Generate a target key, and encrypt the target key to generate an encryption key;
[0110] Split the target encryption key into encryption subkey 1 and encryption subkey 2;
[0111] Encrypting the encryption subkey 2 by applying the character conversion table to obtain the key redundancy result 1, concatenating the encryption subkey 1 and the key redundancy result 1 and storing them in the key storage server;
[0112] Using the character conversion table to encrypt the encryption subkey 1 to obtain the key redundancy result 2, and concatenating the encryption subkey 2 and the key redundancy result 2 and storing them in the universal serial bus driver;
[0113] Get the target data written by the host;
[0114] If the key storage server is connected normally and the universal serial bus driver is used normally, it is only necessary to obtain the encryption subkeys stored by both parties and then splice them together to obtain the encryption key; if only the key storage server can be connected normally, then the encryption subkey 1 and the key redundancy result 1 are obtained, the key redundancy result 1 is decrypted with the help of the conversion table to obtain the encryption subkey 2, and then the encryption subkey 1 and the encryption subkey 2 are spliced to obtain the encryption key; if only the universal serial bus driver can be used normally, then the encryption subkey 2 and the key redundancy result 2 are obtained, the key redundancy result 2 is decrypted with the help of the conversion table to obtain the encryption subkey 1, and then the encryption subkey 1 and the encryption subkey 2 are spliced to obtain the encryption key;
[0115] Decrypting the encryption key to obtain the target key;
[0116] The target data is encrypted using the target key to obtain encrypted data, and the encrypted data is stored in a data storage device.
[0117] The present invention also provides an electronic device and a computer-readable storage medium, both of which have the corresponding effects of a data processing method provided in an embodiment of the present invention. Figure 4 , Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0118] An electronic device provided by an embodiment of the present invention includes a memory 201 and a processor 202. The memory 201 stores a computer program. When the processor 202 executes the computer program, the steps of the data processing method described in any of the above embodiments are implemented.
[0119] See also Figure 5 Another electronic device provided in an embodiment of the present invention may also include: an input port 203 connected to the processor 202, used to transmit commands input from the outside to the processor 202; a display unit 204 connected to the processor 202, used to display the processing results of the processor 202 to the outside; a communication module 205 connected to the processor 202, used to realize communication between the electronic device and the outside. The display unit 204 can be a display panel, a laser scanning display, etc.; the communication method adopted by the communication module 205 includes but is not limited to mobile high-definition link technology (Mobile High-Definition Link, MHL), Universal Serial Bus (Universal Serial Bus, USB), High-Definition Multimedia Interface (High-Definition Multimedia Interface, HDMI), wireless connection: wireless fidelity technology (WIreless Fidelity, WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s.
[0120] An embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the data processing method described in any of the above embodiments are implemented.
[0121] The computer-readable storage medium involved in the present invention includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0122] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the data processing method described in any of the above embodiments are implemented.
[0123] For the description of the relevant parts of a data processing system, a computer program product, an electronic device, and a computer-readable storage medium provided by an embodiment of the present invention, please refer to the detailed description of the corresponding parts in a data processing method provided by an embodiment of the present invention, which will not be repeated here. In addition, the parts of the above technical solutions provided by the embodiments of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.
[0124] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0125] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method, characterized in that: include: Obtain target data to be processed; In response to the built-in key memory and the external key memory being normal, obtaining the first key data stored in the built-in key memory, obtaining the second key data stored in the external key memory, and combining the first key data and the second key data to obtain a target key; In response to the built-in key memory being normal and the external key memory being abnormal, acquiring the first key data and the first key redundancy result stored in the built-in key memory, and restoring the target key according to the first key data and the first key redundancy result; In response to the built-in key memory being abnormal and the external key memory being normal, acquiring the second key data and the second key redundancy result stored in the external key memory, and restoring the target key according to the second key data and the second key redundancy result; Processing the target data based on the target key; The first key redundancy result includes a result obtained after redundancy of the second key data; the second key redundancy result includes a result obtained after redundancy of the first key data; Before obtaining the target data to be processed, it also includes: generating the target key; encrypting the target key to obtain an encryption key; splitting the encryption key into a first encryption subkey and a second encryption subkey; storing the first encryption subkey as first key data in the built-in key memory; storing the second encryption subkey as second key data in the external key memory.
2. The data processing method according to claim 1, characterized in that: Splitting the encryption key into a first encryption subkey and a second encryption subkey comprises: Generate and store digital marks of characters at each character position of the encryption key; grouping the digital tags into two tag groups; The characters corresponding to the digital marks in each of the mark groups are combined to obtain the corresponding first encryption subkey and second encryption subkey.
3. The data processing method according to claim 2, characterized in that: The digital tags are grouped into two tag groups, including: The digital marks of type even are grouped into one mark group, and the digital marks of type odd are grouped into one mark group.
4. The data processing method according to claim 2, characterized in that: Acquiring first key data stored in the built-in key memory, acquiring second key data stored in the external key memory, and combining the first key data and the second key data to obtain a target key, including: Acquire a first encryption subkey stored in the built-in key storage; Obtaining a second encryption subkey stored in the external key storage device; combining the first encryption subkey and the second encryption subkey according to the digital mark to obtain the encryption key; The encryption key is decrypted to obtain the target key.
5. The data processing method according to any one of claims 1 to 4, characterized in that: After storing the second encryption subkey in the external key storage, the method further includes: Encrypting the second encryption subkey to obtain a redundancy result of the first key; Encrypting the first encryption subkey to obtain the second key redundancy result; Storing the first key redundancy result in the built-in key memory; The second key redundancy result is stored in the external key storage.
6. The data processing method according to claim 5, characterized in that: The encryption subkey is encrypted to obtain the key redundancy result, including: The encrypted subkey is used as a pending subkey; Obtain a character conversion table for converting the subkey to be processed; The subkey to be processed is subjected to character conversion according to the character conversion table to obtain a key redundancy result.
7. The data processing method according to claim 6, characterized in that: Performing character conversion on the subkey to be processed according to the character conversion table to obtain a key redundancy result includes: Get the set data length value; The subkeys to be processed are grouped according to the data length values to obtain a key group to be processed; Generate a first sum value of the first character and the last character in the key group to be processed; Generate the second sum of all characters in the key group to be processed; Using the first sum value as the row number and the second sum value as the column number; In the character conversion table, find the target character located at the position corresponding to the row number and the column number; Determine the converted character corresponding to the key group to be processed according to the target character; All the converted characters are combined to obtain a key redundancy result.
8. The data processing method according to claim 7, characterized in that: Determining, according to the target character, a converted character corresponding to the key group to be processed, comprising: A first type of base conversion is performed on the target character to obtain a converted character corresponding to the key group to be processed.
9. The data processing method according to claim 8, characterized in that: The subkeys to be processed are grouped according to the data length values to obtain a key group to be processed, including: Performing a second type of base conversion on the subkey to be processed to obtain a converted subkey; The converted subkeys are grouped according to the data length values to obtain a key group to be processed.
10. The data processing method according to claim 7, characterized in that: All the converted characters are combined to obtain a key redundancy result, including: Combining all the converted characters to obtain a combined character; Accumulate the real-time number of character conversions of the subkey to be processed; Detecting whether the real-time number value is equal to the set number value; In response to the real-time number value being less than the set number value, the combined character is used as the subkey to be processed, and the step of obtaining the set data length value is returned to be executed; In response to the real-time number value being equal to the set number value, the combined character is used as a key redundancy result.
11. A data processing system, characterized in that: It includes a storage controller, a host and a data storage device connected to the storage controller, and a built-in key storage and an external key storage connected to the storage controller; The storage controller is used to: obtain target data to be processed, the target data including data sent by the host or data stored in the data storage device; in response to the built-in key memory and the external key memory being normal, obtain first key data stored in the built-in key memory, obtain second key data stored in the external key memory, and combine the first key data and the second key data to obtain a target key; In response to the built-in key memory being normal and the external key memory being abnormal, the first key data and the first key redundancy result stored in the built-in key memory are obtained, and a target key is restored according to the first key data and the first key redundancy result; in response to the built-in key memory being abnormal and the external key memory being normal, the second key data and the second key redundancy result stored in the external key memory are obtained, and a target key is restored according to the second key data and the second key redundancy result; Processing the target data based on the target key; The first key redundancy result includes a result obtained after redundancy of the second key data; the second key redundancy result includes a result obtained after redundancy of the first key data; The system is also used to generate the target key; encrypt the target key to obtain an encryption key; split the encryption key into a first encryption subkey and a second encryption subkey; store the first encryption subkey as first key data in the built-in key memory; and store the second encryption subkey as second key data in the external key memory.
12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the data processing method according to any one of claims 1 to 10 are implemented.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data processing method according to any one of claims 1 to 10 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Data encryption method and device, terminal equipment and computer readable storage medium
CN115941304A
Distributed cloud storage system, method and client based on secret sharing and erasure codes
CN118264394A