Encryption method and device, electronic equipment and storage medium
By generating keys through multiple encryption nodes and verifying the data source, the problem of data encryption interruption caused by the failure of a single encryption node is solved, achieving dual protection of the uploader and encrypted data by restricting the uploader.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING INST OF TECH
- Filing Date
- 2023-03-17
- Publication Date
- 2026-04-21
AI Technical Summary
In existing encryption methods, the failure of a single encryption node can cause the data encryption process to be interrupted, and there is no effective restriction on the uploader of the data to be encrypted, which may lead to malicious uploaders damaging the encryption system.
Multiple encryption nodes are used to generate at least two keys to encrypt the data to be encrypted, and the source of the data is verified to generate a verification result. If the preset conditions are met, the data is re-encrypted.
It enables data encryption to continue even when the encryption node fails, identifies and restricts malicious data uploaders, and improves the security and stability of encrypted data.
Smart Images

Figure CN116684115B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data encryption technology, and in particular to an encryption method, device, electronic device, and storage medium. Background Technology
[0002] With the rapid growth of data volume, resource-constrained devices cannot support complex data computations, making data outsourcing a primary solution to these problems. However, outsourced data falls outside the control of the data owner, potentially leading to data leaks. To maintain data confidentiality, access control mechanisms typically operate on encrypted data.
[0003] In existing technologies, traditional data encryption methods typically rely on a single encryption node (key authorization center). While managing a single node is convenient, its failure, such as a power outage or attack, can render the entire encryption system uncontrollable. Data encryption and user access control can only be restored once the encryption node recovers. Furthermore, existing encryption methods often only restrict users who access encrypted data, leaving uploaders of data to be encrypted unrestricted. This allows malicious uploaders to compromise the encryption system. Summary of the Invention
[0004] In view of this, the purpose of this disclosure is to provide an encryption method, apparatus, electronic device and storage medium.
[0005] As one aspect of this disclosure, an encryption method is provided, characterized by comprising:
[0006] Obtain the data to be encrypted and generate at least two keys;
[0007] The data to be encrypted is encrypted based on the at least two keys to obtain encrypted data.
[0008] The source of the encrypted data is verified and the verification result is obtained;
[0009] In response to determining that the verification result meets the preset conditions, the encrypted data is re-encrypted to obtain re-encrypted data.
[0010] Optionally, the at least two keys include a first key and a second key, and the step of obtaining the data to be encrypted and generating at least two keys includes:
[0011] Obtain the data to be encrypted;
[0012] The bilinear group of the data to be encrypted is determined based on preset security parameters;
[0013] The common parameters of the data to be encrypted are determined based on a hash function;
[0014] The first key and the second key are generated based on the bilinear group and the public parameters, respectively. The first key includes a first master private key, and the second key includes a public key and a second master private key.
[0015] Optionally, the public key is represented as:
[0016]
[0017] Among them, pk k Let represent the public key, e represent the bilinear pairing, g represent the generator of G in the bilinear group, y0 represent the master private key, and t represent the public key. k,i This represents a random value selected for each attribute in each authorization center that generates the key;
[0018] The first master private key is represented as follows:
[0019] msk CA =(y0, {s k} k=1,...,K )
[0020] Among them, msk CA This represents the first master private key, y0 represents the encryption core random number, and s k This represents a random value chosen by each authorization center that generates the key;
[0021] The second master private key is represented as follows:
[0022] msk k =(s k , t k,i )
[0023] Among them, msk k This represents the second master private key, s k t represents the random value chosen by each authorization center for generating the key. k,i This represents the random value selected for each attribute in each authorization center that generates the key.
[0024] Optionally, the at least two keys include a first key and a second key, and the step of obtaining the data to be encrypted and generating at least two keys further includes:
[0025] A first decryption key and a second decryption key are generated based on the first key and the second key;
[0026] The first decryption key is represented as:
[0027]
[0028] Among them, D k,i Let represent the first decryption key, g represent the generator of G in the bilinear group, p(i) represent the value of the polynomial with user attribute i as input, and t k,i A represents a random value chosen for each attribute in each authorization center that generates the key. u Represents a collection of user attributes;
[0029] The second decryption key is represented as follows:
[0030]
[0031] Among them, D CA Let represent the second decryption key, g represent the generator of G in the bilinear group, y0 represent the encryption core random number, and k represent the number of key authorization centers that generated the second key. This represents the random number generation function, and u represents the user's identity.
[0032] Optionally, the encrypted data is represented as:
[0033]
[0034] Where ct represents the encrypted data, g represents the generator of G in the bilinear group, s and r represent two randomly selected random numbers, and t k,i This represents the random value chosen for each attribute in each authorization center that generates the key. Let represent the attribute set of the k-th second key authorization center, where k represents the number of key authorization centers that generate the second key, e represents bilinear pairing, y0 represents the encryption core random number, and m represents the data to be encrypted.
[0035] Optionally, verifying the data source of the encrypted data and obtaining the verification result includes:
[0036] Generate a signature public key and a verification private key for the data source of the encrypted data based on a public-key cryptography algorithm or a homomorphic encryption algorithm;
[0037] The encrypted data is verified based on the signature public key and the verification private key, and a verification result is obtained.
[0038] Optionally, in response to determining that the verification result meets preset conditions, the encrypted data is re-encrypted to obtain re-encrypted data, including:
[0039] In response to determining that the verification result is from a trusted source, the encrypted data is re-encrypted to obtain re-encrypted data;
[0040] The re-encrypted data is represented as follows:
[0041]
[0042] Where ct′ represents the re-encrypted data, g represents the generator of G in the bilinear group, s and r represent two randomly selected random numbers, r′ represents, and i represents... Let represent the attribute set of the k-th second key authorization center, where k represents the number of key authorization centers that generate the second key, e represents bilinear pairing, y0 represents the encryption core random number, and m represents the data to be encrypted.
[0043] As a second aspect of this disclosure, this disclosure also provides an encryption device, comprising:
[0044] The key generation module is configured to: acquire the data to be encrypted and generate at least two keys;
[0045] The data encryption module is configured to: encrypt the data to be encrypted based on the at least two keys to obtain encrypted data;
[0046] The encrypted data verification module is configured to: verify the data source of the encrypted data and obtain the verification result;
[0047] The data re-encryption module is configured to: in response to determining that the verification result meets preset conditions, re-encrypt the encrypted data to obtain re-encrypted data.
[0048] As a third aspect of this disclosure, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the encryption provided by this disclosure when executing the program.
[0049] As a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is also provided, the non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the methods described in any of the foregoing embodiments.
[0050] As described above, this disclosure provides an encryption method, apparatus, electronic device, and storage medium. In this disclosure, the data to be encrypted is first encrypted using a preset first key and a second key to obtain encrypted data. Then, the source of the encrypted data is verified to generate a verification result. Finally, the encrypted data whose verification result meets preset conditions is re-encrypted. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in this disclosure or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1A This is a schematic diagram of an encryption method provided in an embodiment of the present disclosure.
[0053] Figure 1B This is a schematic diagram of a key generation method provided in an embodiment of the present disclosure.
[0054] Figure 1C This is a schematic diagram of an encrypted data verification method provided in an embodiment of the present disclosure.
[0055] Figure 2 This is a schematic diagram of an encryption device structure provided in an embodiment of the present disclosure.
[0056] Figure 3 This is a schematic diagram of an electronic device structure for an encryption method provided in an embodiment of this disclosure. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0058] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this disclosure should have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms "first," "second," and similar terms used in the embodiments of this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0059] As described in the background section, existing encryption methods typically generate a key through a single encryption node (i.e., a single key authorization center), and then use this key to encrypt the file to be encrypted. In this case, since there is only one encryption node, when the encryption system malfunctions (e.g., power outage, network interruption), this encryption node will completely lose its operational function (i.e., it cannot generate a key to encrypt the data), thus halting the data encryption process. This halt may even lead to the corruption of the data being encrypted.
[0060] Furthermore, existing encryption methods typically only restrict whoever acquires the encrypted data, without specifying who uploads it. Specifically, they only restrict the process by which users want to read (acquire) encrypted data (e.g., requiring a corresponding decryption key). Conversely, the uploader of the data to be encrypted can upload any unverified data to the encryption system for encryption and then make it available for acquisition and viewing by those who wish to acquire it. Using this existing method can lead to malicious uploaders of the data to be encrypted (e.g., competitors, adversaries, saboteurs, etc.) uploading problematic data to the encryption system, thereby damaging the system and potentially causing serious harm to the network systems of those who acquire the encrypted data (data provided by the malicious uploader).
[0061] To address the aforementioned problems, this disclosure provides an encryption method, apparatus, electronic device, and storage medium. Using the above method, the data to be encrypted is first encrypted using a preset first key and a second key to obtain encrypted data. Then, the source of the encrypted data is verified, and a verification result is generated. Finally, the encrypted data whose verification result meets preset conditions is re-encrypted.
[0062] In the above process, firstly, a single key generated by a single encryption node (single authorization center) in existing technologies is distributed into at least two keys generated by multiple encryption nodes (multiple authorization centers), and then the data to be encrypted is encrypted using at least two keys. This operation ensures that even if one encryption node is compromised, data encryption can still be completed through other encryption nodes without forcibly suspending the encryption process. Secondly, verifying the source of the encrypted data allows malicious data uploaders to be identified, thereby protecting the network security of both the encryption system and the recipients of the encrypted data. Finally, further encryption enhances the security of the data and makes it more resistant to compromise.
[0063] After introducing the basic principles of this disclosure, various non-limiting embodiments of this disclosure will be described in detail below.
[0064] Figure 1A This is a schematic diagram of an encryption method provided in an embodiment of the present disclosure.
[0065] Figure 1A The encryption method shown further includes the following steps:
[0066] Step S10: Obtain the data to be encrypted and generate at least two keys.
[0067] Figure 1B This is a schematic diagram of a key generation method provided in an embodiment of the present disclosure.
[0068] In some alternative embodiments, such as Figure 1B As shown, step S10 specifically includes:
[0069] S101: Obtain the data to be encrypted.
[0070] S102: Determine the bilinear group of the data to be encrypted based on preset security parameters.
[0071] S103: Determine the common parameters of the data to be encrypted based on the hash function.
[0072] S104: Generate the first key and the second key based on the bilinear group and the public parameters, wherein the first key includes a first master private key and the second key includes a public key and a second master private key.
[0073] In some optional embodiments, the entire encryption process described in this disclosure can be completed using an encryption system. The encryption system used in this disclosure may include a first encryption node (master key authorization center) and several second encryption nodes (secondary key authorization centers). In the initial stage, the encryption system can first obtain the data to be encrypted uploaded by the uploader and request the uploader's identity information (e.g., the uploader's name, work unit, professional category, etc.) for verification of the data source (i.e., the uploader's relevant information) during subsequent encryption processes. It is understood that the encryption method in this disclosure can also be implemented directly through multiple encryption nodes (multiple key authorization centers), and the specific operation process is equivalent to all the data encryption content described in this disclosure. This disclosure will not provide specific descriptions of other implementation forms.
[0074] In some optional embodiments, after the encryption system obtains the data to be encrypted, it can generate a first key through a first encryption node and generate second keys through several second encryption nodes. Specifically, the process can be understood as follows: first, a security parameter λ is preset (which can be understood as the security standard set by the encryption system); then, the bilinear group pp = (q, e, G, G) of the obtained data to be encrypted is determined using the preset security parameter λ. T g, g t ), where G and G T It is a cyclic group of order q, and e is a bilinear pair G×G→G T g, g t They are group G, G T The generators of this bilinear group. It is understandable that this bilinear group is selected based on security parameters, and therefore it satisfies the security standards of cryptographic systems.
[0075] In some alternative embodiments, after obtaining the bilinear group, the encryption system can also determine the encryption core random numbers y0, s1, s2, ..., s using a hash function H: {0, 1} → G. K ←Z q And a random value {t} selected based on each attribute in each cryptographic node (key authorization center) that generates the key. k,i} k=1...K,i=1...n ←Z q Then, the common parameters of the data to be encrypted are determined by the number of encryption cores and the random values selected for each attribute in each encryption node (key authorization center) based on the generated key, pp = (q, e, G, G). T g, g t (H). It is understandable that encryption systems can also directly determine the public parameters of the data to be encrypted through hash functions.
[0076] In some optional embodiments, after the encryption system obtains the bilinear group of the data to be encrypted and the common parameters of the data to be encrypted, it can generate a first key and a second key through a first encryption node and several second encryption nodes. The first key may include a first master private key, and the second key includes a public key and a second master private key.
[0077] In some alternative embodiments, the public key can be represented as:
[0078]
[0079] Among them, pk k Let represent the public key, e represent the bilinear pairing, g represent the generator of G in the bilinear group, y0 represent the master private key, and t represent the public key. k,i This represents the random value selected for each attribute in each authorization center that generates the key.
[0080] In some alternative embodiments, the first master private key can be represented as:
[0081] msk CA =(y0, {s k} k=1,...,K )
[0082] Among them, msk CA This represents the first master private key, y0 represents the encryption core random number, and s k This represents the random value chosen by each authorization center that generates the key.
[0083] In some optional embodiments, the second master private key is represented as:
[0084] msk k =(s k , t k,i )
[0085] Among them, msk k This represents the second master private key, s k t represents the random value chosen by each authorization center for generating the key. k,i This represents the random value selected for each attribute in each authorization center that generates the key.
[0086] In some optional embodiments, the first encryption node may consist of only one node, which can act as the initiator of the encryption process (i.e., the master node that completes all encryption of the data to be encrypted). Correspondingly, several second encryption nodes can be set up, which can act as secondary nodes to share the keys generated by the first encryption node. Specifically, this process can be understood as follows: the first encryption node generates all the aforementioned keys (i.e., the master key including the public and private keys). Then, the first encryption node can divide the private key into two parts according to a preset value; the part it retains is the first master private key, and the remaining part is the second master private key. Afterward, the first encryption node can send the second master private key and the public key to several second encryption nodes to generate the final first key and second key. It is understood that this disclosure specifies only one first encryption node because having only one first encryption node allows for better coordination with other nodes in the encryption system and more convenient linkage with them. However, the encryption method in this disclosure can also be completed through the cooperation of several first encryption nodes and several second encryption nodes; this disclosure will not elaborate on this form.
[0087] In some optional embodiments, when the first encryption node malfunctions or is damaged due to unforeseen circumstances (e.g., power outage, network outage, etc.), the encryption system can quickly switch the permissions of the first encryption node to one of several second encryption nodes so that the encryption process can continue to be completed.
[0088] In some optional embodiments, the key generation process described above can transform the existing process of generating and encrypting a key based on a single encryption node into a collaborative process where a first encryption node is the primary encryptor and several second (other) encryption nodes assist in encrypting the data to be encrypted. This ensures that even if the first encryption node experiences an unexpected event (e.g., power outage, network outage), the encryption process can continue through the several second (other) encryption nodes, preventing the encryption process from being interrupted.
[0089] In some optional embodiments, step S10 further includes:
[0090] S105: Generate a first decryption key and a second decryption key based on the first key and the second key.
[0091] In some optional embodiments, after the first key and the second key are generated, the encryption system can also generate a first decryption key and a second decryption key that match the first key and the second key through the first encryption node and a plurality of second encryption nodes.
[0092] In some optional embodiments, the first decryption key is represented as:
[0093]
[0094] Among them, D k,i Let represent the first decryption key, g represent the generator of G in the bilinear group, p(i) represent the value of the polynomial with user attribute i as input, and t k,i A represents a random value chosen for each attribute in each authorization center that generates the key. u This represents a collection of user attributes.
[0095] In some optional embodiments, the second decryption key is represented as:
[0096]
[0097] Among them, D CA Let represent the second decryption key, g represent the generator of G in the bilinear group, y0 represent the encryption core random number, and k represent the number of key authorization centers that generated the second key. This represents the random number generation function, and u represents the user's identity.
[0098] In some optional embodiments, after generating the first key, first decryption key, second key, and second decryption key, the encryption system can store all the keys internally and then transmit the key capable of decrypting the required encrypted data to qualified encrypted data acquirers. As mentioned above, qualified encrypted data acquirers can be specific user groups pre-selected by the encryption system owner. The encryption system owner can then input the characteristics of these user groups into the encryption system, enabling the encryption system to automatically identify these user groups and transmit the corresponding decryption keys to them.
[0099] In some alternative embodiments, the process of the encryption system transmitting decryption keys to a specific user group (compliant encrypted data acquirers) can be achieved through at least one key transmission method among pre-shared keys, setting up a key distribution center, Diffie-Hellman key exchange, and asymmetric encryption. Once the encryption system transmits the corresponding decryption keys to the specific user group, they can use these keys to read the encrypted data, ultimately achieving the decryption process.
[0100] Step S20: Encrypt the data to be encrypted based on the at least two keys to obtain encrypted data.
[0101] In some optional embodiments, after generating the first key and the second key, the encryption system can encrypt the data to be encrypted uploaded by the uploader using the first key and the second key, and generate corresponding encrypted data (encrypted ciphertext). It is understood that the encrypted ciphertext generated by the encryption method in this disclosure can be feature-based encrypted ciphertext.
[0102] In some optional embodiments, the above-described process of generating feature-encrypted ciphertext can be understood as follows: the encryption system first extracts key features of the data to be encrypted (e.g., the core content of a paper) using a preset neural network model, and then encrypts the extracted features to generate feature-encrypted ciphertext. Afterward, the encryption system can transmit the generated feature-encrypted ciphertext to a qualified data acquirer for reading and viewing, while non-feature parts of the data to be encrypted (e.g., the name, age, and other relevant information of the uploader) are not transmitted to the data acquirer. Through this operation, the encryption system transmits the core content needed by the data acquirer while retaining a portion of the original content of the data to be encrypted. This makes the encrypted data itself more secure and stable, and also provides a certain degree of protection for the privacy of the data uploader.
[0103] In some alternative embodiments, the encrypted data (feature-encrypted ciphertext) can be represented as:
[0104]
[0105] Where ct represents the encrypted data, g represents the generator of G in the bilinear group, s and r represent two randomly selected random numbers, and t k,i This represents the random value chosen for each attribute in each authorization center that generates the key. Let represent the attribute set of the k-th second key authorization center, where k represents the number of key authorization centers that generate the second key, e represents bilinear pairing, y0 represents the encryption core random number, and m represents the data to be encrypted.
[0106] In some optional embodiments, this disclosure completes the first encryption process of the data to be encrypted through all the operations described above. As mentioned earlier, in this disclosure, by transforming the existing process of generating a key and encrypting it based on a single encryption node into a process where a first encryption node is the primary node and several second (other) encryption nodes work together to encrypt the data to be encrypted, it is possible to ensure that even if the first encryption node encounters an unexpected situation (e.g., power outage, network outage, etc.), the encryption process can continue through several second (other) encryption nodes, without forcibly interrupting the encryption process. Furthermore, in the encryption process of this disclosure, the encryption system can also selectively encrypt the characteristics (core content) of the data to be encrypted, making the encrypted data itself more secure and stable, while also providing a certain degree of protection for the privacy of the uploader of the data.
[0107] Step S30: Verify the data source of the encrypted data and obtain the verification result.
[0108] Figure 1C This is a schematic diagram of an encrypted data verification method provided in an embodiment of the present disclosure.
[0109] In some alternative embodiments, such as Figure 1C As shown, step S30 specifically includes:
[0110] S301: Generate a signature public key and a verification private key for the data source of the encrypted data based on a public-key cryptography algorithm or a homomorphic encryption algorithm.
[0111] S302: Verify the encrypted data based on the signature public key and the verification private key, and obtain the verification result.
[0112] In some optional embodiments, the encryption process described above can be used to encrypt the data to be encrypted. However, as described in the background section of this disclosure, in actual encryption processes, existing encryption methods typically only restrict users who acquire the encrypted data, but do not impose corresponding restrictions on those who upload the data to be encrypted. This could allow malicious uploaders of the data to be encrypted to damage the encryption system. Therefore, this disclosure also implements restrictions on uploaders of the data to be encrypted by verifying the source of the data to be encrypted.
[0113] In some optional embodiments, when the encryption system needs to verify the source of the data to be encrypted, it can generate a signing public key and a verification private key based on the uploader of the data. The signing public key can be understood as another encryption method for the data to be encrypted, and the verification private key is the key used to verify the signing public key.
[0114] In some optional embodiments, the aforementioned signing public key and verification private key can be generated using at least one of public-key cryptography algorithms or homomorphic encryption algorithms. It is understood that the signing public key and verification private key can be set based on the personal information of the uploader of the data to be encrypted. Specifically, the encryption system can first set the required data source information (e.g., content from a specific organization, field, or department), and then generate the signing public key and verification private key based on this. When the uploader of the data to be encrypted uploads data to the encryption system, the encryption system can obtain the uploader's relevant information (e.g., name, work unit, field of expertise, etc.), and then use the aforementioned signing public key and verification private key to compare and verify with the preset data source information, ultimately obtaining the verification result (including "trusted source" and "untrusted source").
[0115] In some optional embodiments, the encryption system may pre-set several signatures of the uploaders of the data to be encrypted and generate a signature public key. Then, when the uploader of the data to be encrypted uploads the data to the encryption system, the encryption system can verify the signature of the uploader of the data to be encrypted and obtain the final verification result (including "trusted source" and "untrusted source").
[0116] Step S40: In response to determining that the verification result meets the preset conditions, the encrypted data is re-encrypted to obtain re-encrypted data.
[0117] In some optional embodiments, step S40 specifically includes:
[0118] S401: In response to determining that the verification result is a trusted source, the encrypted data is re-encrypted to obtain re-encrypted data.
[0119] In some optional embodiments, if the verification result of the aforementioned encrypted data meets the preset conditions of the encryption system (i.e., the verification result is a "trusted source"), the encryption system can re-encrypt the encrypted data to make the encrypted data more secure and have higher protection.
[0120] In some alternative embodiments, the re-encrypted data is represented as:
[0121]
[0122] Where ct′ represents the re-encrypted data, g represents the generator of G in the bilinear group, s and r represent two randomly selected random numbers, r′ represents, and i represents... Let represent the attribute set of the k-th second key authorization center, where k represents the number of key authorization centers that generate the second key, e represents bilinear pairing, y0 represents the encryption core random number, and m represents the data to be encrypted.
[0123] In some alternative embodiments, the entire encryption process described above can also be combined with blockchain technology. The immutability of blockchain further enhances the security of the data to be encrypted uploaded by the uploader.
[0124] In some optional embodiments, the encryption process in this disclosure may further involve first initializing the encryption system. Specifically, given a security parameter λ, a public key pk and a master private key msk are output for each authorization center, and the master private key msk is output for the master authorization center. Furthermore, the verification public key vk and the signing private key sgk are also output.
[0125] In some optional embodiments, key generation is performed after the encryption system is initialized. The specific key generation algorithm mainly consists of the following two parts:
[0126] Decryption key generation by several second encryption nodes (attribute key authorization centers): This algorithm is executed separately by each attribute key authorization center. It uses the user's identity (UID) and each authorization center's master private key (msk). k The required threshold number of attributes, d k A set of attributes corresponding to the authorization center As input, output the private key D for each attribute of each authorization center. k,j .
[0127] First encryption node (Master Key Authorization Center) decryption key generation: This algorithm is executed by the Master Key Authorization Center. It takes the user's identity UID and the Master Key Authorization Center's private key msk as input, and outputs the user's private key D. CA .
[0128] In some optional embodiments, after generating the corresponding key, the encryption system can perform data encryption processing on the data to be encrypted. The data encryption algorithm in the data encryption processing can utilize the sender's identity i, the signing private key sgk, and a set of attributes corresponding to each attribute key authorization center. Each attribute key authorization center's public key pk k Take data m as input and output ciphertext CT = (ct, σ(i)), where ct is the encryption of the data message and σ(i) is the signature of the sender.
[0129] In some optional embodiments, after encrypting the data to be encrypted and generating encrypted data, the source of the encrypted data can be verified (data sanitization). The data sanitization algorithm in this disclosure mainly consists of two parts:
[0130] Signature Check: Taking sender i as input, and public key vk and signature σ(i), the purifier first checks the correctness of the sender's signature. If the signature is incorrect, the purifier directly outputs ⊥. If the signature is correct, the ciphertext is purified.
[0131] Data cleansing: The cleanser takes the ciphertext ct as input and outputs the cleaned ciphertext ct′.
[0132] In some optional embodiments, after verifying the source of the encrypted data (data cleansing), the encrypted data can be sent to the recipient, who will then decrypt it. Data decryption involves the cleaned ciphertext ct′ and a set of user attributes A. u The attribute key authorization center provides a private key D for each attribute. k,j The master key authorization center holds the user's private key D CA As input. If both the sender and receiver are authorized, and the authorization center satisfies the following for each attribute key: Then the decrypted data message m will be output.
[0133] In summary, this disclosure first encrypts the data to be encrypted using a preset first key and a second key to obtain encrypted data, then verifies the source of the encrypted data to generate a verification result, and finally re-encrypts the encrypted data whose verification result meets the preset conditions.
[0134] This disclosure addresses the single point of failure problem of a single encryption node (single key authorization center) in a sanitizable encryption scheme by providing an improved method that involves the cooperation of several encryption nodes (multiple key authorization centers). The goal is to ensure that the sanitizable encryption scheme remains secure and functions normally even when some key authorization centers are no longer secure.
[0135] It is understood that the encryption method, apparatus, electronic device and storage medium provided in this disclosure can achieve function encryption of multiple authorization centers, and at the same time achieve access control between the uploader of the data to be encrypted and the acquirer of the data to be encrypted, thereby greatly improving the privacy protection capability of the data to be encrypted and the attack tolerance capability of the encryption system in this disclosure.
[0136] Based on the same technical concept, corresponding to the methods of any of the above embodiments, this disclosure also provides an encryption device, which can implement the encryption method described in any of the above embodiments.
[0137] Figure 2 This is a schematic diagram of an encryption device structure provided in an embodiment of the present disclosure.
[0138] Figure 2 The encryption device shown further includes the following modules:
[0139] The module includes a key generation module 10, a data encryption module 20, an encrypted data verification module 30, and a data re-encryption module 40.
[0140] The key generation module 10 is configured to acquire the data to be encrypted and generate at least two keys. Specifically, the following steps are performed:
[0141] Obtain the data to be encrypted;
[0142] The bilinear group of the data to be encrypted is determined based on preset security parameters;
[0143] The common parameters of the data to be encrypted are determined based on a hash function;
[0144] The first key and the second key are generated based on the bilinear group and the common parameters, respectively, wherein the first key includes a first master private key and the second key includes a public key and a second master private key;
[0145] The public key is represented as follows:
[0146]
[0147] Among them, pk k Let represent the public key, e represent the bilinear pairing, g represent the generator of G in the bilinear group, y0 represent the master private key, and t represent the public key. k,i This represents a random value selected for each attribute in each authorization center that generates the key;
[0148] The first master private key is represented as follows:
[0149] msk CA =(y0, {sk} k=1,...,K )
[0150] Among them, msk CA This represents the first master private key, y0 represents the encryption core random number, and s k This represents a random value chosen by each authorization center that generates the key;
[0151] The second master private key is represented as follows:
[0152] msk k =(s k , t k,i )
[0153] Among them, msk k This represents the second master private key, s k t represents the random value chosen by each authorization center for generating the key. k,i This represents a random value selected for each attribute in each authorization center that generates the key;
[0154] A first decryption key and a second decryption key are generated based on the first key and the second key;
[0155] The first decryption key is represented as:
[0156]
[0157] Among them, D k,i Let represent the first decryption key, g represent the generator of G in the bilinear group, p(i) represent the value of the polynomial with user attribute i as input, and t k,i A represents a random value chosen for each attribute in each authorization center that generates the key. u Represents a collection of user attributes;
[0158] The second decryption key is represented as follows:
[0159]
[0160] Among them, D CA Let represent the second decryption key, g represent the generator of G in the bilinear group, y0 represent the encryption core random number, and k represent the number of key authorization centers that generated the second key. This represents the random number generation function, and u represents the user's identity.
[0161] The data encryption module 20 is configured to encrypt the data to be encrypted based on the at least two keys to obtain encrypted data. Specifically, the following steps are performed:
[0162] The encrypted data is represented as follows:
[0163]
[0164] Where ct represents the encrypted data, g represents the generator of G in the bilinear group, s and r represent two randomly selected random numbers, and t k,i This represents the random value chosen for each attribute in each authorization center that generates the key. Let represent the attribute set of the k-th second key authorization center, where k represents the number of key authorization centers that generate the second key, e represents bilinear pairing, y0 represents the encryption core random number, and m represents the data to be encrypted.
[0165] The encrypted data verification module 30 is configured to verify the data source of the encrypted data and obtain a verification result. Specifically, the following steps are performed:
[0166] Generate a signature public key and a verification private key for the data source of the encrypted data based on a public-key cryptography algorithm or a homomorphic encryption algorithm;
[0167] The encrypted data is verified based on the signature public key and the verification private key, and a verification result is obtained.
[0168] The data re-encryption module 40 is configured to: in response to determining that the verification result meets preset conditions, re-encrypt the encrypted data to obtain re-encrypted data. Specifically, the following steps are performed:
[0169] In response to determining that the verification result is from a trusted source, the encrypted data is re-encrypted to obtain re-encrypted data;
[0170] The re-encrypted data is represented as follows:
[0171]
[0172] Where ct′ represents the re-encrypted data, g represents the generator of G in the bilinear group, s and r represent two randomly selected random numbers, r′ represents, and i represents... Let represent the attribute set of the k-th second key authorization center, where k represents the number of key authorization centers that generate the second key, e represents bilinear pairing, y0 represents the encryption core random number, and m represents the data to be encrypted.
[0173] Based on the same technical concept, corresponding to the methods of any of the above embodiments, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the encryption method described in any of the above embodiments.
[0174] Figure 3 This embodiment illustrates a more specific hardware structure of an electronic device, which may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0175] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0176] The memory 1020 can be implemented in the form of ROM (Read-Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0177] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0178] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (e.g., USB, Ethernet cable) or wireless means (e.g., mobile network, Wi-Fi, Bluetooth).
[0179] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0180] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0181] The electronic devices described above are used to implement the corresponding encryption methods in any of the foregoing embodiments and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0182] Based on the same technical concept, corresponding to the methods of any of the above embodiments, this disclosure also provides a non-transitory computer-readable storage medium that stores computer instructions for causing the computer to execute the encryption method as described in any of the above embodiments.
[0183] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0184] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the encryption method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0185] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this disclosure (including the claims) is limited to these examples; within the framework of this disclosure, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this disclosure as described above, which are not provided in detail for the sake of brevity.
[0186] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this disclosure, the provided drawings may or may not show well-known power / ground connections to integrated circuit (IC) chips and other components. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this disclosure, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this disclosure will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuitry) have been set forth to describe exemplary embodiments of this disclosure, it will be apparent to those skilled in the art that the embodiments of this disclosure may be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0187] Although this disclosure has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0188] This disclosure is intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An encryption method characterized by, include: Obtain the data to be encrypted and generate at least two keys; The data to be encrypted is encrypted based on the at least two keys to obtain encrypted data. The source of the encrypted data is verified and the verification result is obtained; In response to determining that the verification result meets the preset conditions, the encrypted data is re-encrypted to obtain re-encrypted data; The at least two keys include a first key and a second key, and the step of obtaining the data to be encrypted and generating at least two keys includes: Obtain the data to be encrypted; The bilinear group of the data to be encrypted is determined based on preset security parameters; The common parameters of the data to be encrypted are determined based on a hash function; The first key and the second key are generated based on the bilinear group and the common parameters, respectively, wherein the first key includes a first master private key and the second key includes a public key and a second master private key; The public key is represented as follows: in, Represents the public key. Indicates bilinear pairing. In the bilinear group generator, Indicates the master private key. This represents a random value selected for each attribute in each authorization center that generates the key; The first master private key is represented as follows: wherein, denotes a first master private key, denotes a master private key, denotes a random number value selected for each authority center that generates a key; The second master private key is represented as follows: wherein, denotes a second master private key, denotes a random number value selected for each authority center for key generation, denotes a random number value selected for each attribute in each authority center for key generation.
2. The method of claim 1, wherein, The at least two keys include a first key and a second key, and the step of obtaining the data to be encrypted and generating at least two keys further includes: A first decryption key and a second decryption key are generated based on the first key and the second key; The first decryption key is represented as: in, Indicates the first decryption key. In the bilinear group generator, This represents the value of the polynomial when user attribute i is used as input. This represents a random value chosen for each attribute in each authorization center that generates the key. Represents a collection of user attributes; The second decryption key is represented as follows: in, This indicates the second decryption key. In the bilinear group generator, Indicates the master private key. This indicates the number of key authorization centers that generated the second key. This represents a random number generation function. Indicates user identity.
3. The method of claim 1, wherein, The encrypted data is represented as follows: in, Indicates encrypted data. In the bilinear group generator, , This represents two randomly selected random numbers. This represents a random value chosen for each attribute in each authorization center that generates the key. This represents the attribute set of the k-th second key authorization center. This indicates the number of key authorization centers that generated the second key. Indicates bilinear pairing. Indicates the master private key. This indicates the data to be encrypted.
4. The method of claim 1, wherein, The step of verifying the data source of the encrypted data and obtaining the verification result includes: Generate a signature public key and a verification private key for the data source of the encrypted data based on a public-key cryptography algorithm or a homomorphic encryption algorithm; The encrypted data is verified based on the signature public key and the verification private key, and a verification result is obtained.
5. The method of claim 4, wherein, The step of re-encrypting the encrypted data in response to determining that the verification result meets preset conditions, to obtain re-encrypted data, includes: In response to determining that the verification result is from a trusted source, the encrypted data is re-encrypted to obtain re-encrypted data; The re-encrypted data is represented as follows: in, This indicates that the data will be re-encrypted. In the bilinear group generator, , This represents two randomly selected random numbers. Represents attributes, This represents the attribute set of the k-th second key authorization center. This indicates the number of key authorization centers that generated the second key. Indicates bilinear pairing. Indicates the master private key. This indicates the data to be encrypted.
6. An encryption device characterized by comprising: include: The key generation module is configured to: acquire the data to be encrypted and generate at least two keys; The data encryption module is configured to: encrypt the data to be encrypted based on the at least two keys to obtain encrypted data; The encrypted data verification module is configured to: verify the data source of the encrypted data and obtain the verification result; The data re-encryption module is configured to: in response to determining that the verification result meets the preset conditions, re-encrypt the encrypted data to obtain re-encrypted data; The at least two keys include a first key and a second key, and the key generation module is configured to: Obtain the data to be encrypted; The bilinear group of the data to be encrypted is determined based on preset security parameters; The common parameters of the data to be encrypted are determined based on a hash function; The first key and the second key are generated based on the bilinear group and the common parameters, respectively, wherein the first key includes a first master private key and the second key includes a public key and a second master private key; The public key is represented as follows: in, Represents the public key. Indicates bilinear pairing. In the bilinear group generator, Indicates the master private key. This represents a random value selected for each attribute in each authorization center that generates the key; The first master private key is represented as follows: in, This represents the first master private key. Indicates the master private key. This represents a random value chosen by each authorization center that generates the key; The second master private key is represented as follows: wherein, represents a second master private key, represents a random number value selected for each authority center for key generation, represents a random number value selected for each attribute in each authority center for key generation.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method in any one of claims 1 to 5 when executing the program.
8. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 5.