Method and device for encrypting and decrypting information
By judging access policies and conducting ciphertext accountability during the encryption and decryption process, the problem that existing encryption algorithms cannot meet the needs of information security protection is solved, and the security and reliability of information are improved.
Patent Information
- Application Number
- CN202210790728.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2024-10-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing encryption algorithms cannot meet the current needs for information security protection, causing the information security protection situation to become increasingly severe.
During the encryption and decryption process, it is judged whether the access policy of the decryption end conforms to the target attributes of the ciphertext, and the public parameters and keys are used for decryption; when receiving the accountability instruction, the ciphertext and the preset public key are used for analysis, Obtain the ID of the encryption client and add a ciphertext accountability mechanism.
It improves the security of information, strengthens information protection methods, effectively avoids malicious attacks, and meets the needs of information security protection.
Smart Images

Figure CN115174225B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to an information encryption and decryption method and device. Background Art
[0002] In information technology, encryption algorithms are often used to encrypt and transmit information in order to protect the security of information.
[0003] In the current traditional encryption algorithm, keys are used to encrypt and decrypt information to protect the security of information. Among them, the key policy attribute encryption algorithm introduces the idea of access structure and access policy to further improve the security of information. However, with the continuous update of attack methods, the current encryption algorithm can no longer meet the current demand for information security protection, making the security protection of information increasingly severe. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and device for encrypting and decrypting information to solve the increasingly serious problem of information security protection.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] A first aspect of an embodiment of the present invention discloses a method for encrypting and decrypting information, the method comprising:
[0007] When receiving a decryption instruction carrying ciphertext sent by the decryption end, determining whether the access policy of the decryption end meets the target attribute of the ciphertext, the ciphertext is encrypted in advance based on the information to be encrypted and the identity key of the encryption end;
[0008] When the access policy of the decryption end meets the target attribute of the ciphertext, the ciphertext is decrypted using the public parameter and the key of the decryption end to obtain plaintext, wherein the key of the decryption end is obtained in advance based on the master key and the access policy of the decryption end, and the public parameter and the master key are obtained in advance based on the security parameter input by the user;
[0009] Sending the plaintext to the decryption end;
[0010] When receiving the accountability instruction sent by the decryption end for the ciphertext, the ciphertext, the preset public key and the pre-set accountability chain are used to parse and obtain the ID of the encryption end corresponding to the ciphertext.
[0011] Preferably, the process of setting up the accountability chain includes:
[0012] For each encryption end, obtain the ID of the encryption end, and encrypt the ID of the encryption end based on the public parameters, the master key and the preset attribute set to obtain the identity key of the encryption end;
[0013] The identity key of the encryption end and the ID of the encryption end are uploaded to the accountability chain.
[0014] Preferably, the process of encrypting the information to be encrypted to obtain the ciphertext includes:
[0015] When receiving an encryption instruction carrying information to be encrypted sent by the encryption end, obtaining the identity key of the encryption end;
[0016] Encrypting the information to be encrypted based on the identity key, public parameters and preset attribute set of the encryption end to obtain a ciphertext carrying the target attribute;
[0017] The ciphertext carrying the target attribute is uploaded to the server.
[0018] Preferably, the process of obtaining the public parameters and the master key based on the security parameters includes:
[0019] A security parameter input by a user is received, and a public parameter and a master key are generated based on the security parameter.
[0020] Preferably, the process of obtaining the key of the decryption end based on the master key and the access policy of the decryption end includes:
[0021] Acquire the access policy of the decryption end, and convert the access policy of the decryption end into an access structure;
[0022] A key for the decryption end is generated based on the master key and the access structure.
[0023] Preferably, when receiving the accountability instruction sent by the decryption end for the ciphertext, after parsing the ciphertext, the public key and the preset accountability chain to obtain the ID of the encryption end corresponding to the ciphertext, it also includes:
[0024] When receiving an update instruction carrying a target access policy sent by the decryption end, converting the target access policy into a target access structure;
[0025] Generate an update key of the decryption end based on the target access structure and the key of the decryption end;
[0026] The updated key of the decryption end and the key of the decryption end are combined to obtain a new key of the decryption end, and the new key of the decryption end is sent to the decryption end.
[0027] A second aspect of an embodiment of the present invention discloses an information encryption and decryption device, the device further comprising:
[0028] A judgment unit, configured to judge whether the access policy of the decryption end meets the target attribute of the ciphertext when receiving a decryption instruction carrying ciphertext sent by the decryption end, wherein the ciphertext is encrypted in advance based on the information to be encrypted and the identity key of the encryption end;
[0029] a decryption unit, configured to decrypt the ciphertext using a public parameter and a key of the decryption end to obtain a plaintext when the access policy of the decryption end meets the target attribute of the ciphertext, wherein the key of the decryption end is obtained in advance based on a master key and the access policy of the decryption end, and the public parameter and the master key are obtained in advance based on a security parameter input by a user;
[0030] A sending unit, used for sending the plaintext to the decryption end;
[0031] The accountability unit is used to parse the ciphertext using the ciphertext, a preset public key and a preset accountability chain to obtain the ID of the encryption end corresponding to the ciphertext when receiving the accountability instruction sent by the decryption end for the ciphertext.
[0032] Preferably, the device further comprises:
[0033] The first encryption unit is used to obtain the ID of each encryption end, encrypt the ID of the encryption end based on public parameters, a master key and a preset attribute set to obtain the identity key of the encryption end; and upload the identity key of the encryption end and the ID of the encryption end to the accountability chain.
[0034] Preferably, the device further comprises:
[0035] An acquisition unit, configured to acquire the identity key of the encryption end when receiving an encryption instruction carrying information to be encrypted sent by the encryption end;
[0036] A second encryption unit is used to encrypt the information to be encrypted based on the identity key, public parameters and preset attribute set of the encryption end to obtain a ciphertext carrying the target attribute;
[0037] The uploading unit is used to upload the ciphertext carrying the target attribute to the server.
[0038] Preferably, the device further comprises:
[0039] The generating unit is used to receive the security parameters input by the user, and generate the public parameters and the master key based on the security parameters.
[0040] Based on the above-mentioned embodiment of the present invention, a method and device for encrypting and decrypting information is provided. The method is as follows: when receiving a decryption instruction carrying ciphertext sent by a decryption end, judging whether the access policy of the decryption end meets the target attribute of the ciphertext; when the access policy of the decryption end meets the target attribute of the ciphertext, decrypting the ciphertext using public parameters and the key of the decryption end to obtain plaintext; sending the plaintext to the decryption end; when receiving an accountability instruction sent by the decryption end for the ciphertext, parsing using the ciphertext, the preset public key and the preset accountability chain to obtain the ID of the encryption end corresponding to the ciphertext. Accountability of the encryption end is completed based on the ciphertext, the preset public key and the preset accountability chain, and a ciphertext accountability mechanism is added, which enhances the means of information security protection and improves the security of information. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 A flowchart of a method for encrypting and decrypting information provided by an embodiment of the present invention;
[0043] Figure 2 A flowchart of encrypting to obtain ciphertext based on the information to be encrypted and the identity key of the encryption end provided in an embodiment of the present invention;
[0044] Figure 3 A structural block diagram of an information encryption and decryption device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0047] It should be noted that the information encryption and decryption method and device provided by the present invention can be used in the field of network security technology or financial technology. The above is only an example and does not limit the application field of the information encryption and decryption method and device provided by the present invention.
[0048] As can be seen from the background technology, as attack methods are constantly updated, the current encryption algorithms can no longer meet the current demand for information security protection, making the information security protection situation increasingly severe.
[0049] Therefore, an embodiment of the present invention provides an information encryption and decryption method and device. When receiving a decryption instruction carrying ciphertext sent by a decryption end, it is determined whether the access policy of the decryption end meets the target attribute of the ciphertext; when the access policy of the decryption end meets the target attribute of the ciphertext, the ciphertext is decrypted using the public parameters and the key of the decryption end to obtain the plaintext; the plaintext is sent to the decryption end; when receiving an accountability instruction sent by the decryption end for the ciphertext, the ciphertext, the preset public key and the preset accountability chain are used to parse and obtain the ID of the encryption end corresponding to the ciphertext. The encryption end is held accountable based on the ciphertext, the preset public key and the preset accountability chain, and a ciphertext accountability mechanism is added, which effectively improves the security of information.
[0050] join Figure 1 , shows a flow chart of an information encryption and decryption method provided by an embodiment of the present invention, the encryption and decryption method comprising:
[0051] Step S101: When receiving a decryption instruction carrying ciphertext sent by the decryption end, determine whether the access policy of the decryption end meets the target attribute of the ciphertext. If the access policy of the decryption end meets the target attribute of the ciphertext, execute step S102; if the access policy of the decryption end does not meet the target attribute of the ciphertext, execute step S105.
[0052] It should be noted that the ciphertext is encrypted in advance based on the information to be encrypted and the identity key of the encryption end. The specific implementation method is detailed in the following embodiments of the present invention. Figure 2 The content in.
[0053] It is understandable that when the decryption end obtains ciphertext carrying the target attribute from the server, if the access policy of the decryption end meets the target attribute of the ciphertext, the decryption end can decrypt the ciphertext, otherwise the decryption end cannot decrypt the ciphertext.
[0054] It should be noted that the decryption end checks the integrity and correctness of the ciphertext before sending a decryption instruction for the ciphertext.
[0055] Step S102: Decrypt the ciphertext using the public parameters and the key of the decryption end to obtain the plaintext.
[0056] It should be noted that, in the embodiment of the present invention, for a prime number p, let Z p represents the set {0,1,2,...,p-1} where the set Relative to Z p Less 0, that is represents the set {1,2,...,p-1}. The set U={h 1 ,h 2 ,...,h U} represents a public attribute set, which contains legal and allowed attributes. 1 ,h 2 ,...,h U}∈G, G and G T are two multiplicative cyclic groups, satisfying G×G→G T The set S is the target attribute used when encrypting the information to be encrypted, and the set S is a subset of the set U.
[0057] It can be understood that ct represents ciphertext.
[0058] It should be noted that the security parameters input by the user are received, and the public parameters and the master key are generated based on the security parameters. That is, the security parameters specify the binary bit length of the public parameters and the master key.
[0059] For example, the security parameter entered by the user is 1. λ , using security parameter 1 λ , we get (p,G,H,G T ,textit(e),g,h,H(x)); where textit(e) represents e, e, g and h represent the generators of the algorithm. That is to say, for the general natural number system, 1, 2, 3, ... are generators, and other numbers are obtained through calculations based on these numbers; for encryption algorithms, the numbers used in the encryption process need to be calculated based on these generators (generally exponential operations). The H(x) function represents mapping a string to a number in the encryption algorithm domain.
[0060] It is understandable that the numbers used in the encryption algorithm calculation process are obtained through exponential operation based on the generator, which is different from general natural numbers. Therefore, it is necessary to complete the mapping from a string to an encryption domain number through H (string) = number in the encryption domain.
[0061] based on and calculate Get (h,H,H 1 ,H 2 ,H 3 ,T 1 ,T 2 ) as the public parameter pk; based on calculate Get (g,h,a 1 ,a 2 ,a 3 ,b 1 ,b 2 ,b 3 ,X 1 ,X 2 ,X 3 ) as the master key msk.
[0062] It can be understood that the access policy of the decryption end is obtained, the access policy of the decryption end is converted into an access structure, and the key of the decryption end is generated based on the master key and the access structure.
[0063] It should be noted that (M) i and represents the i-th row of the matrix M; (M) i,j represents the (i,j)th element of the matrix M; M T represents the transposed matrix of matrix M,<a,b> Represents a vector a=(a 1 ,a 2 ,...,a n ) and b=(b 1 ,b 2 ,...,b n ),Right now
[0064] Specifically, for example: using the KeyGen (msk, (M, π)) algorithm, based on and h,b 1 ,b 2 ∈msk calculation Get sk 0 =(K 1 ,K 2 ,K 3 ),sk′ 0 =(K′ 1 ,K′ 2 ,K′ 3).
[0065] The access strategy of the decryption end is converted into an access structure (M, π). For each row i in the access matrix M of the access structure (M, π), use a 1 ,a 2 ,b 1 ,b 2 ∈msk, calculate:
[0066]
[0067] as well as Where t=1,2.
[0068] choose and Randomly, for each row i∈M,t=1,2, based on X 1 ,X 2 ,X 3 ∈msk, calculate:
[0069]
[0070] Set sk again i =(sk i,1 ,sk i,2 ,sk i,3 ), and finally output the key
[0071] In the specific implementation of step S102, the ciphertext is decrypted using the public parameters and the key of the decryption end to obtain the plaintext.
[0072] Specifically, for example, if the access structure (M, π) corresponding to the access policy of the decryption end meets the target attribute S of the ciphertext ct, then there exists a set {λ i |i∈I}, the plaintext msg can be calculated using the Dec(pk,ct,sk) algorithm, that is,
[0073] Step S103: Send the plaintext to the decryption end.
[0074] It can be understood that after the ciphertext is successfully decrypted into plaintext, the plaintext is sent to the decryption end corresponding to the decryption instruction.
[0075] Step S104: When receiving the accountability instruction sent by the decryption end for the ciphertext, the ciphertext, the preset public key and the pre-set accountability chain are used to parse and obtain the ID of the encryption end corresponding to the ciphertext.
[0076] It should be noted that when the decryption end receives the plaintext, if the decryption end determines that the plaintext contains malicious content, the decryption end can send an accountability instruction for the ciphertext.
[0077] Understandably, the process of pre-setting the chain of accountability is as follows:
[0078] For each encryption end, obtain the ID of the encryption end, and encrypt the ID of the encryption end based on the public parameters, the master key and the preset attribute set to obtain the identity key of the encryption end; upload the identity key of the encryption end and the ID of the encryption end to the accountability chain.
[0079] Specifically, for example: using TKeyGen TA (ID, pk, msk, S) algorithm, for each attr∈S, where attr represents an attribute, based on a 3 ∈msk,H(x)∈pk and calculate:
[0080] Where l = 1, 2, 3. Then set tk * =c,tk attr =(tk attr,1 ,tk attr,2 ,tk attr,3 ), and obtain the identity key tk = (tk * ,{tk attr |attr∈S}), and finally the ancestor <ID,tk * >Store to accountability chain T ID middle.
[0081] In the process of implementing step S104, when the accountability instruction for the ciphertext sent by the decryption end is received, the ciphertext, the preset public key and the pre-set accountability chain are used to parse the ciphertext to obtain the ID of the encryption end corresponding to the ciphertext to complete the accountability.
[0082] Specifically, for example: using CTTrace(ct,pk,T ID ) algorithm, for each attr∈S, check ct attr ,ct′ attr ∈G, If the check passes, CTTrace(ct,pk,T ID ) algorithm based on ct * From the accountability chain ID Output the encryption end ID.
[0083] Step S105: If the access policy of the decryption end does not conform to the target attribute of the ciphertext, a decryption failure message is sent to the decryption end.
[0084] It is understandable that if the access policy of the decryption end does not meet the target attribute of the ciphertext, it indicates that the decryption end cannot parse the ciphertext, that is, it has no right to view the ciphertext, and at this time, an encryption failure message is sent to the decryption end. The decryption failure message is used to indicate that the decryption of the ciphertext has failed and cannot be decrypted.
[0085] In some embodiments, after accountability is completed, the decryption end may initiate an update instruction to update the access policy and key corresponding to the decryption end, thereby avoiding malicious attacks, such as changing the access policy (AorB) to a more stringent access policy (AorBandC).
[0086] The specific process of updating the access policy and key corresponding to the decryption end is as follows:
[0087] If an update instruction carrying a target access policy is received from the decryption end, the target access policy is converted into a target access structure.
[0088] An updated key for the decryption side is generated based on the target access structure and the key for the decryption side.
[0089] The updated key of the decryption end and the key of the decryption end are combined to obtain a new key of the decryption end, and the new key of the decryption end is sent to the decryption end.
[0090] Specifically, for example: using KeyUpdate(T K ,<(M′,π′),(M,π)>,msk) algorithm; for type 1, add a new attribute to the access policy: for attr in π instead of attr in π′, set Where i is the row number in the matrix M accessed by attr in the access structure (M,π); Indicates updating the key, where the superscript 1 indicates the key corresponding to type 1; the subscript π(i) indicates mapping the row number of the access matrix M to a specific attribute (for example, for the first row of the access matrix M, the attribute in the access policy corresponding to the subscript π(i) is "attribute 1"). For type 2, delete the attribute in the access policy: for attr in π' instead of attr in π, set in, represents the key update, where the superscript 2 represents the key corresponding to type 2; the subscript π(i) represents the mapping of the row number of the access matrix M to a specific attribute; sk i,t Same as KeyGen algorithm, replacing the row number and access matrix with the new one.
[0091] In the embodiment of the present invention, the encryption end is held accountable based on ciphertext, a preset public key and a pre-set accountability chain, a ciphertext accountability mechanism is added, and the security of information is improved. At the same time, a function of updating the access policy of the decryption end is proposed, which effectively helps the decryption end reduce possible malicious attacks.
[0092] The above embodiments of the present invention Figure 1 For the specific implementation method of encrypting the ciphertext based on the information to be encrypted and the identity key of the encryption end, see Figure 2 , shows a flowchart of encrypting to obtain ciphertext based on the information to be encrypted and the identity key of the encryption end provided by an embodiment of the present invention, including:
[0093] Step S201: when receiving an encryption instruction carrying information to be encrypted sent by the encryption end, obtaining the identity key of the encryption end.
[0094] It can be understood that obtaining the identity key of the encryption end and encrypting the identity key of the encryption end together with the encrypted information will help the decryption end to quickly trace the ID of the encryption end and hold the person accountable when initiating a accountability instruction.
[0095] Step S202: Encrypt the information to be encrypted based on the identity key, public parameters and preset attribute set of the encryption end to obtain a ciphertext carrying the target attribute.
[0096] It can be understood that the ciphertext carries the target attributes for matching with the access policy of the decryption end; at the same time, the ciphertext carries the identity key of the encryption end for holding the encryption end accountable.
[0097] Specifically, for example: using the Enc(pk,tk,S,msg) algorithm, based on calculate: Use H 1 ,H 2 ,h∈pk, set ct 0 =(C 1 ,C 2 ,C 3 ); for all attr∈S and l=1,2,3, calculate:
[0098]
[0099] Setting: ct * =tk * ,ct attr =(ct attr,1 ,ct attr,2 ,ct attr,3 ),ct′ attr =(ct′ attr,1 ,ct textitattr,2,ct′ attr,3 ),calculate: Based on T 1 ,T 2 ∈pk, we get ct = (ct 0 ,{ <ct atttr ,ct′ attr >|atttr∈S}ct′,ct * ).
[0100] Step S203: Upload the ciphertext carrying the target attribute to the server.
[0101] In the specific implementation of step S203, the ciphertext carrying the target attribute is uploaded to the server so that the decryption end obtains the ciphertext for decryption.
[0102] In an embodiment of the present invention, the identity key of the encryption end is embedded in the encryption process, so that when an accountability instruction is initiated, the encryption end corresponding to the ciphertext can be found according to the ciphertext, public key and accountability chain, thereby ensuring the reliability of the information and the traceability of malicious ciphertext.
[0103] Corresponding to the information encryption and decryption method provided by the above embodiment of the present invention, see Figure 3 , shows a structural block diagram of an information encryption and decryption device provided by an embodiment of the present invention, the encryption and decryption device includes: a judgment unit 301, a decryption unit 302, a sending unit 303 and an accountability unit 304.
[0104] The judgment unit 301 is used to judge whether the access policy of the decryption end meets the target attribute of the ciphertext when receiving the decryption instruction carrying the ciphertext sent by the decryption end, and the ciphertext is encrypted in advance based on the information to be encrypted and the identity key of the encryption end.
[0105] The decryption unit 302 is used to decrypt the ciphertext using the public parameters and the key of the decryption end to obtain the plaintext when the access policy of the decryption end meets the target attributes of the ciphertext. The key of the decryption end is obtained in advance based on the master key and the access policy of the decryption end, and the public parameters and the master key are obtained in advance based on the security parameters input by the user.
[0106] The sending unit 303 is used to send the plaintext to the decryption end.
[0107] The accountability unit 304 is used to parse the ciphertext using the ciphertext, the preset public key and the preset accountability chain to obtain the ID of the encryption end corresponding to the ciphertext when receiving the accountability instruction sent by the decryption end for the ciphertext.
[0108] In an embodiment of the present invention, the ciphertext can only be decrypted when the access policy of the decryption end meets the target attributes of the ciphertext, and when the decryption end initiates an accountability instruction for the ciphertext, the ID of the encryption end is parsed according to the ciphertext, the accountability chain and the public key, and the encryption end of the ciphertext is held accountable, which effectively improves the security and reliability of the information.
[0109] Preferably, combined Figure 3 The encryption and decryption device also includes: a first encryption unit, which is used to obtain the ID of the encryption end for each encryption end, encrypt the ID of the encryption end based on public parameters, a master key and a preset attribute set to obtain the identity key of the encryption end; and upload the identity key of the encryption end and the ID of the encryption end to the accountability chain.
[0110] Preferably, combined Figure 3 The encryption and decryption device also includes: an acquisition unit, a second encryption unit and an upload unit.
[0111] The acquisition unit is used to acquire the identity key of the encryption end when receiving an encryption instruction carrying information to be encrypted sent by the encryption end.
[0112] The second encryption unit is used to encrypt the information to be encrypted based on the identity key, public parameters and preset attribute set of the encryption end to obtain a ciphertext carrying the target attribute.
[0113] The upload unit is used to upload the ciphertext carrying the target attribute to the server.
[0114] Preferably, combined Figure 3 The encryption and decryption device also includes: a generation unit, which is used to receive security parameters input by a user and generate public parameters and a master key based on the security parameters.
[0115] Preferably, combined Figure 3 The encryption and decryption device also includes: a second generation unit, which is used to obtain the access policy of the decryption end and convert the access policy of the decryption end into an access structure; and generate a key of the decryption end based on the master key and the access structure.
[0116] Preferably, combined Figure 3 The encryption and decryption device also includes: a conversion unit, a third generation unit and a merging unit.
[0117] The conversion unit is used to convert the target access policy into a target access structure when receiving an update instruction carrying the target access policy sent by the decryption end.
[0118] The third generating unit is used to generate an update key of the decryption end based on the target access structure and the key of the decryption end.
[0119] The merging unit is used to merge the updated key of the decryption end with the key of the decryption end to obtain a new key of the decryption end, and send the new key of the decryption end to the decryption end.
[0120] In summary, the embodiments of the present invention provide a method and device for encrypting and decrypting information, which embeds the identity key of the encryption end into the ciphertext during the encryption stage; decryption can only be performed when the access policy of the decryption end meets the target attributes of the ciphertext, and when the decryption end initiates an accountability instruction for the ciphertext, the encryption end of the ciphertext is parsed out according to the ciphertext, the public key and the accountability chain to complete the accountability; at the same time, the function of updating the access policy is provided, which effectively helps the decryption end avoid malicious attacks, improves the security and reliability of information encryption and decryption in many aspects, and further meets the needs of information security protection.
[0121] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0122] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0123] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for encrypting and decrypting information, characterized in that: The method comprises: When receiving a decryption instruction carrying ciphertext sent by the decryption end, determining whether the access policy of the decryption end meets the target attribute of the ciphertext, the ciphertext is encrypted in advance based on the information to be encrypted and the identity key of the encryption end; When the access policy of the decryption end meets the target attribute of the ciphertext, the ciphertext is decrypted using the public parameter and the key of the decryption end to obtain plaintext, wherein the key of the decryption end is obtained in advance based on the master key and the access policy of the decryption end, and the public parameter and the master key are obtained in advance based on the security parameter input by the user; Sending the plaintext to the decryption end; When receiving the accountability instruction sent by the decryption end for the ciphertext, the ciphertext, the preset public key and the preset accountability chain are used to parse and obtain the ID of the encryption end corresponding to the ciphertext. The process of setting the accountability chain includes: for each encryption end, obtaining the ID of the encryption end, encrypting the ID of the encryption end based on the public parameters, the master key and the preset attribute set to obtain the identity key of the encryption end, and uploading the identity key of the encryption end and the ID of the encryption end to the accountability chain; When the access policy of the decryption end does not conform to the target attribute of the ciphertext, sending a decryption failure message to the decryption end; When receiving an update instruction carrying a target access policy sent by the decryption end, converting the target access policy into a target access structure; Generate an update key of the decryption end based on the target access structure and the key of the decryption end; The updated key of the decryption end and the key of the decryption end are combined to obtain a new key of the decryption end, and the new key of the decryption end is sent to the decryption end.
2. The method according to claim 1, characterized in that The process of encrypting the information to be encrypted to obtain the ciphertext includes: When receiving an encryption instruction carrying information to be encrypted sent by the encryption end, obtaining the identity key of the encryption end; Encrypting the information to be encrypted based on the identity key, public parameters and preset attribute set of the encryption end to obtain a ciphertext carrying the target attribute; The ciphertext carrying the target attribute is uploaded to the server.
3. The method according to claim 1, characterized in that: The process of obtaining the public parameters and the master key based on the security parameters includes: A security parameter input by a user is received, and a public parameter and a master key are generated based on the security parameter.
4. The method according to claim 1, characterized in that: The process of obtaining the key of the decryption end based on the master key and the access policy of the decryption end includes: Acquire the access policy of the decryption end, and convert the access policy of the decryption end into an access structure; A key for the decryption end is generated based on the master key and the access structure.
5. An information encryption and decryption device, characterized in that: The device comprises: A judgment unit, configured to judge whether the access policy of the decryption end meets the target attribute of the ciphertext when receiving a decryption instruction carrying ciphertext sent by the decryption end, wherein the ciphertext is encrypted in advance based on the information to be encrypted and the identity key of the encryption end; a decryption unit, configured to decrypt the ciphertext using a public parameter and a key of the decryption end to obtain a plaintext when the access policy of the decryption end meets the target attribute of the ciphertext, wherein the key of the decryption end is obtained in advance based on a master key and the access policy of the decryption end, and the public parameter and the master key are obtained in advance based on a security parameter input by a user; A sending unit, used for sending the plaintext to the decryption end; An accountability unit, configured to, upon receiving an accountability instruction sent by the decryption end for the ciphertext, parse the ciphertext, a preset public key and a preset accountability chain to obtain an ID of the encryption end corresponding to the ciphertext; The first encryption unit is used to obtain the ID of each encryption end, encrypt the ID of the encryption end based on the public parameter, the master key and the preset attribute set to obtain the identity key of the encryption end; and upload the identity key of the encryption end and the ID of the encryption end to the accountability chain; The device is further configured to send a decryption failure message to the decryption end when the access policy of the decryption end does not conform to the target attribute of the ciphertext; A conversion unit, configured to convert the target access policy into a target access structure when receiving an update instruction carrying the target access policy sent by the decryption end; A third generating unit, configured to generate an update key of the decryption end based on the target access structure and the key of the decryption end; The merging unit is used to merge the updated key of the decryption end with the key of the decryption end to obtain a new key of the decryption end, and send the new key of the decryption end to the decryption end.
6. The device according to claim 5, characterized in that The device also includes: An acquisition unit, configured to acquire the identity key of the encryption end when receiving an encryption instruction carrying information to be encrypted sent by the encryption end; A second encryption unit is used to encrypt the information to be encrypted based on the identity key, public parameters and preset attribute set of the encryption end to obtain a ciphertext carrying the target attribute; The uploading unit is used to upload the ciphertext carrying the target attribute to the server.
7. The device according to claim 5, characterized in that The device also includes: The generating unit is used to receive the security parameters input by the user, and generate the public parameters and the master key based on the security parameters.
