CN109214201B - Data sharing method, terminal equipment and computer readable storage medium - Google Patents

Data sharing method, terminal equipment and computer readable storage medium Download PDF

Info

Publication number
CN109214201B
CN109214201B CN201811025481.6A CN201811025481A CN109214201B CN 109214201 B CN109214201 B CN 109214201B CN 201811025481 A CN201811025481 A CN 201811025481A CN 109214201 B CN109214201 B CN 109214201B
Authority
CN
China
Prior art keywords
attribute
data
key
encrypted data
private key
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811025481.6A
Other languages
Chinese (zh)
Other versions
CN109214201A (en
Inventor
王翼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811025481.6A priority Critical patent/CN109214201B/en
Publication of CN109214201A publication Critical patent/CN109214201A/en
Application granted granted Critical
Publication of CN109214201B publication Critical patent/CN109214201B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6272Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database by registering files or documents with a third party

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Storage Device Security (AREA)

Abstract

The application discloses a data sharing method, terminal equipment and a computer readable storage medium, which are applied to the field of asymmetric encryption, wherein the data sharing method comprises the following steps: acquiring plaintext data, wherein the attribute of the plaintext data comprises arithmetic and/or decryptable; encrypting the plaintext data according to the attribute of the plaintext data to generate decryptable and operational encrypted data, operational encrypted data or decryptable encrypted data; the encrypted data is sent to the server so that the server holds the encrypted data. According to the method, the device and the system, the plaintext data is encrypted according to the attribute of the plaintext data, and then the encrypted data obtained after the plaintext data is encrypted is sent to the server, so that the server stores the encrypted data, other users can acquire the encrypted data from the server, meanwhile, the safety of the data is ensured, and the data access rights of different users are limited, so that the method for sharing the data is high-efficiency.

Description

Data sharing method, terminal equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of information security technologies, and in particular, to a data sharing method, a terminal device, and a computer readable storage medium.
Background
The cloud computing model can provide services on demand, and can access a configurable computing resource sharing pool through a network at any time and any place, wherein the sharing pool comprises a network, a storage, a server, services, application programs and the like. However, although cloud computing can reduce management cost and rapidly configure provisioning and release resources, many users are not dared to adopt this computing mode, because cloud computing is performed by a third party, and the security of data of the cloud computing cannot be guaranteed. The security problems brought by cloud computing mainly comprise virtualization security, application security, identity information security, data security and the like. With the popularization of cloud computing, the cloud stores a large amount of user sensitive information and business data, and once the data is leaked, irreparable loss can be caused to users.
In order to ensure the safety of the data, the user encrypts the data first and then uploads the encrypted data to the cloud. Since the decrypted key is kept by the user, the encrypted data can not be used by other users except the encrypted data which can be decrypted by the user, thereby ensuring the security of the data.
After the data is encrypted, although the security of the data is guaranteed, the encrypted data cannot be used by other users, so when other users need to use the encrypted data, the owners of the encrypted data distribute keys one by one, but such a method is time-consuming and labor-consuming, and the use and sharing efficiency of the encrypted data is reduced.
Disclosure of Invention
The embodiment of the application provides a data sharing method, which can improve the efficiency of data sharing.
In a first aspect, an embodiment of the present application provides a data sharing method, where the data sharing method includes:
acquiring plaintext data, wherein the attribute of the plaintext data comprises arithmetic and/or decryptable;
encrypting the plaintext data according to the attribute of the plaintext data to generate encrypted data which can be decrypted and operated, encrypted data which can be operated or encrypted data which can be decrypted;
and sending the encrypted data to a server so that the server can store the encrypted data.
With reference to the first aspect, in a first implementation manner of the first aspect, the encrypting the plaintext data according to the attribute of the plaintext data, to generate decryptable encrypted data, includes:
if the attribute of the plaintext data is the decryptable, randomly generating a first key pair, wherein the first key pair comprises a first private key and a first public key;
and carrying out encryption calculation on the plaintext data by utilizing the first public key based on a strategy attribute, and generating the decryptable encrypted data, wherein the strategy attribute describes a decryption rule of the encrypted data.
With reference to the first aspect, in a second implementation manner of the first aspect, the encrypting the plaintext data according to the attribute of the plaintext data, to generate operational encrypted data, includes:
if the attribute of the plaintext data is the arithmetic, randomly generating a second key pair, wherein the second key pair comprises a second private key and a second public key;
and fully homomorphic encryption is carried out on the plaintext data by utilizing the second public key, and the operable encrypted data is generated.
With reference to the first aspect, in a third implementation manner of the first aspect, the encrypting the plaintext data according to the attribute of the plaintext data, to generate decryptable and operational encrypted data, includes:
if the attribute of the plaintext data comprises the arithmetic and the decryptable, randomly generating a first key pair and a second key pair, wherein the first key pair comprises a first private key and a first public key, and the second key pair comprises a second private key and a second public key;
the encryption calculation based on the strategy attribute is carried out on the plaintext data by utilizing the first public key, so as to obtain the decryptable encrypted data;
and carrying out the homomorphic encryption calculation on the encryption data capable of being encrypted by using the second public key to generate encryption data capable of being decrypted and operated.
With reference to the first implementation manner of the first aspect, in a fourth implementation manner of the first aspect, after the generating the decryptable encrypted data, the method further includes:
acquiring the first private key;
performing encryption calculation based on the strategy attribute on the first private key to obtain a private key ciphertext;
and sending the private key ciphertext to the server so that the server stores the private key ciphertext.
With reference to the third implementation manner of the first aspect, in a fifth implementation manner of the first aspect, after the generating the decryptable and operational encrypted data, the method further includes:
acquiring the first private key and the second private key;
combining the first private key and the second private key to obtain a third private key;
performing encryption calculation based on the strategy attribute on the third private key to obtain a private key ciphertext;
and sending the private key ciphertext to the server so that the server stores the private key ciphertext.
With reference to the first implementation manner of the first aspect, in a sixth implementation manner of the first aspect, the performing, by using the first public key, encryption calculation based on a policy attribute on the plaintext data includes:
Receiving an attribute set through a display touch screen, wherein the attribute set comprises at least one attribute;
formulating an attribute access control strategy according to the attribute set;
acquiring the attribute access control strategy and a first public key in the first key pair;
encrypting the plaintext data using the first public key and the attribute access control policy.
In a second aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a unit for executing the data sharing method of the first aspect, and the terminal device includes:
the acquisition unit is used for acquiring plaintext data, and the attribute of the plaintext data comprises arithmetic and/or decryptable; the encryption unit is used for encrypting the plaintext data according to the attribute of the plaintext data to generate encryption data which can be decrypted and operated, encryption data which can be operated or encryption data which can be decrypted; and the sending unit is used for sending the encrypted data to a server so that the server can store the encrypted data.
With reference to the second aspect, in a first implementation manner of the second aspect:
the terminal equipment further comprises a generation unit, wherein the generation unit is used for randomly generating a first key pair if the attribute of the plaintext data is the decryptable one, and the first key pair comprises a first private key and a first public key;
The encryption unit is specifically configured to perform encryption calculation based on a policy attribute on the plaintext data by using the first public key, and generate the decryptable encrypted data, where the policy attribute describes a decryption rule of the encrypted data.
With reference to the second aspect, in a second implementation manner of the second aspect:
the terminal equipment further comprises a generation unit, wherein the generation unit is used for randomly generating a second key pair if the attribute of the plaintext data is the arithmetic, and the second key pair comprises a second private key and a second public key;
the encryption unit is specifically configured to perform homomorphic encryption on the plaintext data by using the second public key, so as to generate the operable encrypted data.
With reference to the second aspect, in a third implementation manner of the second aspect:
the terminal equipment further comprises a generation unit, and if the attribute of the plaintext data comprises the arithmetic and the decryptable, a first key pair and a second key pair are randomly generated, wherein the first key pair comprises a first private key and a first public key, and the second key pair comprises a second private key and a second public key;
the encryption unit is specifically configured to perform the encryption calculation based on the policy attribute on the plaintext data by using the first public key, so as to obtain the decryptable encrypted data; and carrying out the homomorphic encryption calculation on the encryption data capable of being encrypted by using the second public key to generate encryption data capable of being decrypted and operated.
With reference to the first implementation manner of the second aspect, in a fourth implementation manner of the second aspect:
the acquisition unit is further used for acquiring the first private key;
the encryption unit is further used for performing encryption calculation based on the strategy attribute on the first private key to obtain a private key ciphertext;
the sending unit is further configured to send the private key ciphertext to the server, so that the server stores the private key ciphertext.
With reference to the third implementation manner of the second aspect, in a fifth implementation manner of the second aspect:
the acquisition unit is used for acquiring the first private key and the second private key;
the terminal equipment further comprises a combination unit for combining the first private key and the second private key to obtain a third private key;
the encryption unit is further configured to perform the encryption calculation based on the policy attribute on the third private key to obtain a private key ciphertext;
the sending unit is further configured to send the private key ciphertext to the server, so that the server stores the private key ciphertext.
With reference to the first implementation manner of the second aspect, in a sixth implementation manner of the second aspect:
the terminal equipment further comprises a receiving unit, a display unit and a display unit, wherein the receiving unit is used for receiving an attribute set through the display touch screen, and the attribute set comprises at least one attribute; the system also comprises a formulating unit for formulating an attribute access control strategy according to the attribute set;
The obtaining unit is further configured to obtain the attribute access control policy and a first public key in the first key pair;
the encryption unit is further configured to encrypt the plaintext data using the first public key and the attribute access control policy.
In a third aspect, an embodiment of the present application provides another terminal device, including a processor, a communication interface, an input device, an output device, and a memory, where the processor, the communication interface, the input device, the output device, and the memory are connected to each other, where the memory is configured to store a computer program supporting the terminal device to execute the foregoing data sharing method, and the computer program includes program instructions, and the processor is configured to invoke the program instructions to execute the foregoing data sharing method implemented by any one of the first aspect to the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program comprising program instructions, which when executed by a processor, are configured to perform a data sharing method implemented by any one of the above-described first aspect to first aspect.
According to the method and the device, different encryption calculations are adopted for the plaintext data according to different attributes of the plaintext data, so that the plaintext data can be operated by other users and/or decrypted by trusted users after being encrypted, data access rights of different users are limited, then encrypted data obtained after the plaintext data is encrypted is sent to a server, the server stores the encrypted data, and other users can acquire the encrypted data from the server. Therefore, the method and the device effectively solve the problems of overlarge load capacity of the terminal equipment, key distribution and management burden and the like by utilizing the trusted third party, effectively limit the operation authority of other users while sharing the data to the other users, and further ensure the safety of the data in the incompletely trusted cloud environment. The present application thus provides an efficient data sharing method.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below.
FIG. 1 is a schematic flow chart of a data sharing method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of a data sharing method according to another embodiment of the present application;
FIG. 3 is a schematic diagram of an access control tree provided herein;
fig. 4 is a schematic block diagram of a terminal device provided in an embodiment of the present application;
fig. 5 is a structural block diagram of a terminal device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In particular implementations, the terminal devices described in embodiments of the present application include, but are not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers having a touch-sensitive surface (e.g., a touch screen display and/or a touch pad). It should also be appreciated that in some embodiments, the device is not a portable communication device, but rather a desktop computer having a touch-sensitive surface (e.g., a touch screen display and/or a touchpad).
In the following discussion, a terminal device including a display and a touch-sensitive surface is described. However, it should be understood that the terminal device may include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
The terminal device supports various applications, such as one or more of the following: drawing applications, presentation applications, word processing applications, website creation applications, disk burning applications, spreadsheet applications, gaming applications, telephony applications, video conferencing applications, email applications, instant messaging applications, workout support applications, photo management applications, digital camera applications, digital video camera applications, world Wide WEB (WEB) browsing applications, digital music player applications, and/or digital video player applications.
Various applications that may be executed on the terminal device may use at least one common physical user interface device such as a touch sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal device may be adjusted and/or changed between applications and/or within the corresponding applications. In this way, the common physical architecture (e.g., touch-sensitive surface) of the terminal device may support various applications with user interfaces that are intuitive and transparent to the user.
It should be further noted that the server described in the embodiments of the present application may be a conventional server, a large storage system, a desktop computer, a notebook computer, a tablet computer, a palm computer, a smart phone, a portable digital player, a smart watch, a smart bracelet, or the like, which is not limited in this application.
Referring to fig. 1, a schematic flow chart of a data sharing method according to an embodiment of the present application is provided, where the data sharing method may include:
101: plain data is obtained, and attributes of the plain data include being operable and/or decryptable.
In this embodiment of the present application, plaintext data to be encrypted is first obtained, where the plaintext data refers to characters or bit sets that are not encrypted, and specific forms include, for example, text, bit streams, bitmaps, digitized voice or digitized video images, and the content of the plaintext data can be obtained by directly reading the plaintext data without decrypting the plaintext data.
It should be noted that, the above plain text data is classified into three types according to its attribute, if the attribute of the above plain text data is operable, it means that the above plain text data can be operated by other users in an encrypted state, but cannot be decrypted by other users; if the attribute of the plaintext data is decryptable, the plaintext data can be decryptable by a trusted user after being encrypted; if the attribute of the plaintext data includes arithmetic and decryptable, it means that the plaintext data can be calculated by other users in an encrypted state and can be decrypted by trusted users.
102: and encrypting the plaintext data according to the attribute of the plaintext data to generate encrypted data which can be decrypted and operated, encrypted data which can be operated or encrypted data which can be decrypted.
In this embodiment of the present application, different encryption calculations are performed on the plaintext data according to different attributes of the plaintext data, and specifically, if the attributes of the plaintext data are the aforementioned operable, the plaintext data is fully homomorphic encrypted, so as to obtain operable encrypted data; if the attribute of the plaintext data is the decryptable one, performing encryption calculation on the plaintext data based on the policy attribute to obtain decryptable encrypted data; and if the attribute of the plaintext data comprises the arithmetic and the decryptable, sequentially performing encryption calculation based on the strategy attribute and homomorphic encryption calculation on the plaintext data to obtain decryptable and arithmetic encryption data.
More specifically, if the attribute of the plaintext data is decryptable, a first key pair is randomly generated, and the first key pair includes a first private key and a first public key; and performing encryption calculation based on strategy attributes on the plaintext data by using the first public key to generate decryptable encrypted data, wherein the strategy attributes describe decryption rules of the encrypted data and represent various attribute combinations of users who are allowed to decrypt the encrypted data. If the attribute of the plaintext data is arithmetical, randomly generating a second key pair, wherein the second key pair comprises a second private key and a second public key; and (3) performing homomorphic encryption calculation on the plaintext data by using the second public key to generate operational encrypted data. If the attribute of the plaintext data comprises arithmetic and decryptable, a first key pair and a second key pair are randomly generated, wherein the first key pair comprises a first private key and a first public key, and the second key pair comprises a second private key and a second public key; performing encryption calculation based on strategy attributes on the plaintext data by using the first public key to obtain decryptable encrypted data; and (3) performing homomorphic encryption calculation on the decryptable encrypted data by using the second public key to generate decryptable and operational encrypted data.
It should be noted that, the key pair is obtained by a key generation algorithm, where the public key and the private key in the key pair are in one-to-one correspondence. The public key and the private key are not fixed, one of the two keys is used as the private key, then the other key is the public key, only the key used as the public key can be known by other people, and the other key cannot be known by other people, and can only be known by the user. Specifically, if the data is encrypted with a public key, decryption is only possible with the corresponding private key; if the data is encrypted with a private key, then decryption is only possible with the corresponding public key. The key generation algorithm comprises a KeyGen key generation algorithm and the like.
And if the attribute of the plaintext data is the arithmetic, fully homomorphic encryption is carried out on the plaintext data. Specifically, the homomorphic encryption calculation means that important privacy information of a user is homomorphic encrypted, a secret key is only known by a data owner, and a cloud service provider and other users cannot acquire the secret key, so that the security of the data is ensured. Because of the homomorphism of the homomorphic encryption mode, other users can directly operate own business data at the cloud, and the operation result is stored at the cloud in a ciphertext mode, so that more convenient calculation is provided for the users, the data can be processed by other users under the condition that the data is not decrypted, and the result of processing the data in the encrypted state is consistent with the result of processing the data in the unencrypted state. Thus, the user does not need to distribute keys to other users, but can also process data by other users, and the processing process does not reveal any plaintext content. And the result of decompression after the processing is also indistinguishable from the result of the processing after decompression.
For example, the ciphertext 1 is fully homomorphic encrypted to obtain the ciphertext 2, that is, other users may perform data processing on the ciphertext 2 without decrypting the ciphertext 2, where the result obtained by the processing is the same as the result of the data processing performed by other users after the ciphertext 2 is decompressed.
Further for example, existing plaintext dataPlaintext data->Fully homomorphic encryption algorithm>Then respectively->And->Performing isomorphic encryption computation->And->Obtaining encrypted data->And encryption data->In addition to this, encryption data can be +.>And encryption data->By decryption function->To perform decryption calculation to retrieve plaintext data +.>And plaintext data->. If encryption data is->And encryption data->Carry out the operation->Then get encrypted data->Then add to the encrypted data->Decryption will be given +.>It can be seen that the processing of the plaintext data after the full homomorphic encryption calculation is the same as the processing of the plaintext data directly, but if the plaintext data is subjected to the encryption calculation of the non-homomorphic encryption algorithm and the non-homomorphic encryption algorithm, the result of decrypting the encrypted data after the operation is generally a meaningless hash. Therefore, the full homomorphic encryption calculation is carried out on the plaintext data, the separation of the data processing right and the data ownership can be realized, the data leakage can be prevented, the processing of the data by the non-trusted user is allowed, and the calculation capability of the terminal equipment is improved by utilizing the cloud service.
It should be noted that if the homomorphic algorithm is fullFoot supportThe homomorphism algorithm satisfies the addition homomorphism; if the homomorphic algorithm satisfies +.>The homomorphism algorithm satisfies the multiplication homomorphism. Therefore, if the homomorphism algorithm only meets the addition homomorphism, only the addition and subtraction operation can be performed; if the homomorphic algorithm only meets the multiplication homomorphism, only multiplication and division operation can be performed; the homomorphic algorithm is called isomorphic encryption if it satisfies both the addition homomorphic and the multiplication homomorphic. Encrypting data using an isomorphic algorithm may allow any number of operations (e.g., addition, subtraction, multiplication, division, polynomial evaluation, exponentiation, logarithm, trigonometric functions, etc.) to be performed after the data is encrypted. Among them, the addition homography such as the addition homography Paillier algorithm, the multiplication homography such as the multiplication homography (RSA) algorithm, the Rivest-Shamir-Adleman algorithm, and the isotactic algorithm such as the isotactic Gentry algorithm.
It should be noted that the fully homomorphic encryption algorithm further includes a key generation algorithm, an encryption algorithm, a decryption algorithm and a ciphertext calculation algorithm, where the key generation algorithm is used to generate a public key required in the encryption process, and a private key required in the decryption process, and even a ciphertext calculation public key, and the key generation algorithm includes, for example, a KeyGen algorithm and the like; the encryption algorithm is used for encrypting the plaintext data to obtain encrypted data, and the encryption algorithm is, for example, an Enc algorithm; the decryption algorithm is used for decrypting the encrypted data to obtain plaintext data, and the decrypted data is, for example, dec algorithm; the ciphertext calculation algorithm refers to an algorithm that other users can utilize the ciphertext calculation formula to calculate the encrypted data, for example, an evaluation algorithm is used for the ciphertext calculation algorithm, and other users can calculate any function of the encrypted data through the evaluation algorithm, but at the same time, the data cannot be revealed.
And if the attribute of the plaintext data is the decryptable one, performing encryption calculation based on the policy attribute on the plaintext data. Specifically, the encryption calculation value based on the policy attribute is to encrypt the plaintext data by adopting a policy attribute-based encryption technology, the policy attribute-based encryption technology is a cloud storage sharing scheme based on a trusted third party ciphertext policy attribute encryption technology, plaintext data adopting the encryption technology can only be accessed by trusted users, and owners of the plaintext data do not need to perform operations such as key distribution and the like on the trusted users, and only need to formulate an access control policy tree for the trusted users to standardize access rights. And then, when a user requests to access the encrypted data, attribute information of the user is subjected to attribute matching, and only the user with the attribute information meeting the access control tree can use a key to carry out decryption operation, so that encrypted plaintext can be shared with trusted users, thus not all users can decrypt the encrypted plaintext data, and only trusted users can decrypt the encrypted plaintext data, thereby realizing the effective access control function.
It should be further noted that, the foregoing matching the attribute of the user refers to obtaining an access control tree based on an access policy of the encrypted data, then matching the attribute of the user with the attribute of the leaf node, if the matching is successful, the user may obtain the secret value of the leaf node, then deducing the secret value of the non-leaf node by using the secret value of the leaf node until the secret value of the root node is solved, and then decrypting the encrypted data by using the secret value of the root node, so that the user having the attribute of the leaf node satisfying the preset number can decrypt the encrypted data. Wherein the access control tree is used to hide the encryption key.
For example, as shown in fig. 3, the access policy is obtained before the access control tree is built, that is, the owner setting portion of the plaintext data may obtain the attributes of the trusted user of the plaintext data, for example, attribute 1, attribute 2, attribute 3, attribute 4, attribute 5 and attribute 6, where the access policy is at least attribute satisfying ("attribute 1", "attribute 2", "attribute 3" and "attribute 4"), or ("attribute 4" and "attribute 5"), or ("attribute 1", "attribute 2", "attribute 3" and "attribute 5") ("attribute 1", "attribute 2", "attribute 3" and "attribute 6") and in addition, other users do not have access rights, so that the access control tree is built according to the above access policy, as shown in fig. 3, 6 leaf nodes respectively indicate 6 attributes, and a non-leaf node indicates that the data visitor needs to satisfy several child nodes below the non-leaf node to be considered to have access, for example, 2/3 non-leaf nodes below the non-leaf node indicate that the non-leaf node needs to satisfy at least the access rights of leaf node to be considered to have access rights of the leaf node. The data visitor can then decrypt the node secret value only if the minimum number of attributes to be satisfied, represented by the threshold, is satisfied.
After the access control tree is constructed, a secret value is assigned to each node in the access control tree. Firstly, a secret value is given to the root node, then a polynomial is randomly generated according to the threshold value of the root node, such as an access control tree shown in fig. 3, the threshold value of the root node is 2/3, then a polynomial is randomly generated, the highest degree of the polynomial is 2 minus 1 in the threshold value of the root node, so that the highest degree of the root node is 1, such asWherein the constant term 5 is the secret value of the root node, which is the number that needs to be kept secret. In addition, the child nodes of the root node are marked as 1, 2 and 3 in order from left to right, so that 1, 2 and 3 are respectively brought into the polynomial +.>The resulting values are the secret values of the three children of the root node, respectively, e.g. so that the first left child node "3/3" of the root node is marked 1, the secret value passed to the "3/3" node is +.>The node of the middle "attribute 4" is marked 2, so that the secret value that the root node gives to the node of "attribute 4" is +.>Then the leftmost child node "1/2" of the child nodes of the root node is marked 3, and the secret value transmitted to the "1/2" node by the root node is +. >. Similarly, after the "3/3" node and the "1/2" node receive the value transmitted from the parent node, a random polynomial is generated in the above manner, the constant term is set to the value transmitted from the parent node, and in addition, a new secret value is generated in the above manner and transmitted to the child node. For a leaf node, after receiving the secret value of the parent node, the attribute of the leaf node is used for encrypting the secret value, so that matching the attribute of the user with the attribute of the leaf node means that the encrypted data of the secret value is decrypted by utilizing the attribute of the user, and if the attribute of the user is consistent with the attribute of the leaf node, the user can successfully decrypt the encrypted data of the secret value of the leaf node, thereby obtaining the secret value of the leaf node.
At decryption time, the user decrypts the secret value of the leaf node of the access control tree by using its own attribute, and then will solve the secret value of the parent node according to the secret value of the leaf node, for example, if the secret values of attribute 1, attribute 2 and attribute 3 are 19, 44 and 83 respectively, there are three points for the polynomial that illustrates the parent node to use to pass the secret value,、/>andthe constant term of the polynomial is the secret value of the parent node, so that the constant term of the polynomial can be obtained according to the three points, namely the secret value of the parent node is solved, and the secret value of the non-leaf node of the whole access control tree is solved according to the method.
And if the attribute of the plaintext data comprises the arithmetic and the decryptable, performing encryption calculation based on the strategy attribute and full homomorphic encryption calculation on the plaintext data successively. Specifically, the performing the encryption calculation based on the policy attribute and the homomorphic encryption calculation on the plaintext data sequentially refers to performing the encryption calculation based on the policy attribute on the plaintext data to obtain first encrypted data, and then performing the homomorphic encryption calculation on the first encrypted data to obtain second encrypted data, so that the second encrypted data is the encrypted data, thereby completing the whole encryption process of the plaintext data. By sequentially carrying out encryption calculation based on strategy attributes and homomorphic encryption calculation on plaintext data, the realization that any user can carry out operation processing on the encrypted data and simultaneously can allow the user with the attribute conforming to the access strategy to decrypt the encrypted data by using a key is realized.
Further, the above encryption calculation based on the policy attribute is specific to the plaintext data: receiving an attribute set through a display touch screen, wherein the attribute set comprises at least one attribute; formulating an attribute access control strategy according to the attribute set; acquiring an attribute access control strategy and a first public key in a first key pair; and encrypting the plaintext data by using the first public key and the attribute access control policy.
In the embodiment of the application, a display device is firstly used for receiving a plurality of attributes selected by a user, the attributes are associated to form an attribute set, the access control strategy is constructed according to the attribute set, then when encryption calculation based on strategy attributes is carried out on the plaintext data, a first public key and the attribute access control strategy are firstly obtained, and then the plaintext data is encrypted by utilizing the first public key and the attribute access strategy.
For example, the above-described construction of the access control policy is based on an attribute set including 6 elements, i.e., attribute 1, attribute 2, attribute 3, attribute 4, attribute 5, and attribute 6, and an attribute set including ("attribute 1", "attribute 2", "attribute 3", and "attribute 4"), ("attribute 4", and "attribute 5"), ("attribute 4", and "attribute 6"), ("attribute 1", "attribute 2", "attribute 3", and "attribute 5"), and ("attribute 1", "attribute 2", "attribute 3", and "attribute 6"), and then the access control policy as shown in fig. 3 can be constructed based on the attribute set.
It should be noted that, the first public key is randomly generated by the system of the terminal device, and the attribute access policy is an access control tree, for example, 6 leaf nodes of the access control tree shown in fig. 3 respectively represent attribute 1, attribute 2, attribute 3, attribute 4, attribute 5 and attribute 6, and as shown in fig. 3, 6 leaf nodes respectively represent 6 attributes, and a non-leaf node represents that a data visitor needs to satisfy several child nodes below the non-leaf node to be considered to have access rights, for example, threshold 2/3 of the non-leaf node represents that there are 3 leaf nodes below the non-leaf node, where the data visitor needs to satisfy at least 2 attributes of the non-leaf node to be considered to have access rights. The data visitor can then decrypt the node secret value only if the minimum number of attributes to be satisfied, represented by the threshold, is satisfied. As shown in fig. 3, the access policy is that the user whose attribute at least satisfies ("attribute 1", "attribute 2", "attribute 3" and "attribute 4"), or ("attribute 4" and "attribute 5"), or ("attribute 4" and "attribute 6"), or ("attribute 1", "attribute 2", "attribute 3" and "attribute 5") ("attribute 1", "attribute 2", "attribute 3" and "attribute 6") is a trusted user, and other users have no access right.
It should be noted that, the above process is also applied to the encryption process of plaintext data with the attribute of decryptable and operational, and specifically, when performing encryption calculation based on policy attribute on plaintext data with the attribute of decryptable and operational, the above receiving of the attribute set by the display touch screen is also performed; formulating an attribute access control strategy according to the attribute set; acquiring an attribute access control strategy and a first public key in a first key pair; and encrypting the plaintext data by using the first public key and the attribute access control policy. The above-mentioned process of performing encryption calculation based on policy attributes on plaintext data whose attributes are decryptable and operational is not described in detail herein.
Further, before the attribute set is received through the display touch screen, at least one attribute is displayed on the display touch screen in a visual graph mode; determining at least one attribute selected by the selected operation under the condition that the selected operation on the display touch screen is received; the at least one attribute is associated together to form the set of attributes, and the operation of receiving the set of attributes via the display touch screen is completed.
In the embodiment of the application, the terminal device displays a plurality of attributes available for viewing and selection by a user on a display screen, and then the user can select an attribute set for performing plain text data through clicking, pressing and/or sliding and other selected operations, wherein the attribute set comprises at least one attribute of the user allowing decryption of encrypted data.
It can be seen that the data owner can modify and select the attribute set, so that a user capable of decrypting the encrypted data is selected, the control granularity of the data can be greatly increased through the embodiment of the application, the user capable of decrypting the encrypted data is effectively controlled and screened, and the efficiency and the practicability of the data sharing method of the embodiment of the application are further improved.
103: and transmitting the encrypted data to a server so that the server stores the encrypted data.
In this embodiment of the present application, after encrypting the plaintext data, the terminal device sends the plaintext data to the server, so that the server stores the encrypted data, and then other users may directly obtain the encrypted data on the server, without directly asking for the owner of the data.
Further, if the attribute of the plaintext data is decryptable, performing encryption calculation on the plaintext data based on a policy attribute, and obtaining the first private key after obtaining decryptable encrypted data; performing encryption calculation based on strategy attributes on the first private key to obtain a private key ciphertext; and sending the private key ciphertext to the server so that the server stores the private key ciphertext.
In the embodiment of the present application, if the attribute of the plaintext data is decryptable, it is indicated that the encrypted data obtained after the plaintext data is subjected to the encryption calculation based on the policy attribute may be decrypted by the trusted user using the key. If the user wants to successfully decrypt the encrypted data, the user needs to use the key at the same time as the user needs to meet the attribute policy of the encrypted data. And then when the attribute of the plaintext data is decryptable, the terminal equipment acquires a private key of the encrypted data, performs encryption calculation based on strategy attribute on the private key, and then sends a private key ciphertext obtained after encrypting the private key to the server to be stored instead of the server. When decrypting the encrypted data, other users firstly acquire a private key ciphertext, then decrypt the private key ciphertext to obtain a private key of the encrypted data, and finally decrypt the encrypted data by using the private key.
Therefore, the embodiment of the application performs encryption calculation based on the policy attribute on the private key of the encrypted data, so that the decryption difficulty of the encrypted data is increased, the private key for decrypting the encrypted data is encrypted besides being encrypted, double insurance is added to the data of the user, the private key of the encrypted data can only be decrypted by the first trusted user, and the encrypted data can only be decrypted by the second trusted user, wherein the first trusted user comprises the second trusted user, and the number of the first trusted users is greater than or equal to that of the second trusted user, therefore, in the embodiment of the application, the access control tree of the encrypted data can be simplified, a part of the attribute of the user allowed to access the encrypted data is described in the access control tree of the ciphertext of the private key, for example, the ciphertext private key can only be accessed by students, and the encrypted data can only be accessed by students. Therefore, compared with the construction of an access control tree containing two attributes of 'lady' and 'student', the construction of two access control trees containing 'lady' and 'student' respectively is simpler, and particularly when the attributes of the access control tree are very complex, the method described by the embodiment of the application is used, so that the complexity of the access control tree can be greatly reduced, and the encryption and decryption speed of data can be greatly improved.
After the encrypted data and the secret key ciphertext of the encrypted data are sent to the server, the encrypted data and the secret key ciphertext of the encrypted data are associated, so that the server can acquire the secret key ciphertext of the encrypted data in the server according to the encrypted data after acquiring the encrypted data.
Further, if the attribute of the plaintext data is decryptable and operational, performing encryption calculation based on the policy attribute on the plaintext data, then performing homomorphic encryption calculation to obtain decryptable and operational encrypted data, and then obtaining a first private key and a second private key; combining the first private key and the second private key to obtain a third private key; performing encryption calculation based on strategy attributes on the third private key to obtain a private key ciphertext; and sending the private key ciphertext to the server so that the server can store the private key ciphertext.
In this embodiment of the present application, if the attribute of the plaintext data is decryptable and operable, as long as the plaintext data includes decryptable, it is indicated that the encrypted data obtained after the plaintext data is sequentially subjected to the encryption calculation based on the policy attribute and the homomorphic encryption calculation may be decrypted by the trusted user using the key. If the user wants to successfully decrypt the encrypted data, the user needs to have a second private key to unlock the first layer of the decryptable and operational encrypted data so as to obtain the decryptable encrypted data, and on the other hand, the user also needs to use the first key simultaneously besides meeting the attribute policy of the decryptable encrypted data. And then, when the attribute of the plaintext data is decryptable and arithmetic, acquiring a first private key and a second private key of the decryptable and arithmetic encryption data, and combining the first private key and the second private key together to acquire a third private key. When decrypting the encrypted data, other users firstly acquire a secret key ciphertext, then decrypt the secret key ciphertext to obtain a third secret key of the decrypted and operated encrypted data, then split the third secret key according to a combination rule of the first secret key and the second secret key, reversely push to obtain the first secret key and the second secret key, finally sequentially decrypt the decrypted and operated encrypted data by using the second secret key and the first secret key to obtain plaintext data, wherein the combination rule of the first secret key and the second secret key is sequentially combined or crossed, the sequential combination refers to that the head or the tail of the first secret key is connected with the tail or the head of the second secret key to form a series of sequences, and the crossed combination refers to that the first secret key and the second secret key are crossed and combined together according to a preset bit sequence, for example, the first secret key is divided into a first part and a first second part, the second secret key is divided into a second part and a second part, and then the first part and the second part are sequentially combined according to the first part, the second part and the second part.
It should be noted that, if the attribute of the plaintext data includes decryptable data, after performing encryption calculation on the plaintext data based on a policy attribute to obtain first encrypted data, the private key obtained by the terminal device is a first private key for decrypting the first encrypted data; if the attribute of the plaintext data includes arithmetic in addition to decrypting, then fully homomorphic encryption calculation is performed on the first encrypted data to obtain second encrypted data, and then the terminal equipment obtains a private key including a first private key for decrypting the first encrypted data and a second private key for decrypting the second encrypted data.
According to the embodiment of the invention, different encryption calculations are adopted for the plaintext data according to different attributes of the plaintext data, so that the plaintext data can be operated and/or decrypted by other users after being encrypted, and therefore, the data access rights of different users are limited, specifically, if the attributes of the plaintext data are the operated, the plaintext data is fully homomorphic encrypted, so that other users can operate and process the encrypted data but cannot decrypt the encrypted data, wherein the operation processing of the encrypted data by other users means that the other users can perform specific algebraic operation, retrieval, comparison and other operations on the encrypted data when the encrypted data is not decrypted, and the processed result of the encrypted data in the encrypted state is consistent with the processed result after the encrypted data is decrypted; if the attribute of the plaintext data is the decryptable one, performing encryption calculation on the plaintext data based on the policy attribute, so that a user with the attribute conforming to the access policy uses a key to decrypt the encrypted data; if the attribute of the plaintext data comprises the arithmetic and the decryptable, the encryption calculation based on the strategy attribute and the homomorphic encryption calculation are sequentially carried out on the plaintext data, so that other users can carry out arithmetic processing on the encrypted data and simultaneously can allow the users with the attribute conforming to the access strategy to decrypt the encrypted data by using the key. Therefore, the data access rights of different users can be limited, and then the terminal equipment sends the encrypted data obtained after encrypting the plaintext data to the server, so that the server stores the encrypted data, and other users can acquire the encrypted data from the server. Therefore, the method and the device effectively solve the problems of overlarge load capacity of the terminal equipment, key distribution and management burden and the like by utilizing the trusted third party, effectively limit the operation authority of other users while sharing the data to the other users, and further ensure the safety of the data in the incompletely trusted cloud environment. The present application thus provides an efficient data sharing method.
Referring to fig. 2, another embodiment of the present application provides a schematic flowchart of a data sharing method, where the data sharing method may include:
201: plain data is obtained, and attributes of the plain data include being operable and/or decryptable.
202: if the attribute of the plaintext data is decryptable, a first key pair is randomly generated, and the first key pair comprises a first private key and a first public key.
In the embodiment of the present invention, if the attribute of the plaintext data is decryptable, the system randomly generates a first key pair, where the first key pair includes a first private key and a first public key.
It should be noted that, the key pair is obtained by a key generation algorithm, where the public key and the private key in the key pair are in one-to-one correspondence. The public key and the private key are not fixed, one of the two keys is used as the private key, then the other key is the public key, only the key used as the public key can be known by other people, and the other key cannot be known by other people, and can only be known by the user. Specifically, if the data is encrypted with a public key, decryption is only possible with the corresponding private key; if the data is encrypted with a private key, then decryption is only possible with the corresponding public key. The key generation algorithm comprises a KeyGen key generation algorithm and the like.
203: the method includes receiving, by a display touch screen, a set of attributes, the set of attributes including at least one attribute.
In the embodiment of the invention, under the condition that a selected operation on a display touch screen is received, at least one attribute selected by the selected operation is determined; the at least one attribute is associated together to form the set of attributes, and the operation of receiving the set of attributes via the display touch screen is completed.
Further, at least one attribute is displayed in a visual graphical manner on the display touch screen before the set of attributes is received via the display touch screen.
In the embodiment of the application, the terminal device displays a plurality of attributes available for viewing and selection by a user on a display screen, and then the user can select an attribute set for performing plain text data through clicking, pressing and/or sliding and other selected operations, wherein the attribute set comprises at least one attribute of the user allowing decryption of encrypted data.
It can be seen that the data owner can modify and select the attribute set, so that a user capable of decrypting the encrypted data is selected, the control granularity of the data can be greatly increased through the embodiment of the application, the user capable of decrypting the encrypted data is effectively controlled and screened, and the efficiency and the practicability of the data sharing method of the embodiment of the application are further improved.
204: and formulating an attribute access control strategy according to the attribute set.
In the embodiment of the present invention, since the attribute set includes a plurality of attributes, which are attributes of users allowed to decrypt encrypted data, an attribute access control policy is executed on the basis of the attribute set, and the attribute access control policy includes an attribute combination of different users capable of decrypting encrypted data.
For example, the above-described construction of the access control policy is based on an attribute set including 6 elements, i.e., attribute 1, attribute 2, attribute 3, attribute 4, attribute 5, and attribute 6, and an attribute set including ("attribute 1", "attribute 2", "attribute 3", and "attribute 4"), ("attribute 4", and "attribute 5"), ("attribute 4", and "attribute 6"), ("attribute 1", "attribute 2", "attribute 3", and "attribute 5"), and ("attribute 1", "attribute 2", "attribute 3", and "attribute 6"), and then the access control policy as shown in fig. 3 can be constructed based on the attribute set.
205: and acquiring the attribute access control policy and the first public key in the first key pair.
206: and encrypting the plaintext data by using the first public key and the attribute access control policy to generate decryptable encrypted data.
In the embodiment of the invention, the plaintext data is encrypted by using the first public key and the attribute access control policy, so as to generate decryptable encrypted data.
For example, 6 leaf nodes of the access control tree as shown in fig. 3 represent attribute 1, attribute 2, attribute 3, attribute 4, attribute 5 and attribute 6, respectively, and 6 leaf nodes represent 6 attributes, respectively, as shown in fig. 3, a non-leaf node represents that a data visitor needs to satisfy several child nodes under the non-leaf node to be considered to have access rights, for example, threshold 2/3 of the non-leaf node represents that there are 3 leaf nodes under the non-leaf node, wherein the data visitor needs to satisfy at least 2 attributes of the non-leaf node to be considered to have access rights. The data visitor can then decrypt the node secret value only if the minimum number of attributes to be satisfied, represented by the threshold, is satisfied. As shown in fig. 3, the access policy is that the user whose attribute at least satisfies ("attribute 1", "attribute 2", "attribute 3" and "attribute 4"), or ("attribute 4" and "attribute 5"), or ("attribute 4" and "attribute 6"), or ("attribute 1", "attribute 2", "attribute 3" and "attribute 5") ("attribute 1", "attribute 2", "attribute 3" and "attribute 6") is a trusted user, and other users have no access right.
207: and obtaining the first private key, and performing encryption calculation on the first private key based on the strategy attribute to obtain a private key ciphertext.
In the embodiment of the invention, besides the encryption algorithm based on the strategy attribute is performed on the plaintext data to obtain the encrypted data, the first private key for decrypting the encrypted data is encrypted based on the strategy attribute, and then the encrypted private key ciphertext is obtained.
208: and sending the decryptable encrypted data and the private key ciphertext to a server so that the server can store the decryptable encrypted data and the private key ciphertext.
In the embodiment of the application, the terminal device sends the encrypted data and the secret key ciphertext to the server, so that the server stores the encrypted data and the secret key ciphertext, other users can directly obtain the encrypted data and the secret key ciphertext of the encrypted data from the server, and after decrypting the secret key ciphertext to obtain a secret key, the secret key is used for decrypting the encrypted data.
After the encrypted data and the secret key ciphertext of the encrypted data are sent to the server, the encrypted data and the secret key ciphertext of the encrypted data are associated, so that the server can acquire the secret key ciphertext of the encrypted data in the server according to the encrypted data after acquiring the encrypted data.
It should be further noted that, if the attribute of the plaintext data includes decryptable data, after performing encryption calculation on the plaintext data based on a policy attribute to obtain first encrypted data, the private key obtained by the terminal device is a first private key for decrypting the first encrypted data; if the attribute of the plaintext data includes arithmetic in addition to decrypting, then fully homomorphic encryption calculation is performed on the first encrypted data to obtain second encrypted data, and then the terminal equipment obtains a private key including a first private key for decrypting the first encrypted data and a second private key for decrypting the second encrypted data.
According to the embodiment of the application, the encryption calculation based on the strategy attribute is carried out on the private key of the encrypted data, so that the decryption difficulty of the encrypted data is increased, the private key for decrypting the encrypted data is encrypted except that the encrypted data is encrypted, and the method is equivalent to double insurance of data security. Since both the encrypted data and the private key of the encrypted data adopt the encryption calculation based on the policy attribute, the private key of the encrypted data can only be decrypted by the first trusted user, and the encrypted data can only be decrypted by the second trusted user, wherein the first trusted user comprises the second trusted user, and the number of the first trusted users is greater than or equal to that of the second trusted user, in the embodiment of the present application, the access control tree adopted in the encryption calculation based on the policy attribute on the encrypted data can be simplified, and a part of the attribute of the user allowed to access the encrypted data is described in the access control tree adopted in the encryption calculation based on the policy attribute on the private key ciphertext, for example, the ciphertext private key can only be accessed by women, and the encrypted data can only be accessed by students. Therefore, compared with the construction of an access control tree containing two attributes of 'lady' and 'student', the construction of two access control trees containing 'lady' and 'student' respectively is simpler, and particularly when the attributes of the access control tree are very complex, the method described by the embodiment of the application is used, so that the complexity of the access control tree can be greatly reduced, the data encryption and decryption speed can be greatly increased, and the data security and sharing efficiency in third party equipment are further improved.
It should be noted that, the foregoing descriptions of the various embodiments are intended to emphasize the differences between the various embodiments, and the same or similar features thereof may be referred to each other for brevity and will not be repeated herein.
The embodiment of the application also provides a terminal device, which is used for executing the unit of the data sharing method of any one of the above. Specifically, referring to fig. 4, a schematic block diagram of a terminal device is provided in an embodiment of the present application. The terminal device of the present embodiment includes: an acquisition unit 410, an encryption unit 420, and a transmission unit 430.
An obtaining unit 410, configured to obtain plaintext data, where an attribute of the plaintext data includes arithmetic and/or decryptable; an encryption unit 420, configured to encrypt plaintext data according to an attribute of the plaintext data, and generate encrypted data that can be decrypted and operated, encrypted data that can be operated, or encrypted data that can be decrypted; and a transmitting unit 430 for transmitting the encrypted data to the server so that the server holds the encrypted data.
Further, the terminal device further includes a generating unit 440, configured to randomly generate a first key pair if the attribute of the plaintext data is decryptable, where the first key pair includes a first private key and a first public key; the encryption unit 420 is specifically configured to perform encryption calculation on plaintext data based on a policy attribute by using a first public key, and generate decrypted encrypted data, where the policy attribute describes a decryption rule of the encrypted data.
Further, the terminal device further includes a generating unit 440, configured to randomly generate a second key pair if the attribute of the plaintext data is operable, where the second key pair includes a second private key and a second public key; the encryption unit 420 is specifically configured to fully homomorphic encrypt the plaintext data using a second public key, and generate operational encrypted data.
Further, the terminal device further includes a generating unit 440, if the attribute of the plaintext data includes an operable and decryptable property, then a first key pair and a second key pair are randomly generated, where the first key pair includes a first private key and a first public key, and the second key pair includes a second private key and a second public key; the encryption unit 420 is specifically configured to perform encryption calculation based on a policy attribute on the plaintext data by using a first public key, so as to obtain decrypted encrypted data; and performing homomorphic encryption calculation on the encryptable encrypted data by using the second public key to generate decryptable and operational encrypted data.
Further, the obtaining unit 410 is further configured to obtain a first private key; the encryption unit 420 is further configured to perform encryption calculation based on a policy attribute on the first private key to obtain a private key ciphertext; the sending unit 430 is further configured to send the secret key ciphertext to the server, so that the server stores the secret key ciphertext.
Further, the acquiring unit 410 is configured to acquire a first private key and a second private key; the terminal device further includes a combining unit 450, configured to combine the first private key and the second private key to obtain a third private key; the encryption unit 420 is further configured to perform encryption calculation based on a policy attribute on the third private key to obtain a private key ciphertext; the sending unit 430 is further configured to send the secret key ciphertext to the server, so that the server stores the secret key ciphertext.
Further, the terminal device further includes a receiving unit 460, configured to receive, through the display touch screen, a set of attributes, where the set of attributes includes at least one attribute; a formulation unit 470 for formulating an attribute access control policy according to the attribute set; the obtaining unit 410 is further configured to obtain a first public key in the attribute access control policy and the first key pair; the encryption unit 420 is further configured to encrypt plaintext data using a first public key and an attribute access control policy.
According to the embodiment of the application, whether the plaintext data is allowed to be operated by other terminal equipment and/or whether the plaintext data is allowed to be decrypted by other terminal equipment is determined according to the attribute of the plaintext data, then the encryption unit encrypts the plaintext data with different attributes by adopting different encryption methods, and the sending unit sends the encrypted data obtained by encrypting the plaintext data to a server of a third party so as to enable the server of the third party to store the encrypted data, so that other terminal equipment can acquire the encrypted data from the server of the third party, and then operate or decrypt different encrypted data and the like. Therefore, the method and the device effectively solve the problems of overlarge load capacity of the terminal equipment, key distribution and management burden and the like by using the trusted third party, effectively limit the operation authority of other users while sharing the data to the other users, and ensure the safety of the data in an incompletely trusted cloud environment. The present application thus provides an efficient data sharing method.
Referring to fig. 5, a schematic block diagram of a terminal device according to another embodiment of the present application is provided. The terminal device in this embodiment as shown in the figure may include: one or more processors 510, a communication interface 520, an input device 530, an output device 540, and a memory 550. The processor 510, communication interface 520, and memory 550 are coupled by bus 560. The communication interface 520 is used for data interaction between the terminal device and other terminal devices, the memory 550 is used for storing a computer program, the computer program comprises program instructions, and the processor 510 is used for executing the program instructions stored in the memory 550.
A processor 510 for performing the functions of the acquisition unit 410 for acquiring plaintext data, the properties of which include arithmetic and/or decryptable; and also functions of the encryption unit 420 for encrypting the plaintext data according to the attribute of the plaintext data, generating decryptable and operational encrypted data, or decryptable encrypted data.
A communication interface 520 for performing the function of the transmitting unit 430 for transmitting the encrypted data to the server so that the server holds the encrypted data.
Further, the processor 510 is further configured to perform a function of the generating unit 440, for randomly generating a first key pair if the attribute of the plaintext data is decryptable, where the first key pair includes a first private key and a first public key; the method is also specifically used for carrying out encryption calculation on the plaintext data by utilizing the first public key based on the strategy attribute, generating decryptable encrypted data, and the strategy attribute describes the decryption rule of the encrypted data.
Further, the processor 510 is further configured to perform a function of the generating unit 440, for randomly generating a second key pair if the attribute of the plaintext data is operable, where the second key pair includes a second private key and a second public key; the method is also specifically used for fully homomorphic encryption of the plaintext data by using the second public key to generate the operable encrypted data.
Further, the processor 510 is further configured to perform a function of the generating unit 440, and if the attribute of the plaintext data includes arithmetic and decrypting, then randomly generate a first key pair and a second key pair, where the first key pair includes a first private key and a first public key, and the second key pair includes a second private key and a second public key; the method is also specifically used for carrying out encryption calculation based on strategy attributes on the plaintext data by utilizing the first public key to obtain decryptable encrypted data; and performing homomorphic encryption calculation on the encryptable encrypted data by using the second public key to generate decryptable and operational encrypted data.
Further, the processor 510 is further configured to obtain a first private key; the method is also used for carrying out encryption calculation based on strategy attributes on the first private key to obtain a private key ciphertext;
correspondingly, the communication interface 520 is further configured to send the secret key ciphertext to the server, so that the server stores the secret key ciphertext.
Further, the processor 510 is further configured to obtain a first private key and a second private key; and is further configured to perform a function of the combining unit 450, and combine the first private key and the second private key to obtain a third private key; and the method is also used for carrying out encryption calculation based on the strategy attribute on the third private key to obtain a private key ciphertext.
Correspondingly, the communication interface 520 is further configured to send the secret key ciphertext to the server, so that the server stores the secret key ciphertext.
Further, the terminal device further includes an input device 530 for performing a function of the receiving unit 460 for receiving a set of attributes through the display touch screen, the set of attributes including at least one attribute.
Accordingly, the processor 510 is further configured to perform the function of the formulating unit 470 for formulating an attribute access control policy according to the attribute set; the first public key is also used for acquiring an attribute access control strategy and a first key pair; and is further configured to encrypt the plaintext data using the first public key and the attribute access control policy.
It should be appreciated that in embodiments of the present application, the processor 510 may be a central processing unit (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 550 may include read only memory and random access memory, and provides instructions and data to the processor 510. A portion of memory 550 may also include non-volatile random access memory. For example, the memory 550 may also store information of device type.
In a specific implementation, the processor 510 and the communication interface 520 described in the embodiments of the present application may perform the implementation manners described in the first embodiment and the second embodiment of the data sharing method provided in the embodiments of the present application, and may also perform the implementation manner of the terminal device described in the embodiments of the present application, which is not described herein again.
In another embodiment of the present application, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program comprising program instructions for execution by a processor.
The computer readable storage medium may be an internal storage unit of the terminal device of any of the foregoing embodiments, for example, a hard disk or a memory of the terminal device. The computer readable storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device. Further, the computer-readable storage medium may also include both an internal storage unit of the terminal device and an external storage device. The computer-readable storage medium is used to store a computer program and other programs and data required for the terminal device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. The skilled person may use different data sharing methods for each specific application to achieve the described functionality, but such implementation should not be considered beyond the scope of the present application.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the terminal device and unit described above may refer to the corresponding process in the foregoing embodiment of the data sharing method, which is not described herein again.
In several embodiments provided in the present application, it should be understood that the disclosed terminal device and data sharing method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of elements is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices, or elements, or may be an electrical, mechanical, or other form of connection.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purposes of the embodiments of the present application.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the data sharing method of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (7)

1. A data sharing method, comprising:
acquiring plaintext data, wherein the attribute of the plaintext data comprises arithmetic and decryptable;
encrypting the plaintext data according to the attribute of the plaintext data to generate decryptable and operational encrypted data, operational encrypted data or decryptable encrypted data, comprising: if the attribute of the plaintext data comprises the arithmetic and the decryptable, randomly generating a first key pair and a second key pair, wherein the first key pair comprises a first private key and a first public key, and the second key pair comprises a second private key and a second public key; performing encryption calculation based on strategy attributes on the plaintext data by using the first public key to obtain the decryptable encrypted data; performing homomorphic encryption calculation on the decryptable encrypted data by using the second public key to generate decryptable and operational encrypted data,
wherein performing encryption calculation based on policy attributes on the plaintext data by using the first public key comprises: displaying at least one attribute on the display touch screen in a visual graphical manner; determining at least one attribute selected by the selected operation under the condition that the selected operation on the display touch screen is received; associating the at least one attribute together to form an attribute set, receiving the attribute set by displaying the touch screen, the attribute set containing at least one attribute of the user that allows decryption of the encrypted data; formulating an attribute access control strategy according to the attribute set; acquiring an attribute access control strategy and a first public key in a first key pair; encrypting the plaintext data by using the first public key and the attribute access control policy;
Sending the encrypted data to a server so that the server stores the encrypted data;
acquiring the first private key and the second private key;
combining the first private key and the second private key to obtain a third private key;
performing encryption calculation based on the strategy attribute on the third private key to obtain a private key ciphertext;
and sending the private key ciphertext to the server so that the server stores the private key ciphertext.
2. The data sharing method according to claim 1, wherein encrypting the plaintext data according to the attribute of the plaintext data, generates decryptable encrypted data, comprises:
if the attribute of the plaintext data is the decryptable, randomly generating a first key pair, wherein the first key pair comprises a first private key and a first public key;
and carrying out encryption calculation on the plaintext data by utilizing the first public key based on a strategy attribute, and generating the decryptable encrypted data, wherein the strategy attribute describes a decryption rule of the encrypted data.
3. The data sharing method according to claim 1, wherein encrypting the plaintext data according to the attribute of the plaintext data, generates the operable encrypted data, comprises:
If the attribute of the plaintext data is the arithmetic, randomly generating a second key pair, wherein the second key pair comprises a second private key and a second public key;
and carrying out homomorphic encryption calculation on the plaintext data by using the second public key to generate the operable encrypted data.
4. The data sharing method according to claim 2, wherein after the generating the decryptable encrypted data, further comprising:
acquiring the first private key;
performing encryption calculation based on the strategy attribute on the first private key to obtain a private key ciphertext;
and sending the private key ciphertext to the server so that the server stores the private key ciphertext.
5. A terminal device comprising means for performing the method of any of claims 1-4, the terminal device comprising an acquisition unit, an encryption unit, a transmission unit and a generation unit.
6. A terminal device comprising a processor, a communication interface, an input device, an output device and a memory, the processor, the communication interface, the input device, the output device and the memory being interconnected, wherein the communication interface is for data interaction with other terminal devices, the memory is for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions for performing the data sharing method of any of claims 1-4.
7. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the data sharing method according to any of claims 1-4.
CN201811025481.6A 2018-08-31 2018-08-31 Data sharing method, terminal equipment and computer readable storage medium Active CN109214201B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811025481.6A CN109214201B (en) 2018-08-31 2018-08-31 Data sharing method, terminal equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811025481.6A CN109214201B (en) 2018-08-31 2018-08-31 Data sharing method, terminal equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109214201A CN109214201A (en) 2019-01-15
CN109214201B true CN109214201B (en) 2024-03-19

Family

ID=64986626

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811025481.6A Active CN109214201B (en) 2018-08-31 2018-08-31 Data sharing method, terminal equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109214201B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111464282B (en) * 2019-01-18 2024-04-26 百度在线网络技术(北京)有限公司 Homomorphic encryption-based data processing method and device
CN110378128A (en) * 2019-06-17 2019-10-25 深圳壹账通智能科技有限公司 Data ciphering method, device and terminal device
CN110943834B (en) * 2019-12-06 2023-02-28 歌尔科技有限公司 Network device, password processing method thereof, control device and readable storage medium
CN111832042B (en) * 2020-06-23 2024-02-13 武汉菲奥达物联科技有限公司 Apartment student data safety management method and device
WO2022099495A1 (en) * 2020-11-11 2022-05-19 深圳技术大学 Ciphertext search method, system, and device in cloud computing environment
CN112685760A (en) * 2021-01-08 2021-04-20 浙江泰科数联信息技术有限公司 Financial data privacy processing and sharing method capable of authorizing on block chain
WO2022193309A1 (en) * 2021-03-19 2022-09-22 深圳大学 Ciphertext policy attribute-based encryption method and apparatus, and electronic device
CN113259137A (en) * 2021-07-15 2021-08-13 广东电网有限责任公司江门供电局 Power grid access control method, system and storage medium based on user attributes
CN115529194B (en) * 2022-11-28 2023-03-10 中国人民解放军国防科技大学 Data management method, system, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104079574A (en) * 2014-07-02 2014-10-01 南京邮电大学 User privacy protection method based on attribute and homomorphism mixed encryption under cloud environment
WO2016182509A1 (en) * 2015-05-13 2016-11-17 Agency For Science, Technology And Research Network system, and methods of encrypting data, decrypting encrypted data in the same
CN107154845A (en) * 2017-04-11 2017-09-12 中国人民武装警察部队工程大学 A kind of BGN types ciphertext decryption outsourcing scheme based on attribute
CN107181584A (en) * 2016-03-09 2017-09-19 郑珂威 Asymmetric complete homomorphic cryptography and its replacement of keys and ciphertext complete a business transaction method
CN108063754A (en) * 2017-11-10 2018-05-22 西安电子科技大学 Towards the attribute base encryption method of wearable health monitoring equipment anonymization data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104079574A (en) * 2014-07-02 2014-10-01 南京邮电大学 User privacy protection method based on attribute and homomorphism mixed encryption under cloud environment
WO2016182509A1 (en) * 2015-05-13 2016-11-17 Agency For Science, Technology And Research Network system, and methods of encrypting data, decrypting encrypted data in the same
CN107181584A (en) * 2016-03-09 2017-09-19 郑珂威 Asymmetric complete homomorphic cryptography and its replacement of keys and ciphertext complete a business transaction method
CN107154845A (en) * 2017-04-11 2017-09-12 中国人民武装警察部队工程大学 A kind of BGN types ciphertext decryption outsourcing scheme based on attribute
CN108063754A (en) * 2017-11-10 2018-05-22 西安电子科技大学 Towards the attribute base encryption method of wearable health monitoring equipment anonymization data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
云计算环境中基于策略的多用户全同态加密方法;刘青等;广西大学学报(自然科学版);20160625(第03期);第786-795页 *

Also Published As

Publication number Publication date
CN109214201A (en) 2019-01-15

Similar Documents

Publication Publication Date Title
CN109214201B (en) Data sharing method, terminal equipment and computer readable storage medium
US11750591B2 (en) Key attestation statement generation providing device anonymity
US10903976B2 (en) End-to-end secure operations using a query matrix
CN106612285B (en) Distributed cloud data management method and system based on peer-to-peer network
US20180212753A1 (en) End-To-End Secure Operations Using a Query Vector
US11115393B2 (en) Message server, method for operating message server and computer-readable recording medium
US10230697B2 (en) User terminals, and methods and computer-readable recording mediums storing computer programs for transmitting and receiving messages
US9641328B1 (en) Generation of public-private key pairs
El Bouchti et al. Encryption as a service for data healthcare cloud security
CN112003696A (en) SM9 key generation method, system, electronic equipment, device and storage medium
Matta et al. A comparative survey on data encryption Techniques: Big data perspective
CN107277028A (en) The method and device, equipment, storage medium of chatting facial expression are transmitted between application
Jammula et al. Hybrid lightweight cryptography with attribute-based encryption standard for secure and scalable IoT system
Yan et al. CloudFile: A cloud data access control system based on mobile social trust
Patil et al. Pixel co-ordinate-based secret image sharing scheme with constant size shadow images
CN117932685A (en) Privacy data processing method and related equipment based on longitudinal federal learning
WO2023185360A1 (en) Data processing method, apparatus, system and device, and storage medium
Tsai et al. An ECC-based secure EMR transmission system with data leakage prevention scheme
WO2022089518A1 (en) Address generation method, blockchain information processing method, and related device
CN115599959A (en) Data sharing method, device, equipment and storage medium
Arfan Mobile cloud computing security using cryptographic hash function algorithm
Abdulhamid et al. Development of blowfish encryption scheme for secure data storage in public and commercial cloud computing environment
Kumaresan et al. Design of new one-time pad encryption using non-uniform cellular automata with parity bit
WO2023078013A1 (en) Encryption method and apparatus, and related device
Christy Data Prevention Technique For Securing The Data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant