Secret key updating method, device and equipment of full-secret-state database and storage medium
By creating the target client's main key and updating the dense keys and dense articles in the full -dense database, the problem of decreased security in the key life cycle of the key life is solved, and the continuous availability of the key, the client and the server density of the client and the server dense Consistency of the key.
Patent Information
- Application Number
- CN202411476709.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In a fully-secret database, due to the reduced security in the life cycle of the key, it is necessary to update while ensuring the continuous availability of the key to ensure the consistency between the client and server keys.
By creating the main key of the target client, decrypt the initial columns of the encryption key to obtain the explicit text, use the target client's main key cryptic library encrypted key, to generate the target column and the dense key text, and update it to the server to the server In the system table, at the same time, the initial client main keys stored in the client at the same time.
The renewal of the key in the full -state database is achieved, ensuring the security of the key storage device, and ensuring the consistency of the client and the server key, thereby ensuring the continuous availability of the key.
Smart Images

Figure CN119377987A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a key updating method, device, equipment and storage medium for a fully encrypted database. Background Art
[0002] A fully encrypted database is a database system that specializes in processing encrypted data, aiming to solve the privacy protection problem of data throughout its life cycle. For the encryption method of traditional databases, when performing conditional queries, it is necessary to decrypt the data to plain text for query. For a fully encrypted database, all data queries do not need to be decrypted, and private data always exists in the form of ciphertext on the database server.
[0003] In a fully encrypted database, two encryption keys are involved in implementing fully encrypted state: the Customer Master Key (CMK) and the Column Encryption Key (CEK). The Customer Master Key (CMK) is used to encrypt the Column Encryption Key (CEK). One CMK can be used to encrypt one or more CEKs. The Column Encryption Key (CEK) is used to encrypt column data. One CEK can be used to encrypt one or more rows of column data. The CMK is stored in the client in the form of a file, and the CEK ciphertext encrypted by the CMK is stored in the server.
[0004] During the life cycle of a key, the security of the key may decrease over time. Therefore, it is necessary to update the key in the fully confidential database while ensuring the continuous availability of the key. Summary of the invention
[0005] The present invention provides a key updating method, device, equipment and storage medium for a fully confidential database, which realizes the updating of keys in the fully confidential database, ensures the key consistency of the client and the server, and the continuous availability of the key during the updating process.
[0006] According to one aspect of the present invention, a method for updating a key of a fully encrypted database is provided, comprising:
[0007] Create the target client master key;
[0008] Decrypt the initial column encryption key ciphertext using the initial client master key stored locally on the client to obtain the column encryption key plaintext;
[0009] Encrypting the column encryption key plaintext using the target client master key to obtain a target column encryption key ciphertext;
[0010] The target column encryption key ciphertext is updated to the system table of the server, and the target client master key is used to update the initial client master key stored locally on the client.
[0011] According to another aspect of the present invention, a method for updating a key of a fully encrypted database is provided, comprising:
[0012] Create target column encryption key plaintext;
[0013] Encrypt the target column encryption key plaintext using the acquired client master key to obtain the target column encryption key ciphertext, and update the target column encryption key ciphertext to the system table of the server;
[0014] Obtaining from the database the initial data column ciphertext encrypted using the initial column encryption key ciphertext;
[0015] Decrypting the initial data column ciphertext using the initial column encryption key ciphertext to obtain data column plaintext, and encrypting the data column plaintext using the target column encryption key ciphertext to obtain target data column ciphertext;
[0016] The target data column ciphertext is written into the database.
[0017] According to another aspect of the present invention, there is provided a key updating device for a fully encrypted database, comprising:
[0018] Create a module for creating a target client master key;
[0019] A decryption module, used to decrypt the initial column encryption key ciphertext by using the initial client master key stored locally on the client to obtain the column encryption key plaintext;
[0020] An encryption module, used to encrypt the column encryption key plaintext by using the target client master key to obtain a target column encryption key ciphertext;
[0021] The update module is used to update the target column encryption key ciphertext into the system table of the server, and use the target client master key to update the initial client master key stored locally on the client.
[0022] According to another aspect of the present invention, there is provided a key updating device for a fully encrypted database, comprising:
[0023] Create a module to create the target column encryption key plaintext;
[0024] An encryption module, used to encrypt the target column encryption key plaintext by using the acquired client master key, obtain the target column encryption key ciphertext, and update the target column encryption key ciphertext to the system table of the server;
[0025] An acquisition module, used for acquiring the initial data column ciphertext encrypted by using the initial column encryption key ciphertext from the database;
[0026] A decryption module, configured to use the initial column encryption key ciphertext to decrypt the initial data column ciphertext to obtain a data column plaintext, and use the target column encryption key ciphertext to encrypt the data column plaintext to obtain a target data column ciphertext;
[0027] A writing module is used to write the ciphertext of the target data column into the database.
[0028] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0029] at least one processor; and
[0030] a memory communicatively connected to the at least one processor; wherein,
[0031] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the key updating method for a fully confidential database described in any embodiment of the present invention.
[0032] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the key update method for a fully secret database described in any embodiment of the present invention when executed.
[0033] The technical solution of the embodiment of the present invention solves the problem of updating the client master key CMK in a fully confidential database and ensures the security of the key storage device by creating a target client master key; using the initial client master key stored locally on the client to decrypt the initial column encryption key ciphertext to obtain the column encryption key plaintext; using the target client master key to encrypt the column encryption key plaintext to obtain the target column encryption key ciphertext; updating the target column encryption key ciphertext to the system table of the server, and using the target client master key to update the initial client master key stored locally on the client, thereby ensuring the security of the key storage device; and in the process of updating the client master key, ensuring the key consistency between the client and the server, thereby ensuring the continuous availability of the key.
[0034] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 It is a flow chart of a key updating method for a fully encrypted database provided in the first embodiment of the present invention;
[0037] Figure 2 It is a flow chart of a key updating method for a fully encrypted database provided in Embodiment 2 of the present invention;
[0038] Figure 3 It is a flow chart of a key updating method for a fully secret database provided in Embodiment 3 of the present invention;
[0039] Figure 4 It is a structural schematic diagram of a key updating device for a fully secret database provided by a fourth embodiment of the present invention;
[0040] Figure 5 It is a structural schematic diagram of a key updating device for a fully secret database provided in Embodiment 5 of the present invention;
[0041] Figure 6 The present invention is a schematic diagram of the structure of an electronic device for implementing the key update method of a fully secret database according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0043] It should be noted that the terms "target", "initial", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0044] Embodiment 1
[0045] Figure 1 This is a flowchart of a key update method for a fully secret database provided in the first embodiment of the present invention. This embodiment is applicable to the case of updating the client master key CMK in the fully secret database. The method can be executed by a key update device for a fully secret database. The key update device for a fully secret database can be implemented in the form of hardware and / or software. The key update device for a fully secret database can be configured in the client. Figure 1 As shown, the method includes:
[0046] S110. Create a target client master key.
[0047] The target client master key refers to a new client master key, which is used to update the original client master key in the fully encrypted database. The client master key CMK is used to encrypt the column encryption key CEK, which is expressed in plain text, that is, the column encryption key plain text.
[0048] In this embodiment, the target client master key is calculated on the client by using a preset condition and a key algorithm. Exemplarily, the key algorithm may adopt an asymmetric key algorithm. The preset condition may be the timing of creating the target client master key. The target client master key may be created regularly according to a preset period to achieve regular updating of the client master key; or the target client master key may be created according to user needs when combined with an update instruction.
[0049] S120: Decrypt the initial column encryption key ciphertext using the initial client master key stored locally on the client to obtain the column encryption key plaintext.
[0050] The initial client master key refers to the client master key used in the fully encrypted database before the key is updated. The initial column encryption key ciphertext refers to the ciphertext obtained by encrypting the column encryption key plaintext using the initial client master key. The column encryption key plaintext refers to the column encryption key CEK expressed in plaintext.
[0051] In this embodiment, the initial client master key is stored locally on the client. Since the client master key is used to encrypt the column encryption key plaintext, the initial column encryption key ciphertext is read from the server to the client locally, and the initial column encryption key ciphertext is decrypted using the initial client master key to obtain the column encryption key plaintext.
[0052] In an optional embodiment, the column encryption key is written in plain text to a local cache of the client.
[0053] In this embodiment, to avoid the client master key not being completely updated, after the initial column encryption key is decrypted by the initial client master key at the client, the column encryption key plaintext is stored in the client's cache and used to decrypt the encrypted column data during the client master key update process. S130, encrypt the column encryption key plaintext using the target client master key to obtain the target column encryption key ciphertext.
[0054] The target column encryption key ciphertext refers to a new column encryption key ciphertext obtained by encrypting the column encryption key plaintext with the new target client master key.
[0055] In this embodiment, the client master key is used to encrypt the column encryption key plaintext. Therefore, after creating the target client master key, the newly created target client master key is used to encrypt the column encryption key plaintext to obtain the target column encryption key ciphertext.
[0056] S140: Update the target column encryption key ciphertext to the system table of the server, and use the target client master key to update the initial client master key stored locally on the client.
[0057] In a fully secret database, in order to ensure the security of data, the key and privacy column data will not appear in the server in plain text. Therefore, a system table is set in the fully secret database to store the hash value of the client master key CMK, the column encryption key ciphertext CEK, and the encrypted data column encrypted by the column encryption key ciphertext CEK. Exemplarily, the main information contained in the system table includes: CMKs: CMK_ID, CMK name, CMK path, encryption CMK algorithm ID, public key hash value, private key hash value; CEKs: CEK_ID, CEK name, CMK_ID, CMK name, encryption CEK algorithm ID, current CEK ciphertext, original CEK ciphertext; COLs: column name, table name, mode name, CMK_ID, CEK_ID, CEK name, CMK_ID, CMK name, encryption algorithm ID.
[0058] In this embodiment, the target column encryption key ciphertext is updated in the server's system table in the form of ciphertext, and the target client master key is used to update the initial client master key stored locally on the client. The server updates the current column encryption key ciphertext and the original column encryption key ciphertext in the system table according to the target column encryption key ciphertext updated by the client. It is ensured that the client master key used by the target column encryption key ciphertext in the server is consistent with the client master key stored locally on the client, so the continuous availability of the key can be guaranteed during the update process.
[0059] Exemplarily, the method for updating the target column encryption key ciphertext in the system table of the server can be: in the system table of the server, the original CEK ciphertext field is updated with the initial column encryption key ciphertext stored in the current CEK ciphertext field; and the current CEK ciphertext field is updated with the target column encryption key ciphertext.
[0060] The technical solution of the embodiment of the present invention creates a target client master key; uses the initial client master key stored locally on the client to decrypt the initial column encryption key ciphertext to obtain the column encryption key plaintext; uses the target client master key to encrypt the column encryption key plaintext to obtain the target column encryption key ciphertext; updates the target column encryption key ciphertext to the system table of the server, and uses the target client master key to update the initial client master key stored locally on the client, thereby realizing the update of the client master key CMK in the fully confidential database and ensuring the security of the key storage device; and in the process of updating the client master key, the key consistency of the client and the server is guaranteed, thereby ensuring the continuous availability of the key.
[0061] Embodiment 2
[0062] Figure 2It is a flow chart of a key update method for a fully confidential database provided in Example 2 of the present invention. Based on the above-mentioned embodiment, this embodiment further defines the specific implementation process of creating a target client master key, decrypting the initial column encryption key ciphertext, and after completing the update of the client master key in the fully confidential database, the verification and use process of the updated client master key.
[0063] like Figure 2 As shown, the method includes:
[0064] S210: Create a target client master key.
[0065] In an optional embodiment, creating the target client master key includes: using an asymmetric key algorithm to create a target client public key and a target client private key locally on the client; and using the target client public key and the target client private key as the target client master key.
[0066] S220 . Decrypt the initial column encryption key ciphertext using the initial client master key stored locally on the client to obtain the column encryption key plaintext.
[0067] In an optional embodiment, an initial client master key stored locally on the client is used to decrypt an initial column encryption key ciphertext to obtain a column encryption key plaintext, including: obtaining a private key in the initial client master key locally from the client, and obtaining the initial column encryption key ciphertext from the server; and decrypting the initial column encryption key ciphertext using the private key in the initial client master key to obtain a column encryption key plaintext.
[0068] S230: Use the target client master key to encrypt the column encryption key plaintext to obtain the target column encryption key ciphertext.
[0069] S240: Update the target column encryption key ciphertext to the system table of the server, and use the target client master key to update the initial client master key stored locally on the client.
[0070] S250: Calculate the hash value of the target client master key, and update the hash value of the target client master key into the system table of the server.
[0071] In this embodiment, the target client master key includes: a target client public key and a target client private key; a hash value of the target client public key and a hash value of the target client private key are calculated, and the hash value of the target client public key and the hash value of the target client private key are updated to the system table.
[0072] For example, the hash value of the target client master key is calculated by a hash algorithm. The hash algorithm (Secure Hash Algorithm, SHA) is a data encryption algorithm. The idea of the algorithm is to receive a plain text and then convert it into a cipher text in an irreversible way. It can also be simply understood as taking a string of input codes and converting them into a shorter length, fixed-bit output sequence, namely the hash value.
[0073] S260: Obtain a hash value of the client master key to be used, and compare the hash value of the client master key to be used with the hash value of the target client master key.
[0074] The client master key to be used includes: a public key used in the process of encrypting the column encryption key plaintext or a private key used in the process of decrypting the column encryption key plaintext. The client master key to be used can be a client master key stored in a local file of the client or a client master key obtained from a client cache.
[0075] In this embodiment, in the process of obtaining the client master key to be used and using the client master key to be used to encrypt or decrypt the column encryption key plaintext, the hash value of the client master key to be used is calculated, and the hash value of the target client master key is obtained from the server, and the two are compared to see whether they are consistent, so as to verify whether the database rollback occurs or the key is tampered with during the update of the target client master key.
[0076] S270: If they are the same, the target client master key is used to encrypt the column encryption key plaintext or decrypt the column encryption key ciphertext.
[0077] In this embodiment, if the hash value of the client master key to be used is the same as the hash value of the target client master key, it means that the client master key to be used can be used normally, and the public key in the client master key to be used is used to encrypt the column encryption key plaintext or the public key in the client master key to be used is used to decrypt the column encryption key ciphertext.
[0078] S280: If they are different, a prompt message is issued, where the prompt message is used to remind the user that the client master key to be used is incorrect.
[0079] In this embodiment, if the hash value of the client master key to be used is different from the hash value of the target client master key, it means that a database rollback may have occurred or the key has been tampered with. A prompt message needs to be issued to remind the user that the client master key to be used is incorrect and cannot be used normally. The user is required to determine whether it is caused by operations such as key tampering or database rollback.
[0080] In this embodiment, a target client master key is created; the initial column encryption key ciphertext is decrypted by using the initial client master key stored locally on the client to obtain the column encryption key plaintext; the column encryption key plaintext is encrypted by using the target client master key to obtain the target column encryption key ciphertext; the target column encryption key ciphertext is updated to the system table of the server, and the initial client master key stored locally on the client is updated by using the target client master key; the hash value of the target client master key is calculated, and the hash value of the target client master key is updated to the system table of the server; the hash value of the client master key to be used is obtained; the hash value of the client master key to be used is compared with the hash value of the target client master key; if they are the same, the column encryption key plaintext is encrypted or the column encryption key ciphertext is decrypted by using the client master key to be used; if they are different, a prompt message is issued, and the prompt message is used to prompt the user that the client master key to be used is wrong; to avoid the problem of inconsistent key information between the client and the server due to database rollback or key tampering.
[0081] Embodiment 3
[0082] Figure 3 This is a flowchart of a key update method for a fully secret database provided by the third embodiment of the present invention. This embodiment is applicable to the case of updating the column encryption key plaintext CEK in the fully secret database. The method can be executed by a key update device for a fully secret database. The key update device for a fully secret database can be implemented in the form of hardware and / or software. The key update device for a fully secret database can be configured in the client. Figure 3 As shown, the method includes:
[0083] S310: Create a target column encryption key plaintext.
[0084] The target column encryption key plaintext refers to a new column encryption key plaintext, which is used to update the originally used column encryption key plaintext in the fully encrypted database.
[0085] In this embodiment, the target column encryption key plaintext may be created by calculating the target column encryption key plaintext through a symmetric algorithm.
[0086] S320: Use the acquired client master key to encrypt the target column encryption key plaintext, obtain the target column encryption key ciphertext, and update the target column encryption key ciphertext to the system table of the server.
[0087] The target column encryption key ciphertext is the ciphertext obtained by encrypting the target column encryption key plaintext with the client master key.
[0088] In this embodiment, during the process of updating the column encryption key, the client master key is generally not updated to avoid update confusion. You can select one from the client master keys stored locally on the client, or keep the previously used client master key. Use the client master key to encrypt the target column encryption key plaintext, obtain the target column encryption key ciphertext corresponding to the target column encryption key plaintext, store the target column encryption key ciphertext in the system table of the server, and wait for subsequent use to update the initial column encryption key ciphertext.
[0089] Exemplarily, updating the target column encryption key ciphertext to the system table of the server includes: updating the original CEK ciphertext field with the initial column encryption key ciphertext stored in the current CEK ciphertext field; and updating the current CEK ciphertext field with the target column encryption key ciphertext. The initial column encryption key ciphertext is the ciphertext obtained by encrypting the initial column encryption key plaintext with the client master key.
[0090] In an embodiment of the present invention, both the target column encryption key ciphertext and the initial column encryption key ciphertext are stored in a system table of a server. In the process of decrypting encrypted column data using the column encryption key ciphertext, the target column encryption key ciphertext stored in the system table is preferentially used to decrypt the column encrypted data. If the decryption fails, the initial column encryption key ciphertext is obtained from the server, and the column encrypted data is decrypted using the initial column encryption key ciphertext, so as to avoid the failure of decryption of encrypted column data due to incomplete update of the column encryption key ciphertext.
[0091] In an optional embodiment, obtaining the client master key includes: obtaining the client master key used for encrypting the initial column encryption key ciphertext; or obtaining a client master key parameter, and searching for the client master key locally on the client according to the client master key parameter.
[0092] In another optional embodiment, the initial column encryption key ciphertext is stored in a system table of the server.
[0093] In an embodiment of the present invention, the initial column encryption key ciphertext is also stored in the system table of the server. In the process of using the column encryption key ciphertext to decrypt the encrypted column data, the target column encryption key ciphertext stored in the server is preferentially used to decrypt the column encrypted data. If the decryption fails, the initial column encryption key ciphertext is obtained from the server, and the column encrypted data is decrypted using the initial column encryption key ciphertext, so as to avoid the failure of decryption of the encrypted column data due to incomplete update of the column encryption key ciphertext.
[0094] S330, obtaining from the database the initial data column ciphertext encrypted using the initial column encryption key ciphertext.
[0095] The initial data column ciphertext is the initial data column encrypted by the initial column encryption key ciphertext.
[0096] In this embodiment, the initial data column ciphertext encrypted by the initial column encryption key ciphertext is searched in the database, and the initial data column ciphertext is read from the database to the client locally. Optionally, the database can be an internal database set in the server, or an external database.
[0097] S340, using the initial column encryption key ciphertext to decrypt the data column ciphertext to obtain the data column plaintext, and using the target column encryption key ciphertext to encrypt the data column plaintext to obtain the target data column ciphertext.
[0098] The target data column ciphertext is the ciphertext obtained by encrypting the data column plaintext using the target column encryption key ciphertext.
[0099] In this embodiment, the initial column encryption key ciphertext is used to decrypt the corresponding initial data column ciphertext on the client locally to obtain the data column plaintext corresponding to the initial data column ciphertext, and then the target column encryption key ciphertext is used to encrypt the data column plaintext to obtain the target data column ciphertext.
[0100] S350, writing the target data column ciphertext into the database.
[0101] In this embodiment, the target column encryption key ciphertext is written into the database.
[0102] The technical solution of the embodiment of the present invention creates a target column encryption key plaintext; uses the acquired client master key to encrypt the target column encryption key plaintext to obtain the target column encryption key ciphertext, and updates the target column encryption key ciphertext to the system table of the server; obtains the initial data column ciphertext encrypted by the initial column encryption key ciphertext from the database; uses the initial column encryption key ciphertext to decrypt the initial data column ciphertext to obtain the data column plaintext, and uses the target column encryption key ciphertext to encrypt the data column plaintext to obtain the target data column ciphertext; writes the target data column ciphertext into the database, thereby realizing the update of the column encryption key CEK in the fully encrypted database and ensuring the security of the key storage device; and in the column encryption key update process, ensures the key consistency of the client and the server, thereby ensuring the continuous availability of the key.
[0103] Embodiment 4
[0104] Figure 4 This is a schematic diagram of the structure of a key update device for a fully encrypted database provided by the fourth embodiment of the present invention. Figure 4 As shown, the device includes: a creation module 410, a decryption module 420, an encryption module 430 and an update module 440; wherein,
[0105] A creation module 410, used to create a target client master key;
[0106] A decryption module 420 is used to decrypt the initial column encryption key ciphertext using the initial client master key stored locally on the client to obtain the column encryption key plaintext;
[0107] An encryption module 430 is used to encrypt the column encryption key plaintext using the target client master key to obtain a target column encryption key ciphertext;
[0108] The update module 440 is used to update the target column encryption key ciphertext to the system table of the server, and use the target client master key to update the initial client master key stored locally on the client.
[0109] The technical solution of the embodiment of the present invention creates a target client master key; uses the initial client master key stored locally on the client to decrypt the initial column encryption key ciphertext to obtain the column encryption key plaintext; uses the target client master key to encrypt the column encryption key plaintext to obtain the target column encryption key ciphertext; updates the target column encryption key ciphertext to the system table of the server, and uses the target client master key to update the initial client master key stored locally on the client, thereby realizing the update of the client master key in the fully confidential database and ensuring the security of the key storage device; and in the process of updating the client master key, the key consistency of the client and the server is guaranteed, thereby ensuring the continuous availability of the key.
[0110] Optionally, a creation module 410 is specifically used to:
[0111] Create a target client public key and a target client private key locally using an asymmetric key algorithm on the client;
[0112] The target client public key and the target client private key are used as the target client master key.
[0113] Optionally, also include:
[0114] A hash calculation module, used for calculating a hash value of the target client master key after updating the target column encryption key ciphertext into the system table of the server and using the target client master key to update the initial client master key stored locally on the client;
[0115] The writing module is used to update the hash value of the target client master key into the system table of the server.
[0116] Optionally, also include:
[0117] A hash acquisition module, used to acquire the hash value of the client master key to be used after the hash value of the target client master key is updated into the system table of the server;
[0118] A comparison module, used to compare the hash value of the client master key to be used with the hash value of the target client master key;
[0119] an encryption and decryption module, configured to encrypt the column encrypted data or decrypt the column encrypted data by using the target column encryption key ciphertext if the ciphertexts are the same;
[0120] The prompt module is used to issue a prompt message if they are different, and the prompt message is used to prompt the user that the client master key to be used is wrong.
[0121] The key updating device for a fully secret database provided in an embodiment of the present invention can execute the key updating method for a fully secret database provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0122] Embodiment 5
[0123] Figure 5 This is a schematic diagram of the structure of a key update device for a fully encrypted database provided in Embodiment 5 of the present invention. Figure 5 As shown, the device includes: a creation module 510, an encryption module 520, an acquisition module 530, a decryption module 540 and a writing module 550; wherein,
[0124] A creation module 510, used to create a target column encryption key plaintext;
[0125] The encryption module 520 is used to encrypt the target column encryption key plaintext by using the acquired client master key to obtain the target column encryption key ciphertext, and update the target column encryption key ciphertext to the system table of the server;
[0126] An acquisition module 530 is used to acquire, from a database, an initial data column ciphertext encrypted using an initial column encryption key ciphertext;
[0127] A decryption module 540 is configured to decrypt the initial data column ciphertext using the initial column encryption key ciphertext to obtain a data column plaintext, and to encrypt the data column plaintext using the target column encryption key ciphertext to obtain a target data column ciphertext;
[0128] The writing module 550 is used to write the ciphertext of the target data column into the database.
[0129] The technical solution of the embodiment of the present invention creates a target column encryption key plaintext; uses the acquired client master key to encrypt the target column encryption key plaintext to obtain the target column encryption key ciphertext, and updates the target column encryption key ciphertext to the system table of the server; obtains the initial data column ciphertext encrypted by the initial column encryption key ciphertext from the database; uses the initial column encryption key ciphertext to decrypt the initial data column ciphertext to obtain the data column plaintext, and uses the target column encryption key ciphertext to encrypt the data column plaintext to obtain the target data column ciphertext; writes the target data column ciphertext into the database, thereby realizing the update of the column encryption key CEK in the fully encrypted database and ensuring the security of the key storage device; and in the column encryption key update process, ensures the key consistency of the client and the server, thereby ensuring the continuous availability of the key.
[0130] Optionally, the encryption module 520 includes:
[0131] A first acquisition unit, configured to acquire a client master key used for encrypting the ciphertext of the initial column encryption key;
[0132] Alternatively, the second acquisition unit is configured to acquire a client master key parameter, and search for the client master key locally on the client according to the client master key parameter.
[0133] The key updating device for a fully secret database provided in an embodiment of the present invention can execute the key updating method for a fully secret database provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0134] Embodiment 6
[0135] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0136] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0137] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0138] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a key update method for a fully secret database.
[0139] In some embodiments, the key update method for a fully secret database may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the key update method for a fully secret database described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the key update method for a fully secret database in any other appropriate manner (e.g., by means of firmware).
[0140] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0141] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0142] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0143] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0144] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0145] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0146] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0147] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for updating a key of a fully encrypted database, characterized in that: Applied to a client, the method comprises: Create the target client master key; Decrypt the initial column encryption key ciphertext using the initial client master key stored locally on the client to obtain the column encryption key plaintext; Encrypting the column encryption key plaintext using the target client master key to obtain a target column encryption key ciphertext; The target column encryption key ciphertext is updated to the system table of the server, and the target client master key is used to update the initial client master key stored locally on the client.
2. The method according to claim 1, characterized in that Create the target client master key, including: Create a target client public key and a target client private key locally using an asymmetric key algorithm on the client; The target client public key and the target client private key are used as the target client master key.
3. The method according to claim 1, characterized in that After the target column encryption key ciphertext is updated to the system table of the server, and the target client master key is used to update the initial client master key stored locally on the client, the method further includes: Calculate the hash value of the target client master key; The hash value of the target client master key is updated into the server's system table.
4. The method according to claim 3, characterized in that After the hash value of the target client master key is updated into the system table of the server, the method further includes: Get the hash value of the client master key to be used; Comparing the hash value of the to-be-used client master key with the hash value of the target client master key; If they are the same, using the target column encryption key ciphertext to encrypt the column encrypted data or decrypt the column encrypted data; If they are different, a prompt message is issued, wherein the prompt message is used to remind the user that the client master key to be used is incorrect.
5. A method for updating a key of a fully secret database, characterized in that: Applied to a client, the method comprises: Create target column encryption key plaintext; Encrypt the target column encryption key plaintext using the acquired client master key to obtain the target column encryption key ciphertext, and update the target column encryption key ciphertext to the system table of the server; Obtaining from the database the initial data column ciphertext encrypted using the initial column encryption key ciphertext; Decrypting the initial data column ciphertext using the initial column encryption key ciphertext to obtain data column plaintext, and encrypting the data column plaintext using the target column encryption key ciphertext to obtain target data column ciphertext; The target data column ciphertext is written into the database.
6. The method according to claim 5, characterized in that Get the client master key, including: Obtain a client master key used for encrypting the ciphertext of the initial column encryption key; Alternatively, a client master key parameter is obtained, and the client master key is searched locally on the client according to the client master key parameter.
7. A key updating device for a fully encrypted database, characterized in that: include: Create a module for creating a target client master key; A decryption module, used to decrypt the initial column encryption key ciphertext by using the initial client master key stored locally on the client to obtain the column encryption key plaintext; An encryption module, used to encrypt the column encryption key plaintext by using the target client master key to obtain a target column encryption key ciphertext; The update module is used to update the target column encryption key ciphertext into the system table of the server, and use the target client master key to update the initial client master key stored locally on the client.
8. A key updating device for a fully encrypted database, characterized in that: include: Create a module to create the target column encryption key plaintext; An encryption module, used to encrypt the target column encryption key plaintext by using the acquired client master key, obtain the target column encryption key ciphertext, and update the target column encryption key ciphertext to the system table of the server; An acquisition module, used for acquiring the initial data column ciphertext encrypted by using the initial column encryption key ciphertext from the database; A decryption module, configured to use the initial column encryption key ciphertext to decrypt the initial data column ciphertext to obtain a data column plaintext, and use the target column encryption key ciphertext to encrypt the data column plaintext to obtain a target data column ciphertext; A writing module is used to write the ciphertext of the target data column into the database.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the key update method for a fully confidential database according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the key update method for a fully secret database according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Social video information security method and system
CN102833246A
Method and system for updating multiple-client key, and information security transmission method
CN103051641A
Database data encryption system based on SM4 cryptographic algorithm
CN114154195A
Data encryption key careless update management method based on edge device
CN115913534A
Key updating method and system based on software, terminal equipment and virtual server
CN115987597A