Key updating method and device for full-mesh database, equipment and storage medium
By creating the target client master key in the fully encrypted database and updating the column encryption key ciphertext, the problem of reduced key security is solved, and the consistency of client and server keys and continuous key availability are achieved.
Patent Information
- Application Number
- CN202411476709.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In a fully encrypted database, the security of the key may decrease over time. It is necessary to update the key while ensuring its continuous availability in order to guarantee key consistency between the client and the server.
By creating a target client master key, the initial column encryption key ciphertext is decrypted using the initial client master key stored locally on the client to obtain the column encryption key plaintext. The column encryption key plaintext is then encrypted using the target client master key and updated in the server's system table. At the same time, the initial client master key stored locally on the client is also updated.
It enables client master key updates in a fully encrypted database, ensuring the security of the key storage device and guaranteeing key consistency between the client and server during the update process, thus ensuring continuous key availability.
Smart Images

Figure CN119377987B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of database, and in particular to a key updating method, device and equipment of full-mesh database and a storage medium. BACKGROUND
[0002] The full-mesh database is a database system specially processing ciphertext data, aiming to solve the privacy protection problem in the whole life cycle of data. For the encryption mode of the traditional database, the decryption to the plaintext form is required for the query. For the full-mesh database, all data queries do not need to be decrypted, and the privacy data always exists in the form of ciphertext in the database server.
[0003] In the full-mesh database, two encryption keys are involved in the implementation of full-mesh encryption: 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, and one CMK can be used to encrypt one or more CEKs; the column encryption key CEK is used to encrypt column data, and one CEK can be used to encrypt one or more rows of column data. The CMK is saved in the form of a file in the client, and the CEK ciphertext encrypted by the CMK is saved in the server.
[0004] In the life cycle of the key, the security of the key may be reduced over time, and therefore, the key in the full-mesh database needs to be updated while ensuring the continuous availability of the key. SUMMARY
[0005] The present application provides a key updating method, device and equipment of full-mesh database and a storage medium, which realizes the updating of the key in the full-mesh database, guarantees the key consistency of the client and the server, and ensures the continuous availability of the key in the updating process.
[0006] According to an aspect of the present application, a key updating method of full-mesh database is provided, comprising:
[0007] Creating a target customer master key;
[0008] Decrypting an initial column encryption key ciphertext by using an initial customer master key stored locally in the client to obtain column encryption key plaintext;
[0009] Encrypting the column encryption key plaintext by using the target customer master key to obtain target column encryption key ciphertext;
[0010] Updating the target column encryption key ciphertext to a system table of the server, and updating the initial customer master key stored locally in the client by using the target customer master key.
[0011] According to another aspect of the present application, a key updating method for a full-mechanism database is provided, comprising:
[0012] creating target column encryption key plaintext;
[0013] encrypting the target column encryption key plaintext using the obtained client master key to obtain target column encryption key ciphertext, and updating the target column encryption key ciphertext into a system table of a server;
[0014] obtaining initial data column ciphertext encrypted using initial column encryption key ciphertext from a database;
[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 target column encryption key ciphertext to obtain target data column ciphertext;
[0016] writing the target data column ciphertext into the database.
[0017] According to another aspect of the present application, a key updating device for a full-mechanism database is provided, comprising:
[0018] a creating module configured to create target client master key;
[0019] a decrypting module configured to decrypt initial column encryption key ciphertext using initial client master key stored locally by a client to obtain column encryption key plaintext;
[0020] an encrypting module configured to encrypt the column encryption key plaintext using the target client master key to obtain target column encryption key ciphertext;
[0021] an updating module configured to update the target column encryption key ciphertext into a system table of a server, and update the initial client master key stored locally by the client using the target client master key.
[0022] According to another aspect of the present application, a key updating device for a full-mechanism database is provided, comprising:
[0023] a creating module configured to create target column encryption key plaintext;
[0024] an encrypting module configured to encrypt the target column encryption key plaintext using obtained client master key to obtain target column encryption key ciphertext, and update the target column encryption key ciphertext into a system table of a server;
[0025] an obtaining module configured to obtain initial data column ciphertext encrypted using initial column encryption key ciphertext from a database;
[0026] decrypt the initial data column ciphertext by using the initial column encryption key ciphertext to obtain data column plaintext, and encrypt the data column plaintext by using the target column encryption key ciphertext to obtain target data column ciphertext;
[0027] a writing module, configured to write the target data column ciphertext into the database.
[0028] According to another aspect of the present application, an electronic device is provided, which comprises:
[0029] at least one processor; and
[0030] a memory connected with 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 to enable the at least one processor to perform the key updating method of the fully homomorphic database according to any one of the embodiments of the present application.
[0032] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to perform the key updating method of the fully homomorphic database according to any one of the embodiments of the present application.
[0033] The technical scheme of the embodiments of the present application creates a target client master key; decrypts the initial column encryption key ciphertext by using the initial client master key stored locally by the client to obtain column encryption key plaintext; encrypts the column encryption key plaintext by using the target client master key to obtain target column encryption key ciphertext; updates the target column encryption key ciphertext to the system table of the server, and updates the initial client master key stored locally by the client by using the target client master key, thereby solving the problem of updating the client master key CMK in the fully homomorphic database, and ensuring the security of the key storage device; and during the updating of the client master key, the consistency of the keys of the client and the server is ensured, thereby ensuring the continuous availability of the keys.
[0034] It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings should belong to the protection scope of the present application.
[0036] Figure 1 is a flowchart of a key update method of a full-mesh database provided by the first embodiment of the present application;
[0037] Figure 2 is a flowchart of a key update method of a full-mesh database provided by the second embodiment of the present application;
[0038] Figure 3 is a flowchart of a key update method of a full-mesh database provided by the third embodiment of the present application;
[0039] Figure 4 is a structural schematic diagram of a key update device of a full-mesh database provided by the fourth embodiment of the present application;
[0040] Figure 5 is a structural schematic diagram of a key update device of a full-mesh database provided by the fifth embodiment of the present application;
[0041] Figure 6 is a structural schematic diagram of an electronic device for implementing the key update method of a full-mesh database of the present application. DETAILED DESCRIPTION
[0042] In order to make the person in the art better understand the present application, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should belong to the protection scope of the present application.
[0043] It is to be understood that the terminology "target", "initial" and the like used in the specification and the claims of the application and the above-described drawings is intended to describe different similar objects, and is not necessarily intended to describe a particular chronological or sequential order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments of the application described herein can be carried out in other than the order illustrated or described herein. Furthermore, the terms "comprising" and "containing" and any variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or apparatus that includes a list of steps or units not necessarily limited to those specifically listed, but can include other steps or units not expressly listed or inherent to such process, method, product or apparatus.
[0044] Embodiment one
[0045] Figure 1 is a flowchart of a key update method of a full-mesh database provided by an embodiment of the application. The embodiment can be applicable to the case of updating a client master key CMK in a full-mesh database. The method can be executed by a key update device of the full-mesh database. The key update device of the full-mesh database can be realized in the form of hardware and / or software. The key update device of the full-mesh database can be configured in a client. As shown in the figure, the method comprises: Figure 1
[0046] S110, creating a target client master key.
[0047] The target client master key refers to a new client master key, which is used to update an originally used client master key in the full-mesh database. The client master key CMK is used to encrypt a column encryption key CEK. The column encryption key CEK is in the form of plaintext, i.e., column encryption key plaintext.
[0048] In the embodiment, the target client master key is calculated on the client by a preset condition and a key algorithm. Exemplarily, the key algorithm can adopt an asymmetric key algorithm. The preset condition can be that the time of creating the target client master key can be to create the target client master key periodically according to a preset period, so as to realize periodic updating of the client master key; or the target client master key can be created according to user demand in combination with an update instruction.
[0049] S120, decrypting the initial column encryption key ciphertext by using the initial client master key stored locally by the client to obtain the column encryption key plaintext.
[0050] The initial client master key refers to a client master key used in the full-database before the key is updated. The initial column encryption key ciphertext refers to ciphertext obtained by encrypting the column encryption key plaintext with the initial client master key. The column encryption key plaintext refers to the column encryption key CEK in plaintext form.
[0051] In this embodiment, the initial client master key is stored in the local 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 local client. The initial column encryption key ciphertext is decrypted with the initial client master key to obtain the column encryption key plaintext.
[0052] In an optional embodiment, the column encryption key plaintext is written to the cache of the local client.
[0053] In this embodiment, to avoid that the client master key is not completely updated, the initial column encryption key is decrypted with the initial client master key in the local client to store the column encryption key plaintext in the cache of the local client, which is used to decrypt the encrypted column data during the update of the client master key. S130, encrypt the column encryption key plaintext with the target client master key to obtain the target column encryption key ciphertext.
[0054] The target column encryption key ciphertext refers to the 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 the target client master key is created, the column encryption key plaintext is encrypted with the newly created target client master key 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 update the initial client master key stored in the local client with the target client master key.
[0057] In the full-mesh database, in order to ensure the security of the data, the key and the private column data cannot appear in the server in the form of plaintext. Therefore, a system table is set in the full-mesh database, which is used 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, schema name, CMK_ID, CEK_ID, CEK name, CMK_ID, CMK name, encryption algorithm ID.
[0058] In the embodiment, the target column encryption key ciphertext is updated into the system table of the server in the form of ciphertext, and the initial client master key stored locally by the client is updated by using the target client master key. The current column encryption key ciphertext and the original column encryption key ciphertext in the system table are updated by the server according to the target column encryption key ciphertext updated by the client. The client master key used by the target column encryption key ciphertext in the server is ensured to be consistent with the client master key stored locally by the client, and therefore the continuity of the key can be ensured during the updating process.
[0059] Exemplarily, the way of updating the target column encryption key ciphertext into the system table of the server in the system table of the server can be: in the system table of the server, the original CEK ciphertext field is updated by using the initial column encryption key ciphertext stored in the current CEK ciphertext field; the current CEK ciphertext field is updated by using the target column encryption key ciphertext.
[0060] The technical scheme of the embodiment of the application realizes the updating of the client master key CMK in the full-mesh database, guarantees the security of the key storage device, and ensures the consistency of the key between the client and the server during the updating process of the client master key, thereby ensuring the continuity of the key.
[0061] Embodiment two
[0062] Figure 2is a flowchart of a key updating method of a full-mechanical state database provided by Embodiment Two of the present application. Based on the above-mentioned embodiment, the present embodiment further limits the specific implementation process of creating a target client master key and decrypting initial column encryption key ciphertext, and the verification use process of the updated client master key after the update of the client master key in the full-mechanical state database is completed.
[0063] As shown in Figure 2 , the method comprises:
[0064] S210, a target client master key is created.
[0065] In an optional embodiment, creating the target client master key comprises: creating a target client public key and a target client private key locally at the client by using an asymmetric key algorithm; and taking the target client public key and the target client private key as the target client master key.
[0066] S220, the initial column encryption key ciphertext is decrypted by using the initial client master key stored locally at the client to obtain column encryption key plaintext.
[0067] In an optional embodiment, decrypting the initial column encryption key ciphertext by using the initial client master key stored locally at the client to obtain column encryption key plaintext comprises: obtaining the private key in the initial client master key locally at the client, and obtaining the initial column encryption key ciphertext from the server; and decrypting the initial column encryption key ciphertext by using the private key in the initial client master key to obtain column encryption key plaintext.
[0068] S230, the column encryption key plaintext is encrypted by using the target client master key to obtain target column encryption key ciphertext.
[0069] S240, the target column encryption key ciphertext is updated to the system table of the server, and the initial client master key stored locally at the client is updated by using the target client master key.
[0070] S250, 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.
[0071] In the present embodiment, the target client master key comprises: a target client public key and a target client private key; the hash value of the target client public key and the 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] An exemplary 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, and the idea of the algorithm is to receive a piece of plaintext and then convert it into a piece of ciphertext in an irreversible manner. It can also be simply understood as a process of converting a string of input codes into an output sequence with a fixed length and a fixed number of bits, i.e., a hash value.
[0073] S260, a hash value of the to-be-used client master key is obtained, and the hash value of the to-be-used client master key is compared with the hash value of the target client master key.
[0074] The to-be-used client master key includes a public key used in the encryption of the column encryption key plaintext or a private key used in the decryption of the column encryption key plaintext. The to-be-used client master key can be a client master key stored in a local file of the client or a client master key obtained from a cache of the client.
[0075] In this embodiment, in the process of obtaining the to-be-used client master key and using the to-be-used client master key to encrypt or decrypt the column encryption key plaintext, the hash value of the to-be-used client master key is calculated, and the hash value of the target client master key is obtained from the server. Whether the two hash values are consistent is compared, so as to verify whether database rollback or key tampering occurs in the updating process of the target client master key.
[0076] S270, if the hash values 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 to-be-used client master key is the same as the hash value of the target client master key, it indicates that the to-be-used client master key can be normally used, and the public key in the to-be-used client master key is used to encrypt the column encryption key plaintext or the public key in the to-be-used client master key is used to decrypt the column encryption key ciphertext.
[0078] S280, if the hash values are different, a prompt information is sent, and the prompt information is used to prompt the user that the to-be-used client master key is incorrect.
[0079] In this embodiment, if the hash value of the to-be-used client master key is different from the hash value of the target client master key, it indicates that database rollback or key tampering may occur, and prompt information needs to be sent to prompt the user that the to-be-used client master key is incorrect and cannot be normally used. Whether the key tampering or database rollback operation is caused is determined by the user.
[0080] In the embodiment, the target client master key is created; the initial column encryption key ciphertext is decrypted by using the initial client master key stored locally by the client to obtain column encryption key plaintext; the column encryption key plaintext is encrypted by using the target client master key to obtain target column encryption key ciphertext; the target column encryption key ciphertext is updated into the system table of the server, and the initial client master key stored locally by 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 into 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 the hash values 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 the hash values are different, a prompt information is sent, and the prompt information is used to prompt the user that the client master key to be used is incorrect; and the problem that the database is rolled back or the key is tampered to cause the inconsistency of the key information between the client and the server is avoided.
[0081] Embodiment three
[0082] Figure 3 is a flowchart of a key updating method of a full-mechanical-state database provided by the embodiment three of the present application. The embodiment can be applicable to the case of updating the column encryption key plaintext CEK in the full-mechanical-state database. The method can be executed by a key updating device of the full-mechanical-state database. The key updating device of the full-mechanical-state database can be realized in the form of hardware and / or software, and can be configured in the client. As shown in the figure, the method comprises the following steps. Figure 3
[0083] S310, a target column encryption key plaintext is created.
[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 full-mechanical-state database.
[0085] In the embodiment, the target column encryption key plaintext can be calculated by a symmetric algorithm.
[0086] S320, the target column encryption key plaintext is encrypted by using the obtained client master key to obtain target column encryption key ciphertext, and the target column encryption key ciphertext is updated into 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 by using the client master key.
[0088] In the embodiment, during the process of updating the column encryption key, the client master key is generally not updated to avoid causing update confusion. One of the client master keys stored locally on the client can be selected, or the previously used client master key can still be maintained. The target column encryption key plaintext is encrypted by using the client master key to obtain target column encryption key ciphertext corresponding to the target column encryption key plaintext, and the target column encryption key ciphertext is stored in the system table of the server, waiting for subsequent use for updating the initial column encryption key ciphertext.
[0089] For example, updating the target column encryption key ciphertext to the system table of the server includes: updating the original CEK ciphertext field by using the initial column encryption key ciphertext stored in the current CEK ciphertext field; and updating the current CEK ciphertext field by using the target column encryption key ciphertext. The initial column encryption key ciphertext is ciphertext obtained by encrypting the initial column encryption key plaintext by using the client master key.
[0090] In the embodiment, the target column encryption key ciphertext and the initial column encryption key ciphertext are both stored in the system table of the server, and during the process of decrypting the encrypted column data by using the column encryption key ciphertext, the target column encryption key ciphertext stored in the system table is preferentially used to decrypt the column encryption data; if the decryption fails, the initial column encryption key ciphertext is obtained from the server, and the initial column encryption key ciphertext is used to decrypt the column encryption data, so that the column encryption key ciphertext is not completely updated, and the encrypted column data is not decrypted.
[0091] In an optional embodiment, the client master key is obtained, including: obtaining the client master key used for encrypting the initial column encryption key ciphertext; or obtaining client master key parameters, and searching for the client master key locally on the client according to the client master key parameters.
[0092] In another optional embodiment, the initial column encryption key ciphertext is stored in the system table of the server.
[0093] In the embodiment, the initial column encryption key ciphertext is also stored in the system table of the server, and during the process of decrypting the encrypted column data by using the column encryption key ciphertext, the target column encryption key ciphertext stored in the server is preferentially used to decrypt the column encryption data; if the decryption fails, the initial column encryption key ciphertext is obtained from the server, and the initial column encryption key ciphertext is used to decrypt the column encryption data, so that the column encryption key ciphertext is not completely updated, and the encrypted column data is not decrypted.
[0094] S330, obtaining initial data column ciphertext encrypted by using the initial column encryption key ciphertext from the database.
[0095] The initial data column ciphertext is the initial data column encrypted by the initial column encryption key ciphertext.
[0096] In the embodiment, the initial data column ciphertext encrypted by the initial column encryption key ciphertext is queried 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 in the server or an external database.
[0097] S340, the data column ciphertext is decrypted by the initial column encryption key ciphertext to obtain the data column plaintext, and the data column plaintext is encrypted by the target column encryption key ciphertext to obtain the target data column ciphertext.
[0098] The target data column ciphertext is the ciphertext obtained by encrypting the data column plaintext by the target column encryption key ciphertext.
[0099] In the embodiment, the initial data column ciphertext is decrypted by the initial column encryption key ciphertext to obtain the data column plaintext corresponding to the initial data column ciphertext locally in the client. Then, the data column plaintext is encrypted by the target column encryption key ciphertext to obtain the target data column ciphertext.
[0100] S350, the target data column ciphertext is written into the database.
[0101] In the embodiment, the target column encryption key ciphertext is written into the database.
[0102] The technical scheme of the embodiment of the application comprises the following steps: creating a target column encryption key plaintext; encrypting the target column encryption key plaintext by the obtained client master key to obtain a target column encryption key ciphertext, and updating the target column encryption key ciphertext to a system table of a server; obtaining an initial data column ciphertext encrypted by an initial column encryption key ciphertext from a database; decrypting the initial data column ciphertext by the initial column encryption key ciphertext to obtain a data column plaintext, and encrypting the data column plaintext by the target column encryption key ciphertext to obtain a target data column ciphertext; and writing the target data column ciphertext into the database. The updating of the column encryption key CEK in the full-matrix database is realized, the security of the key storage device is ensured, and the consistency of the keys of the client and the server is ensured in the column encryption key updating process, so that the continuous availability of the keys is ensured.
[0103] Embodiment four
[0104] Figure 4 A structure diagram of a key updating device of a full-matrix database according to the fourth embodiment of the application is provided. As shown in the figure, the device comprises a creating module 410, a decryption module 420, an encryption module 430 and an updating module 440. Figure 4
[0105] The creating module 410 is configured to create a target client master key.
[0106] The decryption module 420 is configured to decrypt the initial column encryption key ciphertext by using the initial client master key stored locally by the client to obtain column encryption key plaintext;
[0107] The encryption module 430 is configured to encrypt the column encryption key plaintext by using the target client master key to obtain target column encryption key ciphertext;
[0108] The update module 440 is configured to update the target column encryption key ciphertext into a system table of the server, and update the initial client master key stored locally by the client by using the target client master key.
[0109] The technical scheme of the embodiment of the application creates a target client master key, decrypts initial column encryption key ciphertext by using an initial client master key stored locally by the client to obtain column encryption key plaintext, encrypts the column encryption key plaintext by using the target client master key to obtain target column encryption key ciphertext, and updates the target column encryption key ciphertext into a system table of the server and updates the initial client master key stored locally by the client by using the target client master key, thereby realizing updating of the client master key in a full-encryption database, guaranteeing the security of the key storage device, and ensuring the consistency of the keys of the client and the server during the updating of the client master key, thereby guaranteeing the continuous availability of the keys.
[0110] Optionally, the creation module 410 is specifically configured to:
[0111] create a target client public key and a target client private key locally at the client by using an asymmetric key algorithm;
[0112] use the target client public key and the target client private key as the target client master key.
[0113] Optionally, the application further comprises:
[0114] a hash calculation module configured to calculate a hash value of the target client master key after the target column encryption key ciphertext is updated into the system table of the server and the initial client master key stored locally by the client is updated by using the target client master key;
[0115] a writing module configured to update the hash value of the target client master key into the system table of the server.
[0116] Optionally, the application further comprises:
[0117] a hash acquisition module configured 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 configured to compare a hash value of the client master key to be used with a hash value of the target client master key;
[0119] an encryption and decryption module configured to, if the hash values are the same, encrypt column encryption data using the target column encryption key ciphertext or decrypt the column encryption data;
[0120] a prompt module configured to, if the hash values are different, issue a prompt message prompting a user that the client master key to be used is incorrect.
[0121] The key update device for the fully-meshed database provided in the embodiments of the present application can perform the key update method for the fully-meshed database provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of performing the method.
[0122] Embodiment Five
[0123] Figure 5 A structure diagram of a key update device for a fully-meshed database provided in Embodiment Five of the present application. As shown in the figure, the device comprises a creation module 510, an encryption module 520, an acquisition module 530, a decryption module 540 and a writing module 550; wherein, Figure 5
[0124] The creation module 510 is configured to create a target column encryption key plaintext.
[0125] The encryption module 520 is configured to encrypt the target column encryption key plaintext using the acquired client master key to obtain target column encryption key ciphertext, and update the target column encryption key ciphertext to a system table of a server.
[0126] The acquisition module 530 is configured to acquire initial data column ciphertext encrypted using initial column encryption key ciphertext from a database.
[0127] The decryption module 540 is configured to decrypt the initial data column ciphertext using the initial column encryption key ciphertext to obtain data column plaintext, and encrypt the data column plaintext using the target column encryption key ciphertext to obtain target data column ciphertext.
[0128] The writing module 550 is configured to write the target data column ciphertext into the database.
[0129] The technical scheme of the embodiment of the application creates target column encryption key plaintext; the obtained client master key is used to encrypt the target column encryption key plaintext to obtain target column encryption key ciphertext, and the target column encryption key ciphertext is updated to the system table of the server; the initial data column ciphertext encrypted by the initial column encryption key ciphertext is obtained from the database; the initial data column ciphertext is decrypted by the initial column encryption key ciphertext to obtain data column plaintext, and the data column plaintext is encrypted by the target column encryption key ciphertext to obtain target data column ciphertext; and the target data column ciphertext is written into the database, so that the updating of the column encryption key CEK in the full-mesh database is realized, the security of the key storage device is ensured, and the consistency of the key of the client and the server is ensured in the column encryption key updating process, so that the continuous availability of the key is ensured.
[0130] Optionally, the encryption module 520 comprises:
[0131] The first obtaining unit is configured to obtain the client master key used for encrypting the initial column encryption key ciphertext.
[0132] Alternatively, the second obtaining unit is configured to obtain the client master key parameter, and search for the client master key locally in the client according to the client master key parameter.
[0133] The key updating device for the full-mesh database provided by the embodiment of the application can execute the key updating method for the full-mesh database provided by any embodiment of the application, and has the corresponding function modules and beneficial effects of the execution method.
[0134] Embodiment six
[0135] Figure 6 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the applications described and / or claimed in this document.
[0136] As Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication. The memory stores a computer program executable by the at least one processor 11, 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 loaded from the storage unit 18 into 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] Various 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, a speaker, etc., a storage unit 18, such as a magnetic 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 can be various general and / or special-purpose 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 special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the key update method for a fully homomorphic database.
[0139] In some embodiments, the key update method for a fully homomorphic database can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto 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 homomorphic database described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the key update method for a fully homomorphic database by any other appropriate means, such as by means of firmware.
[0140] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0141] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented on the computer or other programmable apparatus. The computer programs can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0142] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0143] To provide for interaction with a user, the systems and techniques described here can 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 a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0144] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can 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] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can 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 large management difficulty and weak business scalability in traditional physical host and VPS service.
[0146] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in a different order, as long as the desired results of the present disclosure are achieved, and the present disclosure is not limited herein.
[0147] The specific embodiments described above are not intended to be limiting, and persons skilled in the art will appreciate that various modifications, combinations, sub-combinations and alternatives can be made to the specific embodiments without departing from the spirit and principles of the disclosure. Accordingly, the disclosure is not limited to the specific embodiments described above, but only by the scope of the appended claims.
Claims
1. A method for updating a key of a fully homomorphic database, characterized in that, The method applied to the client comprises: creating a target client master key; reading initial column encryption key ciphertext from the server to the client, decrypting the initial column encryption key ciphertext by using the initial client master key stored locally on the client to obtain column encryption key plaintext; encrypting the column encryption key plaintext by using the target client master key to obtain target column encryption key ciphertext; updating the target column encryption key ciphertext to the system table of the server and updating the initial client master key stored locally on the client by using the target client master key; calculating the hash value of the target client master key and updating the hash value of the target client master key to the system table of the server; obtaining the hash value of the client master key to be used and the hash value of the target client master key from the server; comparing the hash value of the client master key to be used with the hash value of the target client master key; if the same, encrypting or decrypting column encryption data by using the target column encryption key ciphertext; if different, issuing a prompt information for prompting the user that the client master key to be used is incorrect.
2. The method of claim 1, wherein, The method for creating a target client master key comprises: creating a target client public key and a target client private key locally on the client by using an asymmetric key algorithm; taking the target client public key and the target client private key as the target client master key.
3. A method for updating a key of a fully homomorphic database, characterized by, The method applied to the client comprises: creating target column encryption key plaintext; obtaining a client master key, encrypting the target column encryption key plaintext by using the client master key to obtain target column encryption key ciphertext and updating the target column encryption key ciphertext to the system table of the server; wherein updating the target column encryption key ciphertext to the system table of the server comprises: updating the original CEK ciphertext field by using the initial column encryption key ciphertext stored in the current CEK ciphertext field; updating the current CEK ciphertext field by using the target column encryption key ciphertext; obtaining initial data column ciphertext encrypted by using the initial column encryption key ciphertext from the database; decrypting the initial data column ciphertext by using the initial column encryption key ciphertext to obtain data column plaintext and encrypting the data column plaintext by using the target column encryption key ciphertext to obtain target data column ciphertext; writing the target data column ciphertext into the database; obtaining a client master key comprises: 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.
4. A key update device of a fully homomorphic database, characterized by, The method comprises: a creating module for creating a target client master key; a decryption module for reading initial column encryption key ciphertext from the server to the client, decrypting the initial column encryption key ciphertext by using the initial client master key stored locally on the client to obtain column encryption key plaintext; an encryption module for encrypting the column encryption key plaintext by using the target client master key to obtain target column encryption key ciphertext; An updating module is configured to update the target column encryption key ciphertext into a system table of a server, and update the initial client master key stored locally by the client with the target client master key; A hash calculation module is configured to calculate a hash value of the target client master key; A writing module is configured to update the hash value of the target client master key into the system table of the server; A hash obtaining module is configured to obtain a hash value of a client master key to be used, and obtain a hash value of a target client master key from the server; A comparison module is configured to compare the hash value of the client master key to be used with the hash value of the target client master key; An encryption and decryption module is configured to, if the hash values are the same, encrypt or decrypt column encryption data using the target column encryption key ciphertext; A prompting module is configured to, if the hash values are different, issue a prompt information, which is used to prompt a user that the client master key to be used is incorrect.
5. A key update device of a fully homomorphic database, characterized by, The method comprises: A creating module is configured to create a target column encryption key plaintext; An encryption module is configured to obtain a client master key, encrypt the target column encryption key plaintext using the client master key, obtain a target column encryption key ciphertext, and update the target column encryption key ciphertext into a system table of a server; wherein updating the target column encryption key ciphertext into the system table of the server comprises: updating an original CEK ciphertext field using an initial column encryption key ciphertext stored in a current CEK ciphertext field; and updating the current CEK ciphertext field using a target column encryption key ciphertext; An obtaining module is configured to obtain an initial data column ciphertext encrypted using an initial column encryption key ciphertext from a database; A decryption module is configured to decrypt the initial data column ciphertext using the initial column encryption key ciphertext to obtain a data column plaintext, and encrypt the data column plaintext using a target column encryption key ciphertext to obtain a target data column ciphertext; A writing module is configured to write the target data column ciphertext into the database; The encryption module comprises: a first obtaining unit configured to obtain a client master key used for encrypting the initial column encryption key ciphertext; or a second obtaining unit configured to obtain a client master key parameter, and search for a client master key locally at the client according to the client master key parameter.
6. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; 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 to enable the at least one processor to execute the key updating method of the full-mechanical state database according to any one of claims 1-3.
7. A computer readable storage medium characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to execute the key updating method of the full-mechanical state database according to any one of claims 1-3 when executed.
Citation Information
Patent Citations
Secret key information acquisition method and device based on full-secret-state database, electronic equipment and storage medium
CN118573366A
Cryptographic System, Updating Method, and Non-Transitory Storage Medium Encoded with Computer Readable Program
US20160365976A1