Ciphertext data key updating method and device, equipment, storage medium and program product
By obtaining key update instructions and signing public key decrypting private key signatures, the old ciphertext data is encrypted using key middleware, solving the problem of high update cost of ciphertext data, achieving safe and efficient key updates, reducing the Risk of sensitive information leakage.
Patent Information
- Application Number
- CN202411223652.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-24
AI Technical Summary
The prior art is difficult to realize the update of ciphertext data keys at low cost, resulting in the risk of leakage of sensitive information.
By obtaining the key update instruction and the signature public key, decrypting the private key signature to obtain the hash value, and using the key middleware to encrypt the old ciphertext data to generate new ciphertext data that can be decrypted with the new key, avoiding the old The huge amount of computing power of ciphertext data is decrypted first and then encrypted.
Reduces the cost of ciphertext data key updates, ensuring that only objects holding the correct key can correctly decrypt new ciphertext data, and enhances data security.
Smart Images

Figure CN119182522A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, specifically to technical fields such as cloud storage, encryption and decryption, and key replacement, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for updating a ciphertext data key. Background Art
[0002] The development of cloud technology has led most companies to outsource data storage to cloud service providers. For the sake of privacy, data will be encrypted and stored in the cloud.
[0003] However, the encrypted data stored in the cloud also needs to be processed regularly to avoid the loss of sensitive information caused by the leakage of the original encryption key.
[0004] How to realize the update of ciphertext data keys at low cost is a problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0005] The embodiments of the present disclosure provide a method, device, electronic device, computer-readable storage medium, and computer program product for updating a ciphertext data key.
[0006] In a first aspect, an embodiment of the present disclosure proposes a method for updating a ciphertext data key, including: obtaining a key update instruction and a signature public key sent by a first object; decrypting a private key signature attached to pre-stored old ciphertext data by the first object according to the signature public key to obtain a first hash value, the old ciphertext data being obtained by encrypting plaintext data based on the first key; in response to the first hash value being the same as the second hash value, determining a key middleware according to the key update instruction, the second hash value being a hash value calculated for the old ciphertext data using the same hash algorithm as that used to obtain the first hash value; encrypting the old ciphertext data using the key middleware to obtain new ciphertext data that can be decrypted using a second key, the key middleware being calculated based on the first key and the second key.
[0007] In the second aspect, an embodiment of the present disclosure proposes a ciphertext data key update device, including: an information acquisition unit, configured to obtain a key update instruction and a signature public key sent by a first object; a public key decryption unit, configured to decrypt a private key signature attached to pre-stored old ciphertext data by the first object according to the signature public key, to obtain a first hash value, where the old ciphertext data is encrypted by encrypting plaintext data based on the first key; a key middleware determination unit, configured to determine the key middleware according to the key update instruction in response to the first hash value being the same as the second hash value, where the second hash value is a hash value calculated for the old ciphertext data using the same hash algorithm as that for obtaining the first hash value; a re-encryption processing unit, configured to encrypt the old ciphertext data using the key middleware, to obtain new ciphertext data that can be decrypted using the second key, where the key middleware is calculated based on the first key and the second key.
[0008] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can implement the ciphertext data key update method described in any implementation method in the first aspect when executing.
[0009] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the ciphertext data key update method described in any implementation method of the first aspect when executed.
[0010] In a fifth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement the steps of the ciphertext data key update method as described in any implementation manner in the first aspect.
[0011] The ciphertext data key update scheme provided in this embodiment first verifies whether the user of the incoming key update instruction is the correct data provider through the signature public key, and after confirming that it is indeed the correct data provider, uses the key middleware for changing the first key to the second key in an encrypted manner to instruct the cloud storage service provider to re-encrypt the old ciphertext data. In the subsequent case, only the object holding the correct second key can correctly decrypt the new ciphertext data. It also eliminates the need for the huge amount of computing required to first decrypt the old ciphertext data using the first key and then encrypt it using the second key, thereby reducing the key update cost of the ciphertext data.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0014] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;
[0015] Figure 2 A flowchart of a method for updating a ciphertext data key provided by an embodiment of the present disclosure;
[0016] Figure 3 A schematic diagram of a two-branch processing of a ciphertext data decryption instruction provided in an embodiment of the present disclosure;
[0017] Figure 4 A schematic diagram of a method for generating a private key signature and using a signature public key provided in an embodiment of the present disclosure;
[0018] Figure 5 A schematic diagram of a three-branch process of determining a key middleware by a key update instruction provided in an embodiment of the present disclosure;
[0019] Figure 6 A structural block diagram of a ciphertext data key updating device provided in an embodiment of the present disclosure;
[0020] Figure 7 A schematic diagram of the structure of an electronic device suitable for executing a method for updating a ciphertext data key provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.
[0022] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0023] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the ciphertext data key updating method, apparatus, electronic device, and computer-readable storage medium disclosed in the present invention can be applied.
[0024] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0025] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. The terminal devices 101, 102, 103 and the server 105 can be installed with various applications for realizing information communication between the two, such as cloud storage applications, encrypted data sharing applications, instant messaging applications, etc.
[0026] Terminal devices 101, 102, 103 and server 105 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.; when terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here. When server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here.
[0027] The server 105 can provide various services through various built-in applications. Taking a cloud storage application that can provide a ciphertext data key update service as an example, the server 105 can achieve the following effects when running the cloud storage application: first, receive a key update instruction and a signature public key sent by a first user through a terminal device 101 through the network 104; then, decrypt the private key signature of the first object attached to the pre-stored old ciphertext data according to the signature public key to obtain a first hash value, and the old ciphertext data is obtained by encrypting the plaintext data based on the first key; then, in response to the first hash value being the same as the second hash value, determine the key middleware according to the key update instruction, and the second hash value is a hash value calculated for the old ciphertext data using the same hash algorithm as that for obtaining the first hash value; finally, use the key middleware to encrypt the old ciphertext data to obtain new ciphertext data that can be decrypted using the second key, and the key middleware is calculated based on the first key and the second key.
[0028] It should be noted that the key update instruction and the signature public key can be obtained from the terminal devices 101, 102, 103 through the network 104, or can be pre-stored in the server 105 in various ways. Therefore, when the server 105 detects that these data are already stored locally (for example, when starting to process the previously reserved ciphertext data update task to be processed), it can choose to directly obtain these data locally. In this case, the exemplary system architecture 100 may also not include the terminal devices 101, 102, 103 and the network 104.
[0029] Since rekeying old ciphertext data requires more computing resources and stronger computing power, the ciphertext data key rekeying method provided in the subsequent embodiments of the present disclosure is generally performed by a server 105 (especially a cloud storage server) with stronger computing power and more computing resources. Accordingly, the ciphertext data key rekeying device is generally also set in the server 105. However, it should also be pointed out that when the terminal devices 101, 102, and 103 also have computing power and computing resources that meet the requirements, the terminal devices 101, 102, and 103 can also complete the above-mentioned various operations that are handed over to the server 105 through the cloud storage application installed thereon, and then output the same result as the server 105. Especially in the case where there are multiple terminal devices with different computing powers at the same time, but the cloud storage application determines that the terminal device where it is located has stronger computing power and more remaining computing resources, it can let the terminal device perform the above-mentioned operations, thereby appropriately reducing the computing pressure of the server 105. Accordingly, the ciphertext data key rekeying device can also be set in the terminal devices 101, 102, and 103. In this case, the exemplary system architecture 100 may also not include the server 105 and the network 104 .
[0030] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0031] Please refer to Figure 2 , Figure 2 A flowchart of a method for updating a ciphertext data key provided by an embodiment of the present disclosure, wherein process 200 includes the following steps:
[0032] Step 201: Obtain a key update instruction and a signature public key sent by the first object;
[0033] This step is intended to be performed by the execution subject of the ciphertext data key update method (for example Figure 1 The server 105 shown in FIG. 104 obtains (for example, by Figure 1 The network 104 shown receives) the first object (for example, the first user sends Figure 1 The key update instruction and signature public key sent by the terminal devices 101, 102, and 103 shown.
[0034] Among them, the key update instruction is used to indicate that the first object expresses to the above-mentioned execution subject the need to update the encryption key used for the old ciphertext data pre-stored in the above-mentioned execution subject. The key update instruction can express the demand directly or indirectly, and should also have relevant information or content that can enable the above-mentioned execution subject to recognize the demand. The signature public key is also provided by the first object, which is used by the above-mentioned execution subject to verify whether the first object is the provider of the old ciphertext data and to ensure the integrity of the instruction.
[0035] Step 202: decrypting the private key signature of the first object attached to the pre-stored old ciphertext data according to the signature public key to obtain a first hash value;
[0036] On the basis of step 201, this step aims to enable the execution subject to decrypt the private key signature of the first object attached to the pre-stored old ciphertext data according to the received signature public key, and then obtain the first hash value as the decryption result.
[0037] The old ciphertext data is the plaintext data that the first object sends to the execution subject in advance, and the ciphertext data is obtained after the execution subject encrypts it using the first key. The plaintext data provided by the first object can be encrypted using the first key generated by the first asymmetric encryption algorithm to obtain the old ciphertext data. The old ciphertext data is also pre-attached with the private key signature of the first object, so that subsequent viewers can confirm that the content they view is consistent with the content provided by the provider by attaching the private key signature. Therefore, it can also be used to verify data integrity and confirm the identity of the person who issued the instruction.
[0038] Normally, the private key signature is the product of the first object using its private key to encrypt the digest of plaintext data or old ciphertext data (usually the digest of the original data can be calculated using a hash algorithm). In this case, the public key that matches the private key can be used to decrypt the data to obtain the digest. When the digest is calculated using a hash algorithm, the digest can also be called a hash value.
[0039] Step 203: In response to the first hash value being the same as the second hash value, determining the key middleware according to the key update instruction;
[0040] This step is based on the situation that the first hash value is the same as the second hash value, and is intended for the execution subject to determine the key middleware according to the key update instruction. The key middleware is used as an intermediate product connecting the original key and the new key in the present disclosure.
[0041] Among them, the second hash value is a hash value calculated for the old ciphertext data using the same hash algorithm as that used to obtain the first hash value. For example, when generating a private key signature, the MD5 (Message Digest Algorithm 5) hash algorithm is used. Then, when calculating the second hash value, the MD5 algorithm should also be used to perform hash calculation on the same original data, so as to compare the hash value obtained by decryption with the actually calculated hash value. If the two are consistent, it is considered that the original content when the hash value is calculated is consistent, and there will be no errors or incompleteness in the original content. The result must be derived from the use of the correct key provided by the data provider, thereby verifying that the instruction is indeed from the correct data provider.
[0042] Step 204: Encrypt the old ciphertext data using the key middleware to obtain new ciphertext data that can be decrypted using the second key.
[0043] On the basis of step 203, this step aims to enable the above-mentioned execution subject to encrypt the old ciphertext data using the key middleware to obtain new ciphertext data that can be decrypted using the second key, that is, the key middleware is calculated based on the first key and the second key, and is used to enable the above-mentioned execution subject to directly adjust the decryption key of the obtained new ciphertext data to the second key by re-encrypting the old ciphertext data, without the need for the huge computational overhead of first decrypting the old ciphertext data using the first key and then encrypting it using the second key twice.
[0044] Specifically, the key middleware may include first key information as a part of the old key offset and second key information as a part of the new key generation. In addition, when the encryption process is abstractly represented as a multiplication process, the key middleware may also include the first key as a numerator and the second key as a denominator. When the encryption process is abstractly represented as other processing forms, the two parts of the key middleware may also be expressed in other forms.
[0045] The ciphertext data key updating method provided by the embodiment of the present disclosure first verifies whether the user of the incoming key update instruction is the correct data provider by signing the public key, and after confirming that it is indeed the correct data provider, uses the key middleware for changing the first key to the second key in an encrypted manner to instruct the cloud storage service provider to re-encrypt the old ciphertext data. In the subsequent case, only the object holding the correct second key can correctly decrypt the new ciphertext data. In addition, there is no need to first decrypt the old ciphertext data with the first key and then encrypt it with the second key, which generates a huge amount of computing power, thereby reducing the key updating cost of the ciphertext data.
[0046] Based on the above embodiment which describes how to implement the key update scheme for ciphertext data, the following will also involve how the second object uses the key to initiate decryption of the new ciphertext data. For the two situations that may occur in this process, Figure 3 A schematic diagram of a two-branch process of a ciphertext data decryption instruction is provided, wherein the process 300 includes the following steps:
[0047] Step 301: Obtain a ciphertext data decryption instruction sent by a second object;
[0048] The second object should be an object different from the first object, such as an object authorized or issued with the second key by the first object, such as an object or user having relevant permissions to view the plaintext data provided by the first object.
[0049] Step 302: In response to determining that the ciphertext data decryption instruction carries a second key generated based on the first asymmetric encryption algorithm, the new ciphertext data is decrypted using the second key to obtain the plaintext data provided by the first object;
[0050] This step is based on determining that the ciphertext data decryption instruction carries a second key generated based on the first asymmetric encryption algorithm, and is intended for the above-mentioned execution subject to use the carried second key to decrypt the new ciphertext data, and finally obtain the plaintext data provided by the first object.
[0051] Step 303: In response to determining that the key data decryption instruction does not carry the second key generated based on the first asymmetric encryption algorithm, returning a key error prompt;
[0052] This step is based on determining that the key data decryption instruction does not carry the second key generated based on the first asymmetric encryption algorithm, and is intended for the above-mentioned execution subject to return a key error prompt to the second object that initiated the ciphertext data decryption request.
[0053] Step 304: Determine the identity information of the second object for which a key error prompt is returned;
[0054] Based on step 303, this step aims to determine the identity information of the second object for which a key error prompt is returned by the above-mentioned execution subject, such as name, number, ID, user name, etc., which are used to uniquely identify relevant information of an object.
[0055] Step 305: In response to the state corresponding to the identity information being an abnormal state, the access behavior of the object to which the identity information belongs to the new ciphertext data is recorded as an abnormal access behavior.
[0056] On the basis of step 304, this step aims to further record the access behavior of the object to which the identity information belongs to the new ciphertext data as abnormal access behavior when the above-mentioned execution subject determines that the state corresponding to the identity information is an abnormal state. Among them, the abnormal state can indicate that the object is currently in an abnormal on-the-job state, or is in a super-authorized sensitive state due to having previously accessed sensitive information, etc., then recording the access request initiated by the object as an abnormal access behavior will help to further accurately determine its current state, and help further determine the handling method or restriction measures for it.
[0057] It should be noted that this embodiment exists as a summary embodiment that presents two different branches at the same time. The two different branches can form different embodiments independently, and there is no causal and dependent relationship between the two. In the branch scheme to which step 303 belongs, steps 304 and 305 are only used as a specific subsequent processing method, and are not limited to only including this subsequent processing method. The remaining processing methods can be flexibly formulated according to the specific needs of the actual application scenario.
[0058] In order to deepen the understanding of how to use the signature public key to decrypt the private key signature to obtain the first hash value, this embodiment also uses Figure 4 Provides a specific implementation method. Figure 4 A schematic diagram of a method for generating a private key signature and using a signature public key provided in an embodiment of the present disclosure, wherein process 400 includes the following steps:
[0059] Step 401: Generate a hash value of old ciphertext data using a preset hash algorithm to obtain a first hash value;
[0060] This step is intended to enable the above-mentioned execution subject to calculate the hash value (eg, MD5 value) of the old ciphertext data using a preset hash algorithm (eg, MD5) to obtain a first hash value.
[0061] Step 402: Encrypt the first Hash value using a private key generated by a second asymmetric encryption algorithm to obtain a private key signature;
[0062] Based on step 401, this step aims to encrypt the first hash value by the above-mentioned execution subject using the private key generated by the second asymmetric encryption algorithm to obtain a private key signature. The second asymmetric encryption algorithm is another asymmetric encryption algorithm different from the first asymmetric encryption algorithm.
[0063] The asymmetric encryption algorithm mentioned in each embodiment of the present disclosure, also known as the public key encryption algorithm, uses a pair of keys for encryption and decryption operations. This pair of keys includes a public key (public) and a private key (confidential). The public key is used to encrypt data, while the private key is used to decrypt. The security of asymmetric encryption is based on mathematical problems, such as large number decomposition or discrete logarithm problems.
[0064] Commonly used asymmetric encryption algorithms include:
[0065] RSA (Ron Rivest, Adi Shamir, Leonard Adleman, a combination of parts of the names of the three creators): Based on the problem of large number factorization, it is widely used in data encryption and digital signatures;
[0066] ECDSA (Elliptic Curve Digital Signature Algorithm): Elliptic Curve Digital Signature Algorithm, based on elliptic curve mathematics, provides the same security as RSA, but with a shorter key;
[0067] ElGamal (a common public key encryption algorithm): Based on the discrete logarithm problem, it is mainly used for encryption and key exchange.
[0068] Specifically, the first asymmetric encryption algorithm may be an asymmetric encryption algorithm based on prime numbers (such as RSA), and the second asymmetric encryption algorithm may be an asymmetric encryption algorithm based on elliptic curves (such as SM2 of the national secret algorithm).
[0069] Step 403: attach the private key signature to the old ciphertext data;
[0070] On the basis of step 402, this step aims at having the above-mentioned execution subject attach the private key signature to the old ciphertext data to obtain the old ciphertext data that can be subsequently decrypted by the signature public key.
[0071] Step 404: Determine the public key corresponding to the private key according to the signature public key;
[0072] Step 405: Use the public key to decrypt the private key signature attached to the old ciphertext data to obtain a first hash value.
[0073] After the operations of step 401 to step 403 have been completed in advance, step 404 to step 405 will serve as a specific implementation of step 201 in process 200, providing an implementation method for decrypting a private key signature using a public key corresponding to a signature public key.
[0074] In order to deepen the understanding of how to determine the key middleware according to the key update instruction, this embodiment also Figure 5 Several specific implementation methods are provided. Figure 5 A schematic diagram of a three-branch process of determining a key middleware by a key update instruction provided in an embodiment of the present disclosure:
[0075] Branch 1: In response to the key update instruction including the key middleware, extracting the key middleware from the key update instruction.
[0076] That is, the key middleware is directly included in the key update instruction, that is, the key middleware is directly provided by the first object, and the above-mentioned execution subject only needs to be directly extracted from the key update instruction.
[0077] Branch 2: In response to the key update instruction not including the key middleware, determine a second key as the target key in a preset candidate key library according to the key update instruction; and calculate the key middleware based on the first key and the second key.
[0078] Different from branch one, the key update instruction in this branch does not directly include ready-made key middleware, but includes relevant instruction information that enables the above-mentioned execution subject to determine the second key by itself. Therefore, the above-mentioned execution subject can determine the second key as the target key in the preset alternative key library according to the key update instruction, and then obtain the key middleware based on the known first key and second key.
[0079] Part three: In response to the key update instruction not including the key middleware, generating the key middleware according to the key update instruction and the first key.
[0080] Similar to part two, but different from part two in that: the key update instruction does not include relevant instruction information for the above-mentioned execution subject to determine the second key by itself, but directly includes relevant information for the above-mentioned execution subject to generate the key middleware according to the first key, so that the above-mentioned execution subject can generate the key middleware based on the relevant information and the first key.
[0081] Based on the above three branches, the above execution entity can also return the second key generated based on the key middleware and the first key to the first object as response information of the key update instruction, so that the first object can send the second key to other objects with the permission to view the plaintext data.
[0082] In order to deepen the understanding of how to implement integrity verification, key middleware generation and other processes, this disclosure also combines a specific application scenario and provides a specific mathematical implementation scheme, which specifically uses two asymmetric encryption algorithms, namely RSA+SM2 (national secret algorithm):
[0083] Assume that there is a trusted cloud storage service provider. Data owner A will encrypt and store the data in the provider, and data owner A will give the decryption key to data user B, allowing B to decrypt the encrypted content stored on the cloud service. When data owner A does not want data user B to have the right to decrypt, he will pass a token and signature public key to update the encrypted ciphertext to the cloud service provider. The cloud service provider will update the encrypted ciphertext with the updated token and align the signature with the public key. At this point, data user B cannot decrypt the cloud storage content again based on the previous decryption key, and data owner A does not need to re-download the stored content, decrypt it, and re-encrypt it. It is completely calculated by the cloud service.
[0084] Explanation of symbols:
[0085] G = (x, y): base point of the elliptic curve; z: order of the elliptic curve.
[0086] 1. Key Generation Protocol
[0087] KeyGen→RSA(pk(n,e),sk(n,d)),SM2(pk=Y,sk=x)
[0088] 1) Generate an RSA key pair;
[0089] 2) Select two large prime numbers p and q and calculate n = p·q;
[0090] 3) Calculate m = (p-1)(q-1);
[0091] 4) Select a random number e∈(1,m), satisfying that m and e are relatively prime;
[0092] 5) Calculate d = e -1 mod m (mod refers to the modulus operator, and the algorithm is similar to the remainder algorithm);
[0093] 6) The RSA key pair is obtained as (pk(n, e), sk(n, d));
[0094] 7) Generate a key pair for SM2;
[0095] 8) Select a random number x∈[1,z];
[0096] 9) Obtain the key pair of SM2 (pk(Y=[x]G), sk(x)).
[0097] 2. Token generation protocol GenToken → RSA(pk(n, e1), sk(n, d1))
[0098] 1) Select a random number e2∈(1,m) and e2≠e1, satisfying that m and e are relatively prime;
[0099] 2) Calculation
[0100] 3) Calculate tokens
[0101] 4) Get the updated RSA key pair (pk(n, e1), sk(n, d1)) and token
[0102] 3. Data signature encryption protocol SignCrypt (RSA (pk (n, e)), SM2 (sk (x)), c)
[0103] 1) The data owner encrypts the message m and calculates c = m e ;
[0104] 2) Select a random number k∈[1,z] and calculate R=[k]G=(x,y);
[0105] 3) Calculate r = x + H (c) mod z;
[0106] 4) Calculate the signature σ = ((1 + x) -1 ·(kr·x))mod z;
[0107] 5) Output the signcryption (σ, r, c).
[0108] 4. Data verification and decryption VerifyCrypt(SM2(pk(Y)), RSA(sk(n, d)))→m:
[0109] 1) Calculate R = [s]G + [r + s]Y = (x, y);
[0110] 2) Verify x mod n = r; if verification succeeds, decrypt ;
[0111] 3) Decryption x = c d mod n.
[0112] 5. Signature update Update(c, t, SM2(sk(x)))→(σ1, r1, c1):
[0113] 1) Update ciphertext c1 = c t mod n;
[0114] 2) Select a random number k∈[1,z] and calculate R=[k]G=(x,y);
[0115] 3) Calculate r1 = x + H(c) mod z;
[0116] 4) Calculate the signature σ1 = ((1 + x) -1 ·(k-r1·x))mod z;
[0117] 5) Output the updated signcryption (σ1, r1, c1).
[0118] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a ciphertext data key update device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0119] like Figure 6 As shown, the ciphertext data key update device 600 of this embodiment may include: an information acquisition unit 601, a public key decryption unit 602, a key middleware determination unit 603, and a re-encryption processing unit 604. The information acquisition unit 601 is configured to acquire the key update instruction and the signature public key sent by the first object; the public key decryption unit 602 is configured to decrypt the private key signature attached to the pre-stored old ciphertext data by the first object according to the signature public key to obtain the first Hash value, which is obtained by encrypting the plaintext data based on the first key; the key middleware determination unit 603 is configured to determine the key middleware according to the key update instruction in response to the first Hash value being the same as the second Hash value, and the second Hash value is a Hash value calculated by using the same Hash algorithm as the first Hash value for the old ciphertext data; the re-encryption processing unit 604 is configured to encrypt the old ciphertext data using the key middleware to obtain new ciphertext data that can be decrypted using the second key, which is calculated based on the first key and the second key.
[0120] In this embodiment, in the ciphertext data key updating device 600, the specific processing of the information acquisition unit 601, the public key decryption unit 602, the key middleware determination unit 603, and the re-encryption processing unit 604 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 - 204 in the corresponding embodiment are not repeated here.
[0121] In some optional implementations of this embodiment, the ciphertext data key updating device 600 may further include:
[0122] The old ciphertext data generating unit is configured to encrypt the plaintext data provided by the first object using a first key generated by a first asymmetric encryption algorithm to obtain old ciphertext data.
[0123] In some optional implementations of this embodiment, the ciphertext data key updating device 600 may further include:
[0124] A decryption instruction acquisition unit, configured to acquire a ciphertext data decryption instruction sent by the second object;
[0125] The decryption processing unit is configured to, in response to determining that the ciphertext data decryption instruction carries a second key generated based on the first asymmetric encryption algorithm, decrypt the new ciphertext data using the second key to obtain the plaintext data provided by the first object.
[0126] In some optional implementations of this embodiment, the ciphertext data key updating device 600 may further include:
[0127] The key error prompt returning unit is configured to return a key error prompt in response to determining that the key data decryption instruction does not carry the second key generated based on the first asymmetric encryption algorithm.
[0128] In some optional implementations of this embodiment, the ciphertext data key updating device 600 may further include:
[0129] An identity information determining unit, configured to determine identity information of a second object for which a key error prompt is returned;
[0130] The abnormal access behavior recording unit is configured to record the access behavior of the object to which the identity information belongs to the new ciphertext data as an abnormal access behavior in response to the state corresponding to the identity information being an abnormal state.
[0131] In some optional implementations of this embodiment, the first asymmetric encryption algorithm includes: an asymmetric encryption algorithm based on prime numbers.
[0132] In some optional implementations of this embodiment, the ciphertext data key updating device 600 may further include:
[0133] A first hash value calculation unit is configured to generate a hash value of the old ciphertext data using a preset hash algorithm to obtain a first hash value;
[0134] a private key signature calculation unit, configured to encrypt the first hash value using a private key generated by a second asymmetric encryption algorithm to obtain a private key signature, wherein the second asymmetric encryption algorithm is different from the first asymmetric encryption algorithm;
[0135] The private key signature attaching unit is configured to attach the private key signature to the old ciphertext data.
[0136] In some optional implementations of this embodiment, the public key decryption unit is further configured to:
[0137] Determine the public key corresponding to the private key based on the signature public key;
[0138] The public key is used to decrypt the private key signature attached to the old ciphertext data to obtain the first hash value.
[0139] In some optional implementations of this embodiment, the second asymmetric encryption algorithm includes: an asymmetric encryption algorithm based on an elliptic curve.
[0140] In some optional implementations of this embodiment, the asymmetric encryption algorithm based on elliptic curve includes: an asymmetric national encryption algorithm based on elliptic curve.
[0141] In some optional implementations of this embodiment, the key middleware includes first key information as a part for offsetting the old key and second key information as a part for generating the new key.
[0142] In some optional implementations of this embodiment, when the encryption process is abstractly represented as a multiplication process, the key middleware correspondingly includes a first key as a numerator and a second key as a denominator.
[0143] In some optional implementations of this embodiment, the key middleware determination unit is further configured to:
[0144] In response to the key update instruction not including the key middleware, determining a second key as the target key in a preset candidate key library according to the key update instruction;
[0145] The key middleware is calculated based on the first key and the second key.
[0146] In some optional implementations of this embodiment, the key middleware determination unit is further configured to:
[0147] In response to the key update instruction not including the key middleware, the key middleware is generated according to the key update instruction and the first key.
[0148] In some optional implementations of this embodiment, the ciphertext data key updating device 600 may further include:
[0149] The second key returning unit is configured to return the second key generated based on the key middleware and the first key to the first object as response information of the key update instruction, so that the first object sends the second key to other objects with plaintext data viewing permission.
[0150] This embodiment exists as an apparatus embodiment corresponding to the above-mentioned method embodiment. The ciphertext data key updating apparatus provided by this embodiment first verifies whether the user of the incoming key update instruction is the correct data provider by signing the public key, and after confirming that it is indeed the correct data provider, uses the key middleware for changing the first key to the second key in an encrypted manner to instruct the cloud storage service provider to re-encrypt the old ciphertext data. In the subsequent case, only the object holding the correct second key can correctly decrypt the new ciphertext data. In addition, there is no need to first decrypt the old ciphertext data with the first key and then encrypt it with the second key, which generates a huge amount of computing power, thereby reducing the key update cost of the ciphertext data.
[0151] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the ciphertext data key update method described in any of the above embodiments can be implemented when the at least one processor executes.
[0152] According to an embodiment of the present disclosure, the present disclosure further provides a readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to implement the ciphertext data key update method described in any of the above embodiments when executed.
[0153] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which, when executed by a processor, can implement the ciphertext data key updating method described in any of the above embodiments.
[0154] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure 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, 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 disclosure described and / or required herein.
[0155] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0156] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0157] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the ciphertext data key update method. For example, in some embodiments, the ciphertext data key update method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the ciphertext data key update method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the ciphertext data key update method in any other appropriate manner (e.g., by means of firmware).
[0158] 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.
[0159] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code 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.
[0160] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. 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.
[0161] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 input, voice input, or tactile input).
[0162] The systems and techniques described herein may be implemented in a computing system that includes back-end 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 front-end 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 back-end components, middleware components, or front-end 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), and the Internet.
[0163] A computer 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 relationship between the client and the server 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 virtual private servers (VPS) services.
[0164] According to the technical solution of the embodiment of the present disclosure, firstly, a signature public key is used to verify whether the user of the incoming key update instruction is the correct data provider. After confirming that it is indeed the correct data provider, a key middleware for changing the first key to the second key in an encrypted manner is used to instruct the cloud storage service provider to re-encrypt the old ciphertext data. In the subsequent case, only the object holding the correct second key can correctly decrypt the new ciphertext data. In addition, there is no need to first decrypt the old ciphertext data with the first key and then encrypt it with the second key, which generates a huge amount of computing power, thereby reducing the key update cost of the ciphertext data.
[0165] 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 recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0166] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. 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 disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for updating a ciphertext data key, comprising: Obtain the key update instruction and signature public key sent by the first object; decrypting the private key signature of the first object attached to the pre-stored old ciphertext data according to the signature public key to obtain a first hash value, wherein the old ciphertext data is obtained by encrypting the plaintext data based on the first key; In response to the first Hash value being the same as the second Hash value, determining the key middleware according to the key update instruction, the second Hash value being a Hash value calculated on the old ciphertext data using the same Hash algorithm as that for obtaining the first Hash value; The old ciphertext data is encrypted using the key middleware to obtain new ciphertext data that can be decrypted using a second key, which is calculated by the key middleware based on the first key and the second key.
2. The method according to claim 1, further comprising: The plaintext data provided by the first object is encrypted using a first key generated by a first asymmetric encryption algorithm to obtain the old ciphertext data.
3. The method according to claim 2, further comprising: Obtaining a ciphertext data decryption instruction sent by the second object; In response to determining that the ciphertext data decryption instruction carries a second key generated based on the first asymmetric encryption algorithm, the new ciphertext data is decrypted using the second key to obtain the plaintext data provided by the first object.
4. The method according to claim 3, further comprising: In response to determining that the key data decryption instruction does not carry the second key generated based on the first asymmetric encryption algorithm, a key error prompt is returned.
5. The method according to claim 4, further comprising: Determine identity information of a second object to which the key error prompt is returned; In response to the state corresponding to the identity information being an abnormal state, an access behavior of the object to which the identity information belongs to the new ciphertext data is recorded as an abnormal access behavior.
6. The method according to any one of claims 2 to 4, wherein: The first asymmetric encryption algorithm includes: an asymmetric encryption algorithm based on prime numbers.
7. The method according to claim 2, further comprising: Generate a hash value of the old ciphertext data using a preset hash algorithm to obtain the first hash value; Encrypting the first Hash value using a private key generated by a second asymmetric encryption algorithm to obtain the private key signature, where the second asymmetric encryption algorithm is different from the first asymmetric encryption algorithm; The private key signature is attached to the old ciphertext data.
8. The method according to claim 7, wherein: The step of decrypting the private key signature of the first object attached to the pre-stored old ciphertext data according to the signature public key to obtain a first hash value includes: Determine a public key corresponding to the private key according to the signature public key; The private key signature attached to the old ciphertext data is decrypted using the public key to obtain the first hash value.
9. The method according to claim 7 or 8, wherein: The second asymmetric encryption algorithm includes: an asymmetric encryption algorithm based on elliptic curve.
10. The method according to claim 9, wherein: The asymmetric encryption algorithm based on elliptic curve includes: an asymmetric national encryption algorithm based on elliptic curve.
11. The method according to claim 1, wherein: The key middleware includes first key information as a part for canceling an old key and second key information as a part for generating a new key.
12. The method according to claim 11, wherein: When the encryption process is abstractly represented as a multiplication process, the key middleware correspondingly includes a first key as a numerator and a second key as a denominator.
13. The method according to claim 1, wherein: The determining the key middleware according to the key update instruction includes: In response to the key middleware not being included in the key update instruction, determining a second key as a target key in a preset candidate key library according to the key update instruction; The key middleware is obtained by calculation based on the first key and the second key.
14. The method according to claim 1, wherein: The determining the key middleware according to the key update instruction includes: In response to the key update instruction not including the key middleware, generating the key middleware according to the key update instruction and the first key.
15. The method according to claim 13 or 14, further comprising: A second key generated based on the key middleware and the first key is returned to the first object as response information of the key update instruction, so that the first object sends the second key to other objects having the plaintext data viewing permission.
16. A ciphertext data key update device, comprising: An information acquisition unit, configured to acquire a key update instruction and a signature public key sent by the first object; a public key decryption unit configured to decrypt the private key signature of the first object attached to the pre-stored old ciphertext data according to the signature public key to obtain a first hash value, wherein the old ciphertext data is obtained by encrypting the plaintext data based on the first key; a key middleware determining unit configured to determine the key middleware according to the key update instruction in response to the first Hash value being the same as a second Hash value, the second Hash value being a Hash value calculated for the old ciphertext data using the same Hash algorithm as that for obtaining the first Hash value; The re-encryption processing unit is configured to encrypt the old ciphertext data using the key middleware to obtain new ciphertext data that can be decrypted using a second key, and the key middleware is calculated based on the first key and the second key.
17. The apparatus according to claim 16, further comprising: The old ciphertext data generating unit is configured to encrypt the plaintext data provided by the first object by using a first key generated by a first asymmetric encryption algorithm to obtain the old ciphertext data.
18. The apparatus according to claim 17, further comprising: A decryption instruction acquisition unit, configured to acquire a ciphertext data decryption instruction sent by the second object; The decryption processing unit is configured to, in response to determining that the ciphertext data decryption instruction carries a second key generated based on the first asymmetric encryption algorithm, decrypt the new ciphertext data using the second key to obtain the plaintext data provided by the first object.
19. The apparatus according to claim 18, further comprising: The key error prompt returning unit is configured to return a key error prompt in response to determining that the key data decryption instruction does not carry the second key generated based on the first asymmetric encryption algorithm.
20. The apparatus according to claim 19, further comprising: An identity information determining unit, configured to determine identity information of a second object to which the key error prompt is returned; The abnormal access behavior recording unit is configured to record the access behavior of the object to which the identity information belongs to the new ciphertext data as an abnormal access behavior in response to the state corresponding to the identity information being an abnormal state.
21. The device according to any one of claims 17 to 20, wherein: The first asymmetric encryption algorithm includes: an asymmetric encryption algorithm based on prime numbers.
22. The apparatus of claim 17, further comprising: A first hash value calculation unit is configured to generate a hash value of the old ciphertext data using a preset hash algorithm to obtain the first hash value; a private key signature calculation unit, configured to encrypt the first Hash value using a private key generated by a second asymmetric encryption algorithm to obtain the private key signature, wherein the second asymmetric encryption algorithm is different from the first asymmetric encryption algorithm; The private key signature attaching unit is configured to attach the private key signature to the old ciphertext data.
23. The device according to claim 22, wherein: The public key decryption unit is further configured to: Determine a public key corresponding to the private key according to the signature public key; The private key signature attached to the old ciphertext data is decrypted using the public key to obtain the first hash value.
24. The device according to claim 22 or 23, wherein: The second asymmetric encryption algorithm includes: an asymmetric encryption algorithm based on elliptic curve.
25. The device according to claim 24, wherein: The asymmetric encryption algorithm based on elliptic curve includes: an asymmetric national encryption algorithm based on elliptic curve.
26. The device according to claim 16, wherein: The key middleware includes first key information as a part for canceling an old key and second key information as a part for generating a new key.
27. The device according to claim 26, wherein: When the encryption process is abstractly represented as a multiplication process, the key middleware correspondingly includes a first key as a numerator and a second key as a denominator.
28. The device according to claim 16, wherein: The key middleware determination unit is further configured to: In response to the key middleware not being included in the key update instruction, determining a second key as a target key in a preset candidate key library according to the key update instruction; The key middleware is obtained by calculation based on the first key and the second key.
29. The device according to claim 16, wherein: The key middleware determination unit is further configured to: In response to the key update instruction not including the key middleware, generating the key middleware according to the key update instruction and the first key.
30. The apparatus according to claim 28 or 29, further comprising: The second key returning unit is configured to return the second key generated based on the key middleware and the first key to the first object as response information of the key update instruction, so that the first object sends the second key to other objects with the permission to view the plaintext data.
31. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the ciphertext data key updating method described in any one of claims 1-15.
32. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the ciphertext data key update method according to any one of claims 1 to 15.
33. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method for updating a ciphertext data key according to any one of claims 1 to 15.
Citation Information
Cited By
Key replacement method, cluster system, device, medium and product
CN119402192A
