Dual-control key management method, system, encryption machine and storage medium
By adopting a dual-control key management method on the encryption machine, synthesizing the protection key and decrypting the root key ciphertext block, the problem of the root key being unable to be destroyed in time is solved, the safe use and timely removal of the root key is realized, and the cost is reduced Data breach risk.
Patent Information
- Application Number
- CN202210127930.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-11
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-02-11
AI Technical Summary
In the prior art, the root key cannot be destroyed in time, resulting in the root key being easily leaked.
Use the dual -control key management method to synthesize the protection key when you log in to the encryption machine at least two operators, obtain the root secret keys and decrypt. The protective key was subsequently processed and cleared when the operator exit logs in.
Get the root key when the encryption machine is used, and remove it in time after use to prevent the root key from leakage, reduce the risk of data leakage, and ensure high availability.
Smart Images

Figure CN114499825B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and further to a dual-control key management method, system, encryption machine and storage medium. Background Art
[0002] According to the key usage principle, the key plaintext cannot appear for a long time; and the software encryption machine uses the key, which inevitably requires the key plaintext; the key plaintext in the encryption machine is destroyed after use, and when the key is used again, the key plaintext can be obtained from the key ciphertext, so the key that encrypts the key plaintext is called the root key.
[0003] The root key needs to be used frequently in the software encryption machine. Therefore, the root key must have the following characteristics:
[0004] ①Cannot be destroyed after use;
[0005] ②It cannot be kept in the software encryption machine all the time;
[0006] ③ Unpredictable;
[0007] Therefore, how to enable the software encryption machine to obtain the root key when it is used and prevent the root key from being leaked is a technical problem that needs to be solved urgently. Summary of the invention
[0008] In view of the above technical problems, the purpose of the present invention is to solve the technical problem in the prior art that the root key cannot be destroyed in time, resulting in the root key being easily leaked.
[0009] In order to achieve the above object, the present invention provides a dual-control key management method, comprising:
[0010] In some implementations, a dual-control key management method includes the steps of:
[0011] Synthesize the protection key when at least two operators are logged into the encryption machine;
[0012] Obtain a root key ciphertext block, and use the protection key to decrypt the root key ciphertext block to obtain padding data and a root key;
[0013] If the padding data is verified to be correct, the protection key and the root key are determined to be correct, and the root key is cleared;
[0014] White-boxing the protection key to generate a protection key white box, and clearing the protection key;
[0015] The protection key whitebox is cleared when the operator logs out of the encryption machine.
[0016] In some embodiments, the synthetic protection key includes,
[0017] Obtaining the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password;
[0018] Performing hash encryption calculation on the hardware identification to generate a second hash value;
[0019] Performing hash encryption calculation on the account information to generate a third hash value;
[0020] The protection key is calculated and synthesized according to the second Hash value and the third Hash value, and the second Hash value and the third Hash value are cleared.
[0021] In some implementations, before obtaining the root key ciphertext block, the method further includes:
[0022] Determining whether the root key ciphertext block already exists in the encryption machine;
[0023] If not, performing hash encryption calculation on the key input moments of the at least two operators to generate a first hash value;
[0024] Obtaining a random number randomly generated by an encryption machine, and generating a root key by calculating the random number and the first Hash value, and then clearing the first Hash value, the random number and the key input time;
[0025] The root key is encrypted according to the protection key to generate a root key ciphertext block, the root key ciphertext block is stored and the root key is cleared.
[0026] In some implementations, encrypting the root key according to the protection key to generate a root key ciphertext block, storing the root key ciphertext block and clearing the root key comprises the steps of:
[0027] Filling the root key according to a preset filling algorithm to generate a ciphertext data block;
[0028] According to a preset encryption mode, using the protection key to encrypt the ciphertext data block to generate a root key ciphertext block;
[0029] The root key is cleared after the root key ciphertext block is saved in the form of a file.
[0030] In some embodiments, the steps are further included:
[0031] Counting the total number of failed attempts to log into the encryption machine, and determining whether the total number of failed attempts exceeds a preset number threshold within a preset time period;
[0032] If the total number of times within the preset time exceeds the preset number threshold, all key-related data will be cleared.
[0033] According to another aspect of the present invention, the present invention further provides a dual-control key management system, comprising:
[0034] A processing module for synthesizing a protection key when at least two operators log into the encryption machine;
[0035] A decryption module, used to obtain a root key ciphertext block, and use the protection key to perform decryption calculation on the root key ciphertext block to obtain padding data and a root key;
[0036] A verification module, configured to determine that the protection key and the root key are correct and clear the root key if the padding data is verified to be correct;
[0037] The processing module is further used to perform white-box processing on the protection key to generate a protection key white box, and clear the protection key;
[0038] The processing module is also used to clear the protection key white box when the operator logs out of the encryption machine.
[0039] In some embodiments, the processing module includes:
[0040] An acquisition unit, used to acquire the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password;
[0041] A computing unit, configured to perform a hash encryption calculation on the hardware identifier to generate a second hash value;
[0042] The calculation unit is further used to perform hash encryption calculation on the account information to generate a third hash value;
[0043] The calculation unit is further used to calculate and synthesize the protection key according to the second Hash value and the third Hash value, and clear the second Hash value and the third Hash value.
[0044] In some implementations, the dual-control key management system further includes:
[0045] A judging module, used for judging whether the root key ciphertext block already exists in the encryption machine;
[0046] A generating module, for performing a hash encryption calculation on the key input moment of the operator to generate a first hash value when it is determined that the root key does not exist in the encryption machine;
[0047] An acquisition module is used to obtain a random number randomly generated by an encryption machine;
[0048] The processing module is further used to calculate and generate a root key according to the random number and the first Hash value, and then clear the first Hash value, the random number and the key input time;
[0049] The processing module is further used to encrypt the root key according to the protection key to generate a root key ciphertext block, store the root key ciphertext block and clear the root key.
[0050] In some embodiments, the processing module further includes:
[0051] A generating unit, used for padding the root key according to a preset padding algorithm to generate a ciphertext data block;
[0052] An encryption unit, configured to encrypt the ciphertext data block using the protection key to generate a root key ciphertext block according to a preset encryption mode;
[0053] The processing unit is used to clear the root key after saving the root key ciphertext block in the form of a file.
[0054] In some implementations, the dual-control key management system further includes:
[0055] A statistical judgment module, used to count the total number of failed login attempts to the encryption machine, and to judge whether the total number of failed login attempts exceeds a preset number threshold within a preset time period;
[0056] The processing module is further configured to clear all key-related data if the total number of times exceeds a preset number threshold within a preset time period.
[0057] According to another aspect of the present invention, the present invention further provides an encryption machine, including a processor, a memory, and a computer program stored in the memory and runnable on the processor, wherein the processor is used to execute the computer program stored in the memory to implement the operations performed by the dual-control key management method.
[0058] According to another aspect of the present invention, the present invention further provides a storage medium, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the operations performed by the dual-control key management method.
[0059] Compared with the prior art, the dual-control key management method, system, encryption machine and storage medium provided by the present invention are capable of obtaining the root key when the encryption machine needs to use it, and clearing the root key after use to ensure that the root key is not leaked, reduce the risk of data leakage and ensure high availability. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The preferred implementation modes will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present invention.
[0061] Figure 1 It is a flow chart of an embodiment of a dual-control key management method of the present invention;
[0062] Figure 2 It is a flow chart of another embodiment of a dual-control key management method of the present invention. DETAILED DESCRIPTION
[0063] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0064] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections.
[0065] In order to simplify the drawings, only the parts related to the present invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".
[0066] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0067] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0068] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.
[0069] AES is the abbreviation of Advanced Encryption Standard. AES is an advanced encryption standard.
[0070] Hash Function is a hash algorithm, which maps a binary value of any length to a shorter binary value of fixed length, and different plaintexts are difficult to map to the same binary value. Hash algorithms include MD5, SHA-1, SHA-256, SHA-384, SHA-512, SM3, etc.
[0071] White-Box Cryptography refers to white-box encryption technology, which is a cryptographic technology that can resist white-box attacks.
[0072] PKCS7 is the abbreviation of PKCS7 Padding, which is a data padding rule. In the block encryption algorithm (such as DES), we must first divide the original text into groups, then encrypt each group, and then assemble the ciphertext. Assuming that the length of the data to be padded needs to be padded with n (n>0) bytes to be aligned, then padded with n bytes, each byte is n; if the data to be padded is already aligned, then padded with a padding data of the length of the block size, each byte is the block size.
[0073] In one embodiment, the reference specification Figure 1 , a dual-control key management method, specifically, comprising:
[0074] S100 synthesizes the protection key when at least two operators log into the encryption machine;
[0075] S200 obtains a root key ciphertext block, and uses the protection key to decrypt the root key ciphertext block to obtain padding data and a root key;
[0076] Specifically, the encryption machine is mainly used to encrypt data. For example, in e-government applications, the encryption machine can provide functions such as data encryption and decryption, digital signature verification, etc. The encryption machine organically integrates a variety of advanced technologies such as cryptographic technology, high-performance concurrent processing technology, network security technology, equipment self-security protection technology, and high availability technology to build a software and hardware support environment to ensure information security, and provide autonomous and controllable data security protection services for the construction of information infrastructure and information security protection system. One of the main functions of the encryption machine is the key storage function. The encryption machine has been widely used in many fields, especially in the banking industry. The encryption machine of the present invention generally refers to a software encryption machine.
[0077] After the encryption machine is turned on, if the operator needs to log in to use the encryption machine, the encryption machine performs a modulo-2 operation based on the second hash value and the third hash value to synthesize a protection key. For details on how to synthesize the protection key, please refer to the following embodiments. The present invention is applicable to dual-control and multi-control scenarios, that is, scenarios that require at least two operators to enter their account numbers and passwords to log in to the encryption machine. After the encryption machine synthesizes the protection key, it uses the protection key to decrypt the root key ciphertext block read from the local storage of the encryption machine, that is, the protection key is used to reversely decrypt the root key ciphertext block to obtain the corresponding padding data and root key. In the present invention, since the root key is filled with padding data, the root key is the data to be filled, wherein the padding data is equivalent to the check value.
[0078] S300: If the padding data is verified to be correct, then the protection key and the root key are determined to be correct, and the root key is cleared;
[0079] Specifically, after obtaining the padding data through the above decryption process, it is necessary to verify whether the padding data is correct, and verifying whether the padding data is correct is actually verifying whether the length of the padding data is correct. If the length of the padding data is incorrect, it means that at least one operator entered an incorrect account password, and the root key obtained by decryption cannot be used. However, if the length of the padding data is correct, it means that the decryption obtains the real protection key, the root key obtained by decryption is correct, and the encryption machine will immediately clear the root key.
[0080] The padding data is associated with the root key, that is, the length of the padding data is related to whether the root key is aligned and the length of the root key. The padding rule can be any of the following padding methods: the padding data is the length of the padding byte, or the padding data is 0x0, and the length of the padding data is equal to the padding length of the data to be padded.
[0081] For example, when the encryption block of AES is a multiple of 16 bytes, if the length of the root key ciphertext block is 32 bytes, then if the 16 bytes following the root key after decrypting the root key ciphertext block are always 10H, it indicates 16 bytes of data padding, that is, the length of the padding data is 10H, i.e. 16 bytes, and the length of the root key is 16 bytes.
[0082] For example, when the encryption block of AES is a multiple of 16 bytes, if the length of the root key ciphertext block is 32 bytes, then if the 8 bytes following the root key after decrypting the root key ciphertext block are always 08H, it indicates 8 bytes of data padding, that is, the length of the padding data is 8 bytes, and the length of the root key is 24 bytes.
[0083] For example, when the encryption block of AES is a multiple of 16 bytes, if the length of the root key ciphertext block is 48 bytes, then if the 16 bytes following the root key after decrypting the root key ciphertext block are always 10H, it indicates 16 bytes of data padding, that is, the length of the padding data is 16 bytes, and the length of the root key is 32 bytes.
[0084] Exemplarily, in the case where the encryption block of DES is a multiple of 8 bytes, if the length of the root key ciphertext block is 16 bytes, then if the 8 bytes following the root key after decrypting the root key ciphertext block are always 08H, it indicates 8-byte data padding, that is, the length of the padding data is 8 bytes, and the length of the root key is 8 bytes. For example, if the root key ciphertext block is "FF FF FF FF FF FF FF FF 08 08 08 08 08 08 08", and the padding rule is that the padding data is the length of the padding bytes, then the padding data is "08 08 08 08 08 08 08", and the root key is FF FF FFFF FF FF FF FF.
[0085] In the above example, the root key lengths of the AES encryption algorithm are only 16, 24, and 32. Of course, the root key lengths of the DES encryption algorithm are only 8, 16, and 24. The root key length of the SM4 encryption algorithm is only 16. Regardless of the hash algorithm, the padding rules followed are applicable to the above verification process, and will not be repeated here.
[0086] S400 performs white-box processing on the protection key to generate a protection key white box, and clears the protection key;
[0087] S500 clears the protection key white box when the operator logs out of the encryption machine.
[0088] Specifically, after verifying that the protection key and the root key are correct in the above manner, it can be determined that the root key ciphertext block is also correct. Then, the encryption machine uses the standard cryptographic algorithm to white-box the root key ciphertext block, so that the confidentiality key is used as the key of the protection key white box to complete the construction of the protection key white box. After the protection key white box is constructed, the root key ciphertext block is immediately cleared. Among them, since the protection key needs to be involved in encryption and decryption operations as a key, this protection key is constructed into a protection key white box (that is, the protection key white box of the present invention). The present invention uses the standard cryptographic algorithm to white-box the protection key white box, and then clears the protection key. The above process is that each time the operator logs in to use the encryption machine, the protection key white box will be reconstructed, and the root key ciphertext block will be cleared after each construction of the protection key white box. In addition, if the operator needs to log out after using the encryption machine, the encryption machine will also clear all protection key white boxes. The protection key white box includes the hidden protection key.
[0089] The present invention obtains the root key when the encryption machine needs to use it, and clears the root key and the protection key after use to ensure that the root key and the protection key are not leaked, thereby ensuring the information security of interactive operations and avoiding information security issues. The entire decryption process is carried out in the encryption machine, effectively avoiding the problem of key leakage caused by storing the root key through software, protecting the security of the root key, reducing the manual management and maintenance costs of the root key, reducing the risk of data leakage and ensuring high availability.
[0090] In one embodiment, a dual-control key management method specifically includes:
[0091] S110, when at least two operators log in to the encryption machine, obtaining the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password;
[0092] Specifically, the hardware identification includes but is not limited to the MAC address of the encryption machine, the device serial number, the CPUID, and the unique device identification of the security chip. The encryption machine can retrieve the unique hardware identification of the device related to itself and mark the retrieved hardware identification as Mf1, Mf2, ..., Mfn.
[0093] The account information includes the login account and account password when the operator logs in to the encryption machine. The encryption machine can obtain the account information of different operators, and mark the login account as Op1, Op2, ..., Opn, and the account password as pwd1, pwd2, ..., pwdn.
[0094] S120 performs hash encryption calculation on the hardware identifier to generate a second hash value;
[0095] Specifically, the encryption machine connects these retrieved hardware identifiers to obtain a string of identification sequence data, and performs hash encryption calculation on the identification sequence data according to the hash encryption algorithm to obtain a second hash value. From the above, it can be seen that the second hash value is expressed as Hash(Mf1, Mf2, ..., Mfn), which is a random data of a fixed length.
[0096] S130 performs hash encryption calculation on the account information to generate a third hash value;
[0097] Specifically, there is no sequence between S120 and S130, and S120 and S130 can be executed successively or simultaneously. The encryption machine combines the operator's login account and account password to obtain account information, and the account information is identified as Op1×pwd1, Op2×pwd2, ..., Opn×pwdn. The encryption machine performs hash encryption calculations on the account information of different operators according to the hash encryption algorithm to obtain a third hash value. As can be seen from the above, the third hash value is represented as Hash(Op1×pwd1), Hash(Op2×pwd2), ..., Hash(Opn×pwdn).
[0098] S140: calculating and synthesizing the protection key according to the second Hash value and the third Hash value, and clearing the second Hash value and the third Hash value;
[0099] Specifically, the encryption machine uses the second hash value and the third hash value calculated in the above manner to output the protection key through modulo-2 operation, and immediately clears the second hash value and the third hash value. Modulo-2 operation is a binary algorithm, which includes four binary operations: modulo-2 addition, modulo-2 subtraction, modulo-2 multiplication, and modulo-2 division.
[0100] Exemplarily, the encryption engine substitutes the second hash value and the third hash value into the following modulo 2 addition formula to synthesize the protection key:
[0101] ProData=Hash(Op1×pwd1)xor Hash(Op2×pwd2)…xor Hash(Opn×pwdn)xorHash(Mf1, Mf2,…, Mfn).
[0102] Then, the encryption machine immediately clears the second hash value Hash(Mf1, Mf2, ..., Mfn) and the third hash value Hash(Op1×pwd1), Hash(Op2×pwd2), ..., Hash(Opn×pwdn) and other data.
[0103] S200 obtains a root key ciphertext block, and uses the protection key to decrypt the root key ciphertext block to obtain padding data and a root key;
[0104] S300: If the padding data is verified to be correct, then the protection key and the root key are determined to be correct, and the root key is cleared;
[0105] S400 performs white-box processing on the protection key to generate a protection key white box, and clears the protection key;
[0106] S500 clears the protection key white box when the operator logs out of the encryption machine.
[0107] Specifically, the parts of this embodiment that are the same as the above-mentioned embodiments refer to the above-mentioned embodiments, and will not be described one by one here. The present invention generates a root key in real time when the encryption machine needs to be used, and clears the root key and the protection key after use to ensure that the root key and the protection key are not leaked, to ensure the information security of interactive operations, and to avoid causing information security problems. The entire decryption process is carried out in the encryption machine, which effectively avoids the problem of key leakage caused by saving the root key through software, protects the security of the root key, reduces the manual management and maintenance costs of the root key, reduces the risk of data leakage and ensures high availability.
[0108] In one embodiment, the reference specification Figure 2 , a dual-control key management method, specifically, comprising the steps of:
[0109] S110, when at least two operators log in to the encryption machine, obtaining the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password;
[0110] S120 performs hash encryption calculation on the hardware identifier to generate a second hash value;
[0111] S130 performs hash encryption calculation on the account information to generate a third hash value;
[0112] S140: calculating and synthesizing the protection key according to the second Hash value and the third Hash value, and clearing the second Hash value and the third Hash value;
[0113] S150 determines whether the root key ciphertext block already exists in the encryption machine;
[0114] Specifically, the encryption machine is equipped with a security chip and a button battery. The security chip is provided with a data memory area. The button battery supplies power to the security chip. After powering on, the processor of the security chip encryption machine will detect and determine whether the root key ciphertext block already exists in the encryption machine. In other words, the processor of the encryption machine performs a secure boot after powering on, and during the secure boot process, the processor of the encryption machine detects whether the root key ciphertext block already exists in the data memory area.
[0115] The data memory area is a storage area that is inaccessible to the outside and the bus, and is powered by a special backup battery, namely a button battery. This data memory area is generally only 128 bytes of data in size. If the root key ciphertext block already exists in the data memory area of the encryption machine, the process ends. Of course, if the root key ciphertext block does not exist in the data memory area of the encryption machine, the encryption machine needs to generate the root key in real time. The following describes in detail how to generate the root key.
[0116] If not, S160, performing hash encryption calculation on the key input moments of the at least two operators to generate a first hash value;
[0117] Specifically, through the above process, it is determined that the encryption machine already has the root key ciphertext block and directly enters step S200. The key input moment is a time point or a timestamp, wherein the unit of this timestamp can be milliseconds, microseconds or even picoseconds, and the smaller the unit precision, the better. The encryption machine records the key input moment of each operator, and marks the key input moment as T1, T2, ..., Tn respectively. The encryption machine connects these key input moments in chronological order, and can obtain a string of time series data that changes over time. The time series data is hashed and calculated according to the hash encryption algorithm to obtain the first hash value. As can be seen from the above, the first hash value is expressed as Hash (T1, T2, ..., Tn), which is a random data of a fixed length.
[0118] S170 obtains a random number randomly generated by the encryption machine, and generates a root key by calculating the random number and the first Hash value, and then clears the first Hash value, the random number and the key input time;
[0119] Specifically, if it is determined through the above process that there is no root key ciphertext block in the encryption machine, the encryption machine will use the random number and the first hash value to calculate the root key through modulo 2 operation, and immediately clear the first hash value, random number and key input time.
[0120] Exemplarily, the encryption machine substitutes the random number and the first hash value into the following modulo 2 addition formula to synthesize the protection key:
[0121] RootKey=RND Xor Hash(T1, T2,...,Tn)
[0122] Then, the encryption machine immediately clears the random number, the first hash value Hash (T1, T2, ..., Tn) and the key input time T1, T2, ..., Tn and other data.
[0123] S180 encrypts the root key according to the protection key to generate a root key ciphertext block, stores the root key ciphertext block and clears the root key;
[0124] Specifically, the encryption machine will protect the key and the root key, generate a root key ciphertext block through an encryption algorithm, and then store the root key ciphertext block in the form of a file in the data memory area of the encryption machine, and immediately clear the root key generated in step S170 after the saving is completed.
[0125] S200 obtains a root key ciphertext block, and uses the protection key to decrypt the root key ciphertext block to obtain padding data and a root key;
[0126] S300: If the padding data is verified to be correct, then the protection key and the root key are determined to be correct, and the root key is cleared;
[0127] S400 performs white-box processing on the protection key to generate a protection key white box, and clears the protection key;
[0128] S500 clears the protection key white box when the operator logs out of the encryption machine.
[0129] Specifically, the parts of this embodiment that are the same as the above-mentioned embodiments refer to the above-mentioned embodiments, and will not be described one by one here. The present invention generates a root key in real time when the encryption machine needs to be used, and clears the root key and the protection key after use to ensure that the root key and the protection key are not leaked, to ensure the information security of interactive operations, and to avoid causing information security problems. The entire decryption process is carried out in the encryption machine, which effectively avoids the problem of key leakage caused by saving the root key through software, protects the security of the root key, reduces the manual management and maintenance costs of the root key, reduces the risk of data leakage and ensures high availability.
[0130] In one embodiment, a dual-control key management method specifically includes the steps of:
[0131] S110, when at least two operators log in to the encryption machine, obtaining the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password;
[0132] S120 performs hash encryption calculation on the hardware identifier to generate a second hash value;
[0133] S130 performs hash encryption calculation on the account information to generate a third hash value;
[0134] S140: calculating and synthesizing the protection key according to the second Hash value and the third Hash value, and clearing the second Hash value and the third Hash value;
[0135] S150 determines whether the root key ciphertext block already exists in the encryption machine;
[0136] If not, S160, performing hash encryption calculation on the key input moments of the at least two operators to generate a first hash value;
[0137] S170 obtains a random number randomly generated by the encryption machine, and generates a root key by calculating the random number and the first Hash value, and then clears the first Hash value, the random number and the key input time;
[0138] S181 fills the root key according to a preset filling algorithm to generate a ciphertext data block;
[0139] Specifically, the preset padding algorithm includes data padding algorithms such as PKCS7 or PKCS5. Among them, the present invention preferably uses PKCS7 for data padding. PKCS7 actually uses the ASCII code padding Char=chr (padding Size) represented by the numerical value of the required padding length to perform redundant padding on the data. For example, the ciphertext data block lengths corresponding to AES-128, AES-192, and AES-256 are 128 / 8=16 bytes, 192 / 8=24 bytes, and 256 / 8=32 bytes, respectively.
[0140] The encryption machine fills the root key according to a preset filling algorithm so that the filled root key is an integer multiple of the preset group byte number, and then the encryption machine groups the filled root key into equal bytes according to the preset group byte number to generate a ciphertext data block.
[0141] Exemplarily, when the byte length of the root key is 8 bytes, the preset filling algorithm is the PKCS7 filling algorithm. If the filling data is "08 08 08 08 08 08 08", then the filling-generated ciphertext data block is "root key + 08 08 08 08 08 08 08".
[0142] S182, according to a preset encryption mode, using the protection key to encrypt the ciphertext data block to generate a root key ciphertext block;
[0143] Specifically, the root key uses the PKCS7 padding method to form a ciphertext data block, and then uses the protection key as the key, uses the preset encryption mode to encrypt and generate the root key ciphertext block, and saves the root key ciphertext block in a file and then immediately clears the root key. The preset encryption mode includes CBC encryption mode and GCM encryption mode. Among them, CBC is the abbreviation of CipherBlock Chaining. The CBC encryption mode is a cipher block chaining mode. This mode first divides the ciphertext data block into several small segments, and then each small segment is XORed with the initial block or the sub-data block of the previous segment, and then encrypted with the protection key to generate the root key ciphertext block. GCM is the abbreviation of Galois / Counter Mode. The GCM encryption mode uses the root key as plaintext, the protection key as the encryption key, and the initial vector and additional message to perform a series of XOR operations to generate the root key ciphertext block.
[0144] Exemplarily, the ciphertext data block is encrypted using the protection key in combination with the AES+CBC mode to generate the root key ciphertext block as follows:
[0145] Erookey=AES-CBC(ProData{(RootKey+PKCS7)})
[0146] Among them, AES is an encryption algorithm, and CBC is a preset encryption mode, which needs to be used simultaneously in order to have encryption and verification functions. Of course, the present invention can also use other encryption algorithms (such as DES encryption algorithm, SM4 encryption algorithm, etc.) and other encryption modes (such as GCM encryption mode, etc.), but AES is the most universal and easy to understand, and it is the only one that supports 256-bit keys. Therefore, the present invention preferably uses AES+CBC mode for encryption.
[0147] S183 saves the root key ciphertext block in the form of a file and then deletes the root key;
[0148] Specifically, the root key ciphertext block is the data generated by encrypting the root key using the protection key using the above-mentioned preset encryption mode. The encryption machine saves the generated root key ciphertext block in the form of a file. Only when the protection key is possessed, the root key ciphertext block is meaningful to avoid violating the encryption rules.
[0149] S200 obtains a root key ciphertext block, and uses the protection key to decrypt the root key ciphertext block to obtain padding data and a root key;
[0150] S300: If the padding data is verified to be correct, then the protection key and the root key are determined to be correct, and the root key is cleared;
[0151] S400 performs white-box processing on the protection key to generate a protection key white box, and clears the protection key;
[0152] S500 clears the protection key white box when the operator logs out of the encryption machine;
[0153] S600 counts the total number of failed attempts to log into the encryption machine and determines whether the total number of attempts exceeds a preset number threshold within a preset time period;
[0154] S700 clears all key-related data if the total number of times exceeds a preset number threshold within a preset time period.
[0155] Specifically, the execution order of S600-S700 is after the encryption machine is turned on and before the encryption machine is turned off. In short, after the encryption machine is turned on, it records the number of times the operator enters the login account, verifies the number of times the entered account password does not match the login account, and then calculates the total number of failed login attempts to the encryption machine. The security chip built into the encryption machine determines whether the total number of times within a preset time period exceeds a preset number threshold. If the total number of failed login attempts to the encryption machine within a preset time period exceeds a preset number threshold, the encryption machine will clear all key-related data. Among them, the key-related data includes the first hash value, the second hash value, the third hash value, the key input time, the random number, the root key, the protection key, and the root key ciphertext block of the above-mentioned embodiment.
[0156] The present invention uses the operator login and logout as the entry point, records the key input time during the operator inputting the account password, and then performs hash processing on the account information (login account and account password) input by the operator and the key input time, and the hardware identification of the encryption machine, so as to achieve the goal of random generation of the root key, re-synthesis when logged in, and destruction of the root key when not in use (i.e., when logging out). The present invention immediately deletes the parameters involved in the hash encryption calculation after completing the key synthesis calculation (see steps S140, S170-S180), and immediately deletes the root key after the verification is completed (see step S300), immediately deletes the protection key after the construction of the protection key white box (see step S400), deletes the protection key white box when logging out of the encryption machine (see step S500), and deletes all key-related data when the encryption machine is subjected to an exhaustive attack (see steps S600-S700), achieving the purpose of timely destruction of all keys. Therefore, the present invention effectively reduces the risk of root key leakage, protects the security of the root key, and greatly improves the information security in the terminal.
[0157] According to another aspect of the present invention, a dual-control key management system includes:
[0158] A processing module for synthesizing a protection key when at least two operators log into the encryption machine;
[0159] A decryption module, used to obtain a root key ciphertext block, and use the protection key to perform decryption calculation on the root key ciphertext block to obtain padding data and a root key;
[0160] A verification module, configured to determine that the protection key and the root key are correct and clear the root key if the padding data is verified to be correct;
[0161] The processing module is further used to perform white-box processing on the protection key to generate a protection key white box, and clear the protection key;
[0162] The processing module is also used to clear the protection key white box when the operator logs out of the encryption machine.
[0163] Specifically, this embodiment is a system embodiment corresponding to the above method embodiment. For specific effects, please refer to the above method embodiment, which will not be described in detail here.
[0164] In one embodiment, the processing module includes:
[0165] An acquisition unit, used to acquire the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password;
[0166] A computing unit, configured to perform a hash encryption calculation on the hardware identifier to generate a second hash value;
[0167] The calculation unit is further used to perform hash encryption calculation on the account information to generate a third hash value;
[0168] The calculation unit is further used to calculate and synthesize the protection key according to the second Hash value and the third Hash value, and clear the second Hash value and the third Hash value.
[0169] Specifically, this embodiment is a system embodiment corresponding to the above method embodiment. For specific effects, please refer to the above method embodiment, which will not be described in detail here.
[0170] In one embodiment, the dual-control key management system further includes:
[0171] A judging module, used for judging whether the root key ciphertext block already exists in the encryption machine;
[0172] A generating module, for performing a hash encryption calculation on the key input moment of the operator to generate a first hash value when it is determined that the root key does not exist in the encryption machine;
[0173] An acquisition module is used to obtain a random number randomly generated by an encryption machine;
[0174] The processing module is further used to calculate and generate a root key according to the random number and the first Hash value, and then clear the first Hash value, the random number and the key input time;
[0175] The processing module is further used to encrypt the root key according to the protection key to generate a root key ciphertext block, store the root key ciphertext block and clear the root key.
[0176] Specifically, this embodiment is a system embodiment corresponding to the above method embodiment. For specific effects, please refer to the above method embodiment, which will not be described in detail here.
[0177] In one embodiment, the processing module further includes:
[0178] A generating unit, used for padding the root key according to a preset padding algorithm to generate a ciphertext data block;
[0179] An encryption unit, configured to encrypt the ciphertext data block using the protection key to generate a root key ciphertext block according to a preset encryption mode;
[0180] The processing unit is used to clear the root key after saving the root key ciphertext block in the form of a file.
[0181] Specifically, this embodiment is a system embodiment corresponding to the above method embodiment. For specific effects, please refer to the above method embodiment, which will not be described in detail here.
[0182] In one embodiment, the dual-control key management system further includes:
[0183] A statistical judgment module, used to count the total number of failed login attempts to the encryption machine, and to judge whether the total number of failed login attempts exceeds a preset number threshold within a preset time period;
[0184] The processing module is further configured to clear all key-related data if the total number of times exceeds a preset number threshold within a preset time period.
[0185] Specifically, this embodiment is a system embodiment corresponding to the above method embodiment. For specific effects, please refer to the above method embodiment, which will not be described in detail here.
[0186] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned program modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program units or modules to complete all or part of the functions described above. The program modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a processing unit, and the above-mentioned integrated unit can be implemented in the form of hardware or in the form of software program units. In addition, the specific names of the program modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application.
[0187] One embodiment of the present invention provides an encryption machine, including a processor and a memory, wherein the memory is used to store computer programs; the processor is used to execute the computer programs stored in the memory, and when the computer program is executed by the processor, the steps of the dual-control key management method described in any one or more of the above embodiments are implemented.
[0188] The encryption machine can be a desktop computer, a notebook, a PDA, a tablet computer, a mobile phone, a human-computer interaction screen and other devices. The encryption machine may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that the above is only an example of an encryption machine and does not constitute a limitation on the encryption machine. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the encryption machine may also include an input / output interface, a display device, a network access device, a communication bus, a communication interface, etc. The communication interface and the communication bus may also include an input / output interface, wherein the processor, the memory, the input / output interface and the communication interface communicate with each other through the communication bus. The memory stores a computer program, and the processor is used to execute the computer program stored in the memory to implement the dual-control key management method in the above corresponding method embodiment.
[0189] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0190] The memory may be an internal storage unit of the encryption machine, such as a hard disk or memory of the encryption machine. The memory may also be an external storage device of the encryption machine, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the encryption machine. Furthermore, the memory may include both an internal storage unit of the encryption machine and an external storage device. The memory is used to store the computer program and other programs and data required by the encryption machine. The memory may also be used to temporarily store data that has been output or is to be output.
[0191] The communication bus is a circuit that connects the elements described and implements transmission between these elements. For example, the processor receives commands from other elements through the communication bus, decrypts the received commands, and performs calculations or data processing according to the decrypted commands. The memory may include program modules, such as a kernel, middleware, an application programming interface (API), and an application. The program module may be composed of software, firmware, or hardware, or at least two of them. The input / output interface forwards commands or data entered by the user through the input / output interface (such as a sensor, keyboard, touch screen). The communication interface connects the encryption machine to other network devices, user devices, and networks. For example, the communication interface can be connected to the network by wire or wireless to connect to other external network devices or user devices. Wireless communication may include at least one of the following: wireless fidelity (WiFi), Bluetooth (BT), near field communication technology (NFC), global satellite positioning system (GPS), and cellular communication, etc. Wired communication may include at least one of the following: universal serial bus (USB), high-definition multimedia interface (HDMI), asynchronous transmission standard interface (RS-232), etc. The network may be a telecommunications network and a communication network. The communication network may be a computer network, the Internet, the Internet of Things, or a telephone network. The encryption machine may be connected to the network via a communication interface, and the protocol used by the encryption machine to communicate with other network devices may be supported by at least one of an application, an application programming interface (API), a middleware, a kernel, and a communication interface.
[0192] One embodiment of the present invention is a storage medium, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the operations performed by the corresponding embodiment of the above-mentioned dual-control key management method. For example, the storage medium can be a read-only memory (ROM), a random access memory (RAM), a read-only compact disk (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device.
[0193] They can be implemented with program codes executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0194] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0195] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed with hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0196] In the embodiments provided in the present application, it should be understood that the disclosed device / encryptor and method can be implemented in other ways. For example, the device / encryptor embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0198] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0199] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by sending instructions to related hardware through a computer program. The computer program can be stored in a storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program can be in source code form, object code form, executable file or some intermediate form. The storage medium may include: any entity or device capable of carrying the computer program, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example: in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.
[0200] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0201] It should be noted that the above embodiments can be freely combined as needed. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.
Claims
1. A dual-control key management method, characterized in that: Includes steps: Synthesize the protection key when at least two operators are logged into the encryption machine; Obtain a root key ciphertext block, and use the protection key and a preset encryption mode to perform reverse decryption calculation on the root key ciphertext block to obtain padding data and a root key; the root key ciphertext block is data generated by encrypting the root key using the protection key in a preset encryption mode; If it is verified that the length of the padding data is correct, it is determined that the protection key and the root key are correct, and the root key is cleared; White-boxing the protection key to generate a protection key white box, and clearing the protection key; clearing the protection key white box when the operator logs out of the encryption machine; The synthesis protection key comprises the steps of: Obtaining the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password; Performing hash encryption calculation on the hardware identification to generate a second hash value; Performing hash encryption calculation on the account information to generate a third hash value; The protection key is calculated and synthesized according to the second Hash value and the third Hash value, and the second Hash value and the third Hash value are cleared.
2. The dual-control key management method according to claim 1, characterized in that: Before obtaining the root key ciphertext block, the method further includes: Determining whether the root key ciphertext block already exists in the encryption machine; If not, performing hash encryption calculation on the key input moments of the at least two operators to generate a first hash value; Obtaining a random number randomly generated by an encryption machine, and generating a root key by calculating the random number and the first Hash value, and then clearing the first Hash value, the random number and the key input time; The root key is encrypted according to the protection key to generate a root key ciphertext block, the root key ciphertext block is stored and the root key is cleared.
3. The dual-control key management method according to claim 2, characterized in that: The step of encrypting the root key according to the protection key to generate a root key ciphertext block, storing the root key ciphertext block and clearing the root key comprises the following steps: Filling the root key according to a preset filling algorithm to generate a ciphertext data block; According to a preset encryption mode, using the protection key to encrypt the ciphertext data block to generate a root key ciphertext block; The root key is cleared after the root key ciphertext block is saved in the form of a file.
4. The dual-control key management method according to any one of claims 1 to 3, characterized in that: Also includes the steps: Counting the total number of failed attempts to log into the encryption machine, and determining whether the total number of failed attempts exceeds a preset number threshold within a preset time period; If the total number of times within the preset time exceeds the preset number threshold, all key-related data will be cleared.
5. A dual-control key management system, characterized in that: include: A processing module for synthesizing a protection key when at least two operators log into the encryption machine; A decryption module, used to obtain a root key ciphertext block, and use the protection key and a preset encryption mode to decrypt the root key ciphertext block to obtain padding data and a root key; the root key ciphertext block is data generated by encrypting the root key using the protection key in a preset encryption mode; A verification module, configured to determine that the protection key and the root key are correct if the length of the padding data is verified to be correct, and clear the root key; The processing module is further used to perform white-box processing on the protection key to generate a protection key white box, and clear the protection key; The processing module is further used to clear the protection key white box when the operator logs out of the encryption machine; Wherein, the processing module includes: An acquisition unit, used to acquire the hardware identification of the encryption machine and the account information of the at least two operators, wherein the account information includes the operator identification and the corresponding login password; A computing unit, configured to perform a hash encryption calculation on the hardware identifier to generate a second hash value; The calculation unit is further used to perform hash encryption calculation on the account information to generate a third hash value; The calculation unit is further used to calculate and synthesize the protection key according to the second Hash value and the third Hash value, and clear the second Hash value and the third Hash value.
6. The dual-control key management system according to claim 5, characterized in that: Also includes: A judging module, used for judging whether the root key ciphertext block already exists in the encryption machine; A generating module, for performing a hash encryption calculation on the key input moment of the operator to generate a first hash value when it is determined that the root key does not exist in the encryption machine; An acquisition module is used to obtain a random number randomly generated by an encryption machine; The processing module is further used to calculate and generate a root key according to the random number and the first Hash value, and then clear the first Hash value, the random number and the key input time; The processing module is further used to encrypt the root key according to the protection key to generate a root key ciphertext block, store the root key ciphertext block and clear the root key.
7. The dual-control key management system according to claim 6, characterized in that: The processing module also includes: A generating unit, used for padding the root key according to a preset padding algorithm to generate a ciphertext data block; An encryption unit, configured to encrypt the ciphertext data block using the protection key to generate a root key ciphertext block according to a preset encryption mode; The processing unit is used to clear the root key after saving the root key ciphertext block in the form of a file.
8. The dual-control key management system according to claim 5, characterized in that: Also includes: A statistical judgment module, used to count the total number of failed login attempts to the encryption machine, and to judge whether the total number of failed login attempts exceeds a preset number threshold within a preset time period; The processing module is further configured to clear all key-related data if the total number of times exceeds a preset number threshold within a preset time period.
9. An encryption machine, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor is used to execute the computer program stored in the memory to implement the operations performed by the dual-control key management method as described in any one of claims 1 to 4.
10. A storage medium, characterized in that: The storage medium stores at least one instruction, which is loaded and executed by the processor to implement the operations performed by the dual-control key management method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Data key protection method, device and system
CN108667608A
Encryption method of root key, computer-readable storage medium and terminal equipment
CN109547201A