Encryption control method for solid-state drive manufacturing
By solidifying the key pair library in the solid-state drive and using XOR operations to generate logical decryption keys, the problem of encrypted information leakage during data reading in the existing technology is solved, achieving higher data security and reducing the workload of key management.
Patent Information
- Application Number
- CN202411121308.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-08-15
AI Technical Summary
Existing encryption technologies can easily leak encryption information of other data when reading hard disk data, and cannot ensure the complete security of data.
By solidifying the key pair library in the solid-state drive, generating encryption keys based on data length and type, and using XOR operations to generate logical decryption keys, allocating storage locations and saving related data, and setting access permissions, the security of data when reading is ensured.
It improves data security, reduces the workload of key management, and ensures that data is not leaked under security attacks, thereby enhancing data integrity.
Smart Images

Figure CN119004568B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and more particularly to an encryption control method for solid-state hard drive manufacturing. Background Art
[0002] With the continuous advancement and innovation of technology, the encryption performance of encrypted solid-state drives will be further improved. At the same time, new encryption technologies and algorithms will continue to emerge, providing users with more secure and convenient data protection solutions. Similar prior art includes Chinese patent publication number CN118152306A, which proposes a hard disk data protection method, device, equipment, and storage medium. This relates to the field of data storage technology and is applied to hard disks. The hard disk's main control component includes a verification data generation and comparison component and a data encryption and decryption component, which includes: sending a connection request to a mobile storage device; upon receiving a successful connection response, reading encryption and decryption mode information and a password from the mobile storage device and verifying them; if the verification passes, enabling the hard disk's read and write functions and the encryption and decryption functions of the data encryption and decryption component; upon receiving a data write request, determining the encryption mode corresponding to the encryption and decryption mode information and password through the data encryption and decryption component; encrypting the data to be written according to the encryption mode and using the password, and storing the encrypted data. This can encrypt the hard disk data, protect the hard disk data, improve the security of hard disk data storage, and effectively prevent hard disk data from being tampered with. In addition, similar prior art includes the U.S. patent with publication number US11644983B2, which proposes a storage device with encryption function, including a non-volatile memory, which is configured to store an encryption key and a data key encrypted with the encryption key, write data using the data key, and read data using the data key; a storage controller, wherein the storage controller is configured to receive a first security setting command, the first security setting command allows access to the data key using a first password, generate a first key based on the first password in response to the first security setting command, encrypt the first key with the first key to generate a first encryption key, encrypt the first key with the encryption key to generate an encrypted first key, and store the first encryption key and the encrypted first key in the non-volatile memory. Both of the above technical solutions solve the problem of data security, but neither takes into account that when reading hard disk data, encryption information of other data will be leaked, and thus the security of the data cannot be truly ensured. Summary of the Invention
[0003] In order to better solve the above problems, the present invention provides an encryption control method for manufacturing a solid-state hard disk, wherein the solid-state hard disk includes multiple sectors, and the method includes the following steps:
[0004] Step S1: First, the key pair library is fixed to the solid-state drive, the receiving unit receives the data to be encrypted, and obtains the data length and type of the data to be encrypted, and allocates a storage location for the data to be encrypted according to the data length of the data to be encrypted and the remaining space of the solid-state drive;
[0005] Step S2: The key generation unit generates an encryption key based on the storage location, the type of data to be encrypted, and the key pair library, divides the data to be encrypted into multiple data groups, and encrypts the data groups using the encryption key and encryption algorithm to generate first encrypted data;
[0006] Step S3: performing a logical operation on a decryption key corresponding to the encryption key to obtain a logical decryption key, generating related data of the first encrypted data based on the data length of the data group, the data length of the data to be encrypted, the check data of the data group, and the logical decryption key, and storing the first encrypted data and the corresponding related data in the same sector of the storage location;
[0007] Step S4: using the encrypted data to be encrypted as data to be decrypted, setting access rights for the data to be decrypted, and generating an access password. After the user enters the access password, according to the user's operation command, when the operation command is decryption, obtaining the initial reading position of the data to be decrypted through the position management unit;
[0008] Step S5: reading the data to be decrypted and the related data corresponding to the data to be decrypted based on the initial reading position, obtaining a decryption key through the related data, decrypting the data to be decrypted based on the decryption key, and obtaining decrypted data.
[0009] As a preferred technical solution of the present invention, step S1 includes:
[0010] The key pair library includes multiple encryption key and decryption key pairs. The data types that can be stored in the solid-state drive include text, audio, image, video and program. The type of the data to be encrypted is one of the data types.
[0011] As a preferred technical solution of the present invention, step S2 includes the following steps:
[0012] Step S21: sorting the sectors of the solid-state drive according to the size of the storage address, and obtaining the sorting of each sector, numbering the data types that the solid-state drive can store, and obtaining the number of the data type to be encrypted, setting an intermediate number, using the number of the data type to be encrypted as the lower four bits of the intermediate number, and using the serial number of the sector where the initial storage location of the storage location is located as the upper four bits of the intermediate number, calculating the remainder between the intermediate number and the total number of key pairs in the key pair library, and using the key pair in the key pair library with the same serial number as the remainder as the encryption key and decryption key of the data to be encrypted;
[0013] Step S22: Divide the data to be encrypted into N data groups, wherein the data length of the first data group is S, where S+K is less than or equal to the remaining space of the sector where the initial storage location is located and is the maximum data size of the data group that can be stored in the sector where the initial storage location is located; the data length of the i-th data group is MK, where i is greater than or equal to 2 and less than N, M is the data capacity of the sector, K is the data length of the relevant data corresponding to the data group, and the length of the N-th data group is the amount of data remaining after excluding the first N-1 data groups from the data to be encrypted;
[0014] Step S23: Encrypt each of the data groups using the encryption key and encryption algorithm to generate the first encrypted data corresponding to each of the data groups.
[0015] As a preferred technical solution of the present invention, the data length of the first encrypted data is equal to the data length of the data group corresponding to the first encrypted data.
[0016] As a preferred technical solution of the present invention, step S3 includes: performing a logical operation on the decryption key corresponding to the encryption key, the logical operation being an exclusive OR operation, to obtain the logical decryption key, and using the logical decryption key, the data length of the data group, the data length of the data to be encrypted, and the verification data of the data group as the ancillary data of the data group, adding preset separators between two adjacent items in the ancillary data, and using the ancillary data with the preset separators added as the related data of the data group, wherein the related data and the data group are stored in the same sector, and the related data is stored in front of the corresponding data group.
[0017] As a preferred technical solution of the present invention, step S5 includes:
[0018] Step S51: according to the initial reading position of the data to be decrypted, obtaining the target sector where the initial reading position is located, reading out all the data in the target sector, and using all the data as the second encrypted data;
[0019] Step S52: identifying the length of the data group, the data length of the data to be decrypted, and the logical decryption key corresponding to the first encrypted data based on the initial reading position and the preset delimiter in the relevant data;
[0020] Step S53: Obtain the first encrypted data from the second encrypted data based on the data length of the first encrypted data, perform a logical operation on the logical decryption key again to obtain the decryption key, decrypt the first encrypted data using the decryption key and the decryption algorithm to obtain the data group corresponding to the first encrypted data.
[0021] As a preferred technical solution of the present invention, step S53 further includes step S54:
[0022] The next sector of the target sector is used as the new target sector, and steps S51 to S53 are repeated to read and decrypt the other data groups in the new target sector according to the method of the first encrypted data corresponding to the data group. The data length of each decrypted data group is added together to calculate the sum of the data lengths. When the sum of the data lengths is equal to the length of the data to be decrypted, the process ends.
[0023] As a preferred technical solution of the present invention, step S5 is followed by step S6: further calculating the verification result of each data group decrypted from the data to be decrypted, and comparing the verification result with the verification data in the related data corresponding to the data group; when the verification result and the verification data of each data group are consistent, each data group is spliced in the reading order to obtain the complete decrypted data; when the verification result and the verification data of at least one data group are inconsistent, repeating step S5 to re-read the first encrypted data corresponding to at least one data group, and re-decrypting.
[0024] As a preferred technical solution of the present invention, the encryption algorithm and decryption algorithm are symmetric key encryption algorithms of the Advanced Encryption Standard.
[0025] As a preferred technical solution of the present invention, each sector can store multiple types of encrypted data.
[0026] Compared with the prior art, the beneficial effects of the present invention are at least as follows:
[0027] The present invention receives the data to be encrypted through a receiving unit, and obtains the data length and type of the data to be encrypted, allocates a storage location for the data to be encrypted according to the data length of the data to be encrypted and the remaining space of the solid-state hard disk, uses the serial number of the sector where the initial storage location of the data storage location to be encrypted as the upper four bits of the intermediate number, and uses the type number of the data to be encrypted as the lower four bits of the intermediate number, wherein the intermediate number is in octal, and calculates the remainder of the intermediate number and the total number of key pairs in the key pair library, and uses the key pair with the key pair serial number in the key pair library equal to the remainder as the encryption key and decryption key of the data to be encrypted, so that different data types stored in the same sector have different encryption keys, and the same data type stored in different sectors also has different encryption keys, thereby increasing the security of the data, and by using the decryption key corresponding to the encryption key The key performs a logical operation, wherein the logical operation is an exclusive OR operation, and the data length of the data group, the data length of the data to be encrypted, the check data of the data group and the logical decryption key are used as the auxiliary data of the data group. When reading the content of the sector where the data group is located, all the data of the data group is obtained through the data length of the data group, and whether to continue reading the data of the next sector is determined by the data length of the data to be encrypted and the total length of the read data group. The decryption key can be decrypted by performing an exclusive OR operation on the logical decryption key again, which reduces the workload of managing the decryption key. At the same time, even if a security attack occurs, it is not known which one is the decryption key, let alone whether the decryption key has undergone a logical operation. Through the mutual cooperation of the above technical solutions, not only the security of the data is improved, but also the workload of key management is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a flow chart of the encryption control method used in solid-state hard drive manufacturing according to the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0030] The present invention provides an encryption control method for solid state hard disk manufacturing, wherein the solid state hard disk includes multiple sectors, such as Figure 1 As shown, the method includes the following steps:
[0031] Step S1: First, the key pair library is fixed to the solid-state drive, the receiving unit receives the data to be encrypted, and obtains the data length and type of the data to be encrypted, and allocates a storage location for the data to be encrypted according to the data length of the data to be encrypted and the remaining space of the solid-state drive;
[0032] Specifically, the encryption control method for solid-state hard disk manufacturing mainly involves software encryption and hardware encryption, among which software encryption is to encrypt and decrypt data in the hard disk through a software program, thereby achieving the purpose of improving data security. After the production of the solid-state hard disk body is completed, the above-mentioned key pair library is now solidified into the above-mentioned solid-state hard disk, providing an encryption key for the data to be encrypted and a decryption key for the data to be decrypted. Then, the data to be encrypted is received by the receiving unit, and the data length and type of the above-mentioned data to be encrypted are obtained. The type of the above-mentioned data to be encrypted is one of text, audio, image, video and program. According to the data length of the above-mentioned data to be encrypted and the remaining space of the above-mentioned solid-state hard disk, a storage location is allocated for the above-mentioned data to be encrypted. Through the above-mentioned technical solution, the above-mentioned data to be encrypted and its data length and type can be obtained, laying the foundation for further generating encryption keys according to the above-mentioned storage location, the type of the above-mentioned data to be encrypted and the above-mentioned key pair library.
[0033] Step S2: The key generation unit generates an encryption key based on the storage location, the type of data to be encrypted, and the key pair library, divides the data to be encrypted into multiple data groups, and encrypts the data groups using the encryption key and encryption algorithm to generate first encrypted data;
[0034] Specifically, the serial number of the sector where the initial storage location of the data to be encrypted is located is used as the upper four bits of the above-mentioned intermediate number, and the type number of the above-mentioned data to be encrypted is used as the lower four bits of the intermediate number, wherein the above-mentioned intermediate number is in octal, and the remainder of the above-mentioned intermediate number and the total number of key pairs in the above-mentioned key pair library is calculated, and the key pair with the key pair serial number in the above-mentioned key pair library equal to the above-mentioned remainder is used as the encryption key and decryption key of the above-mentioned data to be encrypted, wherein the serial number of the above-mentioned key pair is determined by the solidification order of the above-mentioned key pair in the above-mentioned solid-state hard disk, and the earlier the serial number is solidified, the smaller the serial number. Through the above-mentioned technical solution, different data types stored in the same sector have different encryption keys, and the same data type stored in different sectors have different encryption keys, thereby increasing the security of the data, and the above-mentioned data to be encrypted is divided into N data groups. Since the smallest read and write unit of the above-mentioned solid-state hard disk is a sector, therefore, in the above-mentioned data to be encrypted When the capacity is at least greater than one sector, when dividing the data groups, the first data group needs to be divided according to the remaining space of the written sector, and the division starts from the second data group according to the sector. The last data group is the last remaining data. Since the encryption algorithm of the above data groups adopts a symmetric encryption algorithm, the data length of the above data groups and the corresponding first encrypted data after encryption are consistent. The first N-1 data groups are integer multiples of the minimum encryption unit of the above encryption algorithm. When the Nth data group is not the minimum encryption unit, supplementary data is added to the Nth data group so that the data length of the Nth data group is an integer multiple of the minimum encryption unit, and each of the above data groups is encrypted by the encryption key and encryption algorithm to obtain the first encrypted data corresponding to each of the above data groups. Through the above technical solution, the first encrypted data corresponding to each of the above data groups can be obtained, thereby improving the security of the data.
[0035] Step S3: performing a logical operation on a decryption key corresponding to the encryption key to obtain a logical decryption key, generating related data of the first encrypted data based on the data length of the data group, the data length of the data to be encrypted, the check data of the data group, and the logical decryption key, and storing the first encrypted data and the corresponding related data in the same sector of the storage location;
[0036] Specifically, by performing a logical operation on the decryption key corresponding to the encryption key, wherein the logical operation is an exclusive OR operation, and the data length of the data group, the data length of the data to be encrypted, the check data of the data group and the logical decryption key are used as the auxiliary data of the data group. Through the above technical solution, when reading the content of the sector where the data group is located, all the data of the data group is obtained through the data length of the data group, and whether to continue reading the data of the next sector is determined by the data length of the data to be encrypted and the total length of the read data group. The decryption key can be decrypted by performing an exclusive OR operation on the logical decryption key again, which reduces the workload of managing the decryption key. At the same time, even if a security attack occurs, it is not known which one is the decryption key, let alone whether the decryption key has undergone a logical operation, thereby improving the security of the data and reducing the workload of key management.
[0037] Step S4: using the encrypted data to be encrypted as data to be decrypted, setting access rights for the data to be decrypted, and generating an access password. After the user enters the access password, according to the user's operation command, when the operation command is decryption, obtaining the initial reading position of the data to be decrypted through the position management unit;
[0038] Specifically, by setting access rights for each data to be decrypted and allowing access only after the user enters the correct access password, the security of the data is further improved. When accessing the above data to be decrypted, when the user's operation command is decryption, the initial reading position of the above data to be decrypted is obtained through the above position management unit, laying the foundation for accurately reading the above data to be decrypted.
[0039] Step S5: reading the data to be decrypted and the related data corresponding to the data to be decrypted based on the initial reading position, obtaining a decryption key through the related data, decrypting the data to be decrypted based on the decryption key, and obtaining decrypted data.
[0040] Specifically, the above-mentioned initial reading position of the above-mentioned data to be decrypted is obtained through the position management unit, and the second encrypted data of the target sector is read according to the above-mentioned initial reading position. Since the above-mentioned target sector may include not only the above-mentioned data to be decrypted that is accessed, but also other data, therefore, the starting position of the above-mentioned data to be decrypted is obtained through the above-mentioned initial reading position, and the relevant data of the data group corresponding to the above-mentioned data to be decrypted is obtained from the starting position, and the data length of the data group is read from the above-mentioned relevant data, and the first encrypted data corresponding to the above-mentioned data group is read based on the data length of the above-mentioned data group, and the above-mentioned logical decryption key is obtained from the above-mentioned relevant data, and the above-mentioned logical decryption key is subjected to an XOR operation again to obtain the decryption key, and the above-mentioned first encrypted data is decrypted using the above-mentioned decryption key and the decryption algorithm to obtain the above-mentioned data group corresponding to the above-mentioned first encrypted data. Through the above-mentioned technical solution, since other data may be stored in the same sector and may be of different types, and their decryption passwords are also different, the above-mentioned data to be decrypted can be accurately decrypted from the above-mentioned solid-state hard disk without leaking other encrypted data in the same sector, thereby improving data security.
[0041] Furthermore, the step S1 includes:
[0042] The key pair library includes multiple encryption key and decryption key pairs. The data types that can be stored in the solid-state drive include text, audio, image, video and program. The type of the data to be encrypted is one of the data types.
[0043] Furthermore, step S2 includes the following steps:
[0044] Step S21: sorting the sectors of the solid-state drive according to the size of the storage address, and obtaining the sorting of each sector, numbering the data types that the solid-state drive can store, and obtaining the number of the data type to be encrypted, setting an intermediate number, using the number of the data type to be encrypted as the lower four bits of the intermediate number, and using the serial number of the sector where the initial storage location of the storage location is located as the upper four bits of the intermediate number, calculating the remainder between the intermediate data and the total number of key pairs in the key pair library, and using the key pair in the key pair library with the serial number equal to the remainder as the encryption key and decryption key of the data to be encrypted;
[0045] Specifically, the solid-state hard disk includes a plurality of sectors, and the sectors are the smallest units for reading and writing data. The sectors of the solid-state hard disk are sorted according to the size of the storage address. Here, the sectors are at the bottom layer of the solid-state hard disk partition. Since each storage location corresponds to a storage address, for example: 0x1000ffff, the smaller the storage address in the sector, the smaller the serial number of the sector. The data types that can be stored in the solid-state hard disk are numbered. The data types that can be stored in the solid-state hard disk include at least text, audio, image, video and program. For example, the text is numbered 0x01, the audio is numbered 0x02, the image is numbered 0x03, the video is numbered 0x04, and the program is numbered 0x05. According to the type of the data to be encrypted, The corresponding number is obtained by type, and the serial number of the sector where the initial storage location of the data storage location to be encrypted is located is used as the upper four bits of the above-mentioned intermediate number, and the type number of the above-mentioned data to be encrypted is used as the lower four bits of the above-mentioned intermediate number, wherein the above-mentioned intermediate number is octal, and the remainder between the above-mentioned intermediate number and the total number of key pairs in the above-mentioned key pair library is calculated, and the key pair with the key pair serial number in the above-mentioned key pair library equal to the above-mentioned remainder is used as the encryption key and decryption key of the above-mentioned data to be encrypted, wherein the serial number of the above-mentioned key pair is determined by the solidification order of the above-mentioned key pair in the above-mentioned solid-state hard disk, and the earlier the serial number is solidified, the smaller the serial number. Through the above-mentioned technical solution, the encryption keys of different data types stored in the same sector are different, and the encryption keys of the same data type stored in different sectors are also different, thereby increasing the security of the data.
[0046] Step S22: Divide the data to be encrypted into N data groups, wherein the data length of the first data group is S, where S+K is less than or equal to the remaining space of the sector where the initial storage location is located and is the maximum data size of the data group that can be stored in the sector where the initial storage location is located; the data length of the i-th data group is MK, where i is greater than or equal to 2 and less than N, M is the data capacity of the sector, K is the data length of the relevant data corresponding to the data group, and the length of the N-th data group is the amount of data remaining after excluding the first N-1 data groups from the data to be encrypted;
[0047] Step S23: Encrypt each of the data groups using the encryption key and encryption algorithm to generate the first encrypted data corresponding to each of the data groups.
[0048] Specifically, when the initial storage location of the storage location of the data to be encrypted is a new sector, that is, the starting position of a sector, the data to be encrypted is divided into N data groups. Since the minimum encryption unit of the solid-state hard disk is a sector, that is, in order to ensure the security of the data, each sector can have at most one encryption method. Therefore, when the data to be encrypted is at least larger than the capacity of a sector, when dividing the data groups, the first data group needs to be divided according to the remaining space of the written sector, and the data group is divided according to the sector starting from the second data group. The last data group is the last remaining data. Since the encryption algorithm of the data group adopts a symmetric encryption algorithm, the data The data length of the Nth data group is consistent with the data length of the first encrypted data corresponding to the encryption, and the number of the first N-1 data groups is an integer multiple of the minimum encryption unit of the encryption algorithm. For example, the minimum encryption unit is 32 bytes. When the Nth data group is not the minimum encryption unit, supplementary data is added to the Nth data group so that the data length of the Nth data group is an integer multiple of the minimum encryption unit, and each of the data groups is encrypted by the encryption key and encryption algorithm to obtain the first encrypted data corresponding to each of the data groups. Through the technical solution, the first encrypted data corresponding to each of the data groups can be obtained, thereby improving the security of the data.
[0049] Furthermore, the data length of the first encrypted data is equal to the data length of the data group corresponding to the first encrypted data.
[0050] Specifically, since the above encryption algorithm adopts a symmetric encryption algorithm and makes the data length of the above data group before and after encryption consistent, the data length of the above data group after encryption can be obtained before encryption, which is convenient for allocating storage space for storing the first encrypted data after the above data group is encrypted.
[0051] Furthermore, step S3 includes: performing a logical operation on the decryption key corresponding to the encryption key, the logical operation being an exclusive OR operation, to obtain the logical decryption key, using the logical decryption key, the data length of the data group, the data length of the data to be encrypted, and the verification data of the data group as the ancillary data of the data group, adding preset separators between two adjacent items in the ancillary data, and using the ancillary data with the preset separators added as the related data of the data group, wherein the related data and the data group are stored in the same sector, and the related data is stored in front of the corresponding data group.
[0052] Specifically, a logical operation is performed on the decryption key corresponding to the encryption key, wherein the logical operation is an exclusive OR operation, and the data length of the data group, the data length of the data to be encrypted, the check data of the data group and the logical decryption key are used as the subsidiary data of the data group, wherein the first encrypted data and the subsidiary data corresponding to the data group are both stored in the sector in binary format. Therefore, the decryption key is also first converted into binary and then subjected to an exclusive OR operation. The object of the exclusive OR of each bit of the decryption key is 1, and the subsidiary data are separated by a preset separator, for example: Related data format: @@array data length @@##data length to be encrypted The verification data of the data group is %% and the logical decryption key is %. Through the above technical solution, when reading the content of the sector where the data group is located, all the data of the data group is obtained through the data length of the data group, and whether to continue reading the data of the next sector is determined by the data length of the data to be encrypted and the total length of the data group that has been read out. The decryption key can be decrypted by performing an XOR operation on the logical decryption key again, which reduces the workload of managing the decryption key. At the same time, even if a security attack occurs, it is not known which is the decryption key, let alone whether the decryption key has undergone a logical operation, thereby improving data security and reducing the workload of key management.
[0053] Furthermore, the step S5 includes:
[0054] Step S51: according to the initial reading position of the data to be decrypted, obtaining the target sector where the initial reading position is located, reading out all the data in the target sector, and using all the data as the second encrypted data;
[0055] Step S52: identifying the length of the data group, the data length of the data to be decrypted, and the logical decryption key corresponding to the first encrypted data based on the initial reading position and the preset delimiter in the relevant data;
[0056] Step S53: Obtain the first encrypted data from the second encrypted data based on the data length of the first encrypted data, perform a logical operation on the logical decryption key again to obtain the decryption key, decrypt the first encrypted data using the decryption key and the decryption algorithm to obtain the data group corresponding to the first encrypted data.
[0057] Specifically, the above-mentioned initial reading position of the above-mentioned data to be decrypted is obtained through the position management unit, and the second encrypted data of the target sector is read according to the above-mentioned initial reading position. Since the above-mentioned target sector may include not only the above-mentioned data to be decrypted that is accessed, but also other data, therefore, the starting position of the above-mentioned data to be decrypted is obtained through the above-mentioned initial reading position, and the relevant data of the data group corresponding to the above-mentioned data to be decrypted is obtained from the starting position, and the data length of the data group is read from the above-mentioned relevant data, and the first encrypted data corresponding to the above-mentioned data group is read based on the data length of the above-mentioned data group, and the above-mentioned logical decryption key is obtained from the above-mentioned relevant data, and the above-mentioned logical decryption key is subjected to an XOR operation again to obtain the decryption key, and the above-mentioned first encrypted data is decrypted using the above-mentioned decryption key and the decryption algorithm to obtain the above-mentioned data group corresponding to the above-mentioned first encrypted data. Through the above-mentioned technical solution, since other data may be stored in the same sector and may be of different types, and their decryption passwords are also different, the above-mentioned data to be decrypted can be accurately decrypted from the above-mentioned solid-state hard disk without leaking other encrypted data in the same sector, thereby improving data security.
[0058] Furthermore, the step S53 further includes a step S54:
[0059] The next sector of the target sector is used as the new target sector, and steps S51 to S53 are repeated to read and decrypt the other data groups in the new target sector according to the method of the first encrypted data corresponding to the data group. The data length of each decrypted data group is added together to calculate the sum of the data lengths. When the sum of the data lengths is equal to the length of the data to be decrypted, the process ends.
[0060] Specifically, through the above technical solution, the above data to be decrypted can be decrypted to obtain corresponding decrypted data, which not only reduces the workload of managing encryption keys but also improves data security.
[0061] Furthermore, step S5 is followed by step S6: calculating the verification result of each data group decrypted from the data to be decrypted, and comparing the verification result with the verification data in the related data corresponding to the data group; when the verification result and the verification data of each data group are consistent, splicing each data group in the reading order to obtain the complete decrypted data; when the verification result and the verification data of at least one data group are inconsistent, repeating step S5 to re-read the first encrypted data corresponding to at least one data group, and re-decrypting.
[0062] Specifically, by comparing the verification result of each of the above data groups with the verification data, it can be determined whether the decrypted data group is correct. When the two are consistent, the decryption of the above data group is correct. Each of the above data groups can be spliced in the reading order to obtain the decrypted data of the above data to be decrypted. When the inspection result of at least one data group in the above data groups is inconsistent with the verification data, it is necessary to re-read the first encrypted data and related data corresponding to the above data group and re-decrypt the above data group. Through the above technical solution, it can be verified whether the decrypted data group is correct, which not only ensures the security of the data, but also improves the correctness of the decrypted data.
[0063] Furthermore, it is characterized in that the encryption algorithm and the decryption algorithm are symmetric key encryption algorithms of the Advanced Encryption Standard.
[0064] Furthermore, each sector can store multiple types of encrypted data.
[0065] Specifically, since different types of encrypted data have corresponding encryption keys that are different in the same sector, when one type of encrypted data is read, the keys of other types of data will not be leaked, thereby improving data security.
[0066] In summary, the present invention receives the data to be encrypted through a receiving unit, and obtains the data length and type of the data to be encrypted, allocates a storage location for the data to be encrypted according to the data length of the data to be encrypted and the remaining space of the solid-state hard disk, uses the serial number of the sector where the initial storage location of the data storage location to be encrypted is located as the upper four bits of the intermediate number, and uses the type number of the data to be encrypted as the lower four bits of the intermediate number, wherein the intermediate number is in octal, and calculates the remainder of the intermediate number and the total number of key pairs in the key pair library, and uses the key pair with the key pair serial number in the key pair library equal to the remainder as the encryption key and decryption key of the data to be encrypted, so that different data types stored in the same sector have different encryption keys, and the same data type stored in different sectors also has different encryption keys, thereby increasing the security of the data, and by using the decryption key corresponding to the encryption key The encryption key is subjected to a logical operation, wherein the logical operation is an exclusive OR operation, and the data length of the data group, the data length of the data to be encrypted, the check data of the data group and the logical decryption key are used as the auxiliary data of the data group. When reading the content of the sector where the data group is located, all the data of the data group is obtained through the data length of the data group, and whether to continue reading the data of the next sector is determined by the data length of the data to be encrypted and the total length of the read data group. The decryption key can be decrypted by performing an exclusive OR operation on the logical decryption key again, thereby reducing the workload of managing the decryption key. At the same time, even if a security attack occurs, it is not known which one is the decryption key, let alone whether the decryption key has undergone a logical operation. Through the mutual cooperation of the above technical solutions, not only the security of the data is improved, but also the workload of key management is reduced.
[0067] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, 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.
[0068] The above embodiments merely represent several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the scope of the present invention, and these modifications and improvements fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be based on the appended claims.
[0069] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for controlling encryption in manufacturing a solid-state hard disk, wherein the solid-state hard disk comprises a plurality of sectors, characterized in that: The method comprises the following steps: Step S1: First, the key pair library is fixed to the solid-state drive, the receiving unit receives the data to be encrypted, and obtains the data length and type of the data to be encrypted, and allocates a storage location for the data to be encrypted according to the data length of the data to be encrypted and the remaining space of the solid-state drive; Step S2: The key generation unit generates an encryption key based on the storage location, the type of data to be encrypted and the key pair library, divides the data to be encrypted into multiple data groups, and encrypts the data groups using the encryption key and the encryption algorithm to generate first encrypted data; Step S2 includes the following steps: Step S21: Sort the sectors of the solid-state hard disk according to the size of the storage address, and obtain the sorting of each sector, and also number the data types that the solid-state hard disk can store, and obtain the number of the data type to be encrypted, set the middle number, and use the number of the data type to be encrypted as the lower four bits of the middle number, and use the serial number of the sector where the initial storage location of the storage location is located as the upper four bits of the middle number, calculate the remainder of the middle number and the total number of key pairs in the key pair library, and use the key pair with the same serial number and remainder in the key pair library as the encryption key and decryption key of the data to be encrypted; Step S22: Divide the data to be encrypted into N data groups; so that the encryption keys of different data types stored in the same sector are different, and the encryption keys of the same data type stored in different sectors are also different; Step S3: performing a logical operation on the decryption key corresponding to the encryption key to obtain a logical decryption key, generating related data of the first encrypted data based on the data length of the data group, the data length of the data to be encrypted, the check data of the data group, and the logical decryption key, and storing the first encrypted data and the corresponding related data in the same sector of the storage location; Step S3 includes: performing a logical operation on the decryption key corresponding to the encryption key, the logical operation being an exclusive OR operation, to obtain the logical decryption key, using the logical decryption key, the data length of the data group, the data length of the data to be encrypted, and the check data of the data group as supplementary data of the data group, adding a preset delimiter between adjacent two items in the supplementary data, and using the supplementary data with the preset delimiter added as the related data of the data group, wherein the related data and the data group are stored in the same sector, and the related data is stored in front of the corresponding data group; Step S4: The encrypted data to be encrypted is used as the data to be decrypted, access rights to the data to be decrypted are set, and an access password is generated. After the user enters the access password, the initial reading position of the data to be decrypted is obtained through the position management unit according to the user's operation command, if the operation command is decryption; Step S5: Based on the initial reading position, read the data to be decrypted and the related data corresponding to the data to be decrypted, obtain the decryption key through the related data, decrypt the data to be decrypted based on the decryption key, and obtain the decrypted data; Step S51: According to the initial reading position of the data to be decrypted, obtain the target sector where the initial reading position is located, read out all the data in the target sector, and use all the data as the second encrypted data; Step S52: Based on the initial reading position and the preset delimiter in the related data, identify the length of the data group, the data length of the data to be decrypted and the logical decryption key corresponding to the first encrypted data; Step S53: Based on the data length of the first encrypted data, obtain the first encrypted data from the second encrypted data, perform logical operation on the logical decryption key again to obtain the decryption key, decrypt the first encrypted data using the decryption key and the decryption algorithm, and obtain the data group corresponding to the first encrypted data.
2. The method according to claim 1, characterized in that Step S1 includes: The key pair library includes multiple encryption key and decryption key pairs. The data types that can be stored in the solid-state drive include text, audio, image, video and program. The type of the data to be encrypted is one of the data types.
3. The method according to claim 1, characterized in that The data length of the first encrypted data is equal to the data length of the data group corresponding to the first encrypted data.
4. The method according to claim 1, wherein Step S53 is followed by step S54: The next sector of the target sector is used as the new target sector, and the method of the first encrypted data corresponding to the data group from step S51 to step S53 is repeated to read and decrypt other data groups in the new target sector, and the data length of each decrypted data group is added together to calculate the sum of the data lengths. When the sum of the data lengths is equal to the length of the data to be decrypted, the process ends.
5. The method according to claim 1, wherein Step S5 is followed by step S6: the verification result of each data group decrypted from the data to be decrypted is calculated, and the verification result is compared with the verification data in the relevant data corresponding to the data group. When the verification result and the verification data of each data group are consistent, each data group is spliced in the reading order to obtain the complete decrypted data. When the verification result and the verification data of at least one data group are inconsistent, step S5 is repeated to re-read the first encrypted data corresponding to at least one data group, and decrypt again.
6. The method according to claim 1, wherein The step S22 includes: the data length of the first data group is S, S+K is less than or equal to the remaining space of the sector where the initial storage position is located, and is the data amount of the maximum data group that can be stored in the sector where the initial storage position is located, the data length of the i-th data group is MK, i is greater than or equal to 2 and less than N, M is the data capacity of the sector, K is the data length of the relevant data of the corresponding data group, and the length of the N-th data group is the amount of remaining data after the encrypted data is removed from the first N-1 data groups; step S23: encrypt each data group using the encryption key and encryption algorithm to generate the first encrypted data corresponding to each data group.
7. The method according to claim 1, characterized in that The encryption and decryption algorithms are symmetric key encryption algorithms of the Advanced Encryption Standard.
8. The method according to claim 1, characterized in that Each sector can store multiple types of encrypted data.
Citation Information
Patent Citations
Hard disk data protection method and device, equipment and storage medium
CN118152306A
Storage device having encryption
US11644983B2
Hard drive data write / read method and device
CN102930224A
Encrypted data reading method and device for solid state disk and readable storage medium
CN117892319A