Data sharing method and device
By using encryption technology in blockchain data sharing, it is ensured that only when the first device is authorized, the third device can obtain the first data, which solves the problem of data sharing security in blockchain and realizes the secure sharing of data.
Patent Information
- Application Number
- CN202311251276.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
AI Technical Summary
The data stored in the blockchain is completely open to users, and there is a hidden danger of leaking private data, making it difficult to ensure the security of data sharing.
The first device receives a data request from the second device and a public key of the third device, encrypts the first key using the public key of the third device, obtains the ciphertext of the first key, and sends the ciphertext to the second device. The second device then shares the ciphertext with the third device. After decrypting it with its private key, the third device obtains the first key and decrypts the ciphertext of the first data, thereby obtaining the first data.
The security of the first data is ensured. Only when the first device authorizes the third device to use the first data, the third device can obtain the first key and the first data. Other devices cannot obtain it, ensuring the security of the first key.
Smart Images

Figure CN119728125A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a data sharing method and device. Background Art
[0002] With the continuous development of information technology, data has become an important resource, and data sharing has received more and more attention. Data sharing refers to the process of multiple organizations or individuals jointly acquiring, using, exchanging, and organizing data. Data sharing can enable more people or organizations to fully use existing data resources and quickly obtain a large amount of data resources.
[0003] Blockchain is a decentralized distributed ledger technology that consists of a series of data blocks called blocks, each of which contains a certain amount of transaction information or other types of data. Blockchain is secure, transparent, traceable, and tamper-proof, so it has been widely used in data sharing scenarios.
[0004] However, the data stored in the blockchain is usually completely open to users, and blockchain users can obtain any data they need from the blockchain. Therefore, this technology has the risk of leaking private data. Summary of the invention
[0005] The embodiments of the present application provide a data sharing method and device to improve the security of data sharing.
[0006] In the first aspect, an embodiment of the present application provides a data sharing method. Taking the first device as an execution subject as an example, the method includes: the first device receives a data request from a second device and a public key of a third device, and the data request is used to request first data of the first device. The first key is encrypted according to the public key of the third device to obtain a ciphertext of the first key. The first key is used to encrypt the first data to obtain the ciphertext of the first data. The ciphertext of the first key is sent to the second device.
[0007] With this method, after receiving a data request, if the first device authorizes the third device to use the first data, the first device uses the public key of the third device to encrypt the first key, obtains the ciphertext of the first key, and sends the ciphertext of the first key to the second device. After receiving the ciphertext of the first key, the second device can share the ciphertext of the first key with the third device. The third device decrypts the ciphertext of the first key according to the private key of the third device to obtain the first key, and uses the first key to decrypt the ciphertext of the first data to obtain the first data. In other words, if the first device does not authorize the third device to use the first data, the third device cannot obtain the first key, let alone the first data, thereby ensuring the security of the first data. Since the other devices cannot obtain the private key of the third device, the other devices cannot obtain the first key, thereby ensuring the security of the first key.
[0008] In a possible design, the first device encrypts the first data according to the first key to obtain the ciphertext of the first data, and sends the ciphertext of the first data to the second device.
[0009] Based on this design, before receiving the data request, the first device can encrypt the first data using the first key to obtain the ciphertext of the first data, and send the ciphertext of the first data to the second device. After receiving the ciphertext of the first data, the second device can share the ciphertext of the first data with p devices. The p devices can obtain the ciphertext of the first data before obtaining the first key. After obtaining the first key, the p devices can directly decrypt the ciphertext of the first data according to the first key to obtain the first data, thereby improving the efficiency of obtaining the first data.
[0010] In a possible design, the first data is processed according to a preset digest algorithm to obtain a standard digest of the first data, and the standard digest of the first data is used to verify the integrity of the first data. The standard digest of the first data is sent to the second device.
[0011] Based on this design, the first device processes the first data using a preset digest algorithm to obtain a standard digest of the first data, and sends the standard digest of the first data to the second device. After receiving the standard digest of the first data, the second device shares the standard digest of the first data with p devices. After obtaining the first data, the p devices can use the same digest algorithm to generate a digest of the first data, and determine whether the first data obtained by themselves is complete by comparing whether the two digests are the same.
[0012] In a possible design, key information of the first data is obtained according to the first data, and the key information of the first data is sent to the second device.
[0013] Based on this design, since the first device sends the ciphertext of the first data to the second device, the other devices cannot know the specific content of the first data. The first device can generate key information of the first data according to the content of the first data, and the other devices can determine whether the first data is the data they need through the key information.
[0014] In the second aspect, an embodiment of the present application provides a data sharing method. Taking the second device as the execution subject as an example, the method includes: the second device receives a data request and a public key of the third device from a third device, and shares the data request and the public key of the third device with p devices, the data request is used to request the first data of the first device, the p devices include the first device and the third device, and p is an integer greater than 1. Receive the ciphertext of the first key from the first device, the ciphertext of the first key is obtained by the first device encrypting the first key according to the public key of the third device. Share the ciphertext of the first key with p devices.
[0015] In one possible design, the second device receives a ciphertext of the first data from the first device, where the ciphertext of the first data is obtained by encrypting the first data according to the first key. The ciphertext of the first data is shared with p devices. Also, the second device receives a standard summary of the first data from the first device, where the standard summary of the first data is obtained by the first device processing the first data according to a preset summary algorithm, and the standard summary of the first data is used to verify the integrity of the first data. The standard summary of the first data is shared with p devices. Also, the second device receives key information of the first data from the first device, where the key information of the first data is obtained based on the first data. The key information of the first data is shared with p devices.
[0016] In the third aspect, an embodiment of the present application provides a data sharing method. Taking a third device as an execution subject as an example, the method includes: the third device sends a data request and a public key of the third device to the second device, and the data request is used to request the first data of the first device. Receive the ciphertext of the first key from the second device, and the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device. Decrypt the ciphertext of the first key according to the private key of the third device to obtain the first key, and the public key of the third device and the private key of the third device are a key pair. Decrypt the ciphertext of the first data according to the first key to obtain the first data.
[0017] In one possible design, the third device sends a data request and a public key of the third device to the second device, including: the third device receives key information of first data shared by the second device, where the key information of the first data is obtained based on the first data. A data request is generated based on the key information of the first data. The data request and the public key of the third device are sent to the second device.
[0018] In a possible design, decrypting the ciphertext of the first data according to the first key to obtain the first data includes: a third device receives the ciphertext of the first data shared by the second device, the ciphertext of the first data being obtained by encrypting the first data according to the first key, and decrypting the ciphertext of the first data according to the first key to obtain the first data.
[0019] In a possible design, the third device receives the standard digest of the first data shared by the second device, where the standard digest of the first data is obtained by the first device processing the first data according to a preset digest algorithm, and the standard digest of the first data is used to verify the integrity of the first data. The first data is processed according to the preset digest algorithm to obtain a digest of the first data. The integrity of the first data is verified according to the digest of the first data and the standard digest of the first data.
[0020] In a fourth aspect, an embodiment of the present application provides a data sharing device. The device includes: a communication module, which is used to receive a data request and a public key of a third device, wherein the data request is used to request first data of a first device. A processing module, which is used to encrypt the first key according to the public key of the third device to obtain a ciphertext of the first key. The communication module is also used to send the ciphertext of the first key.
[0021] In a possible design, the processing module is further used to encrypt the first data according to the first key to obtain the ciphertext of the first data. The communication module is further used to send the ciphertext of the first data. And the processing module is further used to process the first data according to a preset summary algorithm to obtain a standard summary of the first data, and the standard summary of the first data is used to verify the integrity of the first data. The communication module is further used to send the standard summary of the first data. And the processing module is further used to obtain key information of the first data according to the first data. The communication module is further used to send the key information of the first data.
[0022] In a fifth aspect, an embodiment of the present application provides a data sharing device. The device includes: a communication module, which is used to receive a data request and a public key of a third device, and share the data request and the public key of the third device with p devices, the data request is used to request the first data of the first device, the p devices include the first device and the third device, and p is an integer greater than 1. The communication module is also used to receive a ciphertext of the first key, and the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device. The communication module is also used to share the ciphertext of the first key with p devices.
[0023] In one possible design, the communication module is specifically used to receive a ciphertext of the first data, where the ciphertext of the first data is obtained by encrypting the first data according to a first key. The ciphertext of the first data is shared with p devices. Also, a standard summary of the first data is received, where the standard summary of the first data is obtained by processing the first data according to a preset summary algorithm, and the standard summary of the first data is used to verify the integrity of the first data. The standard summary of the first data is shared with p devices. Also, key information of the first data is received, where the key information of the first data is obtained based on the first data. The key information of the first data is shared with p devices.
[0024] In a sixth aspect, an embodiment of the present application provides a data sharing device. The device includes: a communication module, which is used to send a data request and a public key of a third device, and the data request is used to request the first data of the first device. The communication module is also used to receive the ciphertext of the first key, and the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device. The processing module is used to decrypt the ciphertext of the first key according to the private key of the third device to obtain the first key, and the public key of the third device and the private key of the third device are a key pair. The processing module is also used to decrypt the ciphertext of the first data according to the first key to obtain the first data.
[0025] In one possible design, the communication module is specifically used to receive key information of the first data, where the key information of the first data is obtained based on the first data. The processing module is specifically used to generate a data request based on the key information of the first data. The communication module is also used to send the data request and the public key of the third device.
[0026] In a possible design, the communication module is specifically used to receive the ciphertext of the first data, where the ciphertext of the first data is obtained by encrypting the first data according to the first key. The processing module is specifically used to decrypt the ciphertext of the first data according to the first key to obtain the first data.
[0027] In one possible design, the communication module is further used to receive a standard summary of the first data, where the standard summary of the first data is obtained by processing the first data according to a preset summary algorithm, and the standard summary of the first data is used to verify the integrity of the first data. The processing module is further used to process the first data according to a preset summary algorithm to obtain a summary of the first data. The processing module is further used to verify the integrity of the first data according to the summary of the first data and the standard summary of the first data.
[0028] In the seventh aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it implements the method as described in the first aspect above and any possible design thereof, or implements the method as described in the second aspect above and any possible design thereof.
[0029] In an eighth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the processor implements a method as described in the first aspect above and any possible design thereof, or implements a method as described in the second aspect above and any possible design thereof.
[0030] The technical effects brought about by the second to eighth aspects and any one of their designs can refer to the technical effects brought about by the corresponding designs in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A flowchart of a data sharing method provided in an embodiment of the present application;
[0033] Figure 2 A schematic diagram of the structure of a data sharing device provided in an embodiment of the present application;
[0034] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be described in detail in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0036] It should be understood that, in the description of the embodiments of the present invention, words such as “first” and “second” are only used to distinguish the description and cannot be understood as indicating or implying relative importance or order.
[0037] The term "and / or" in the embodiments of the present invention is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0038] Next, the data sharing method is introduced in combination with the existing technology.
[0039] Blockchain is a chain of blocks that store certain information. It is a decentralized distributed ledger technology. Blockchain is stored in all servers, that is, the server can directly obtain any information stored in the blockchain. Therefore, blockchain technology can be applied to data sharing scenarios.
[0040] The data sharing scheme based on blockchain technology is usually that blockchain users send the data to be shared to the blockchain, so that other blockchain users can obtain the data through the blockchain, thereby realizing data sharing. However, since the data stored in the blockchain is completely open to blockchain users, the data sharing scheme based on blockchain technology cannot guarantee the security of the data, and there is a risk of privacy data leakage.
[0041] In order to solve the above technical defects, the present application provides a data sharing method and device to improve the security of data sharing.
[0042] In the method provided in the present application, the first device can encrypt the first key using the public key of the third device according to the data request of the third device, obtain the ciphertext of the first key, and send the ciphertext of the first key to the second device. After receiving the ciphertext of the first key, the second device can share it with p devices. That is, the p devices can obtain the ciphertext of the first key through the second device. Among them, the p devices include the third device. The ciphertext of the first key can be decrypted using the private key corresponding to the public key of the third device to obtain the first key, and the ciphertext of the first data can be decrypted according to the first key to obtain the first data. Among them, the ciphertext of the first data is obtained by the first device encrypting the first data according to the first key, and sending it to the second device. The third device can obtain the ciphertext of the first data through the second device.
[0043] It is understandable that even if the third device can obtain the ciphertext of the first data through the second device, since the third device does not know the first key, the third device cannot obtain the first data without the consent of the first device, thereby ensuring the security of the first data. The first device can send the first key to the third device by encrypting the first key using the public key of the third device. Since other devices do not know the private key of the third device, other devices cannot obtain the first key, thereby ensuring the security of the first key.
[0044] In addition, the first device in the present application may be a device for providing data, the second device may be a device for storing data and sharing stored data, and the third device may be a device for using data. The first device and the third device may be the same device, or the first device and the third device may be different devices, which is not specifically limited in the present application.
[0045] Figure 1 A flow chart of a data sharing method provided in an embodiment of the present application. Taking the first device as a data providing device, the second device as a data sharing device (such as a blockchain), and the third device as a data using device as an example, the process may include the following steps:
[0046] S101, a third device sends a data request and a public key of the third device to a second device, wherein the data request is used to request first data of a first device.
[0047] In one or more embodiments, the first device may generate key information of the first data according to the first data. The first device may send the key information of the first data to the second device.
[0048] Specifically, the key information of the first data may be information generated by the first device based on the first data for summarizing and describing the first data. For example, the key information of the first data may include public description data of the first data and identification information of the first data. After generating the key information of the first data, the first device may send the key information of the first data to the second device. Accordingly, the second device receives the key information of the first data from the first device and shares the key information of the first data with p devices. The p devices include the first device and the third device.
[0049] Based on this embodiment, the first device may send information for summarizing the first data to the second device, and the second device may share the information with the p devices. The p devices may determine whether the first data is required data based on the key information of the first data. That is, the method may be used to determine whether the first data is required data without obtaining the first data.
[0050] In one or more embodiments, the third device may receive key information of the first data from the second device. The third device may generate a data request based on the key information of the first data. The third device sends the data request and the public key of the third device to the second device.
[0051] Specifically, the third device may obtain the key information of the first data through the second device, and determine that the first data is data used by the third device according to the key information of the first data. The third device may generate a data request for requesting the first data according to the key information of the first data. For example, the third device may generate a data request according to the identification information of the first data carried in the key information of the first data. That is, the data request includes the identification information of the first data.
[0052] After generating a data request for requesting the first data, the third device may send the data request and the public key of the third device to the second device. Correspondingly, the second device may receive the data request and the public key of the third device from the third device.
[0053] Optionally, the third device may send the public key of the third device to the second device before sending the data request. Correspondingly, the second device receives the public key of the third device from the third device, and shares the public key of the third device with p devices.
[0054] For example, when applying for a legitimate blockchain user, the third device can apply for a signature certificate and an encryption certificate from a set certificate authority (CA), and send the encryption certificate (i.e., the public key of the third device) to the second device. The signature certificate can be used to verify the integrity of the file transmitted between the third device and the second device.
[0055] S102: The second device shares a data request and a public key of the third device with p devices.
[0056] Specifically, after receiving the data request from the second device and the public key of the third device, the second device can share the data request and the public key of the third device with p devices. Accordingly, the p devices can obtain the data request and the public key of the third device through the second device.
[0057] According to the description of step S101, the third device may first send the public key of the third device to the second device, and then send the data request to the second device. Correspondingly, the second device may first receive the public key of the third device from the second device, and then receive the data request from the second device.
[0058] In one or more embodiments, after receiving the public key of the third device, the second device may immediately share the public key of the third device with p devices.
[0059] It is understandable that after receiving the public key of the third device, the second device can immediately share the public key of the third device with the p devices. Accordingly, any device among the p devices can obtain and use the public key of the third device at any time.
[0060] Alternatively, after receiving the data request, the second device may also share the public key and the data request of the third device with p devices.
[0061] It is understandable that after receiving the request from the third device, the second device shares the public key of the third device with the p devices. That is, if the second device does not receive the request from the third device, it does not need to share the public key of the third device with the p devices, thereby reducing the communication volume between the second device and the p devices.
[0062] In one or more embodiments, after receiving the data request from the third device, the second device may only share the data request with the first device. For example, the data request includes identification information of the first data (such as an index identifier), and the second device may determine that the first data is the data of the first device according to the identification information of the first data, and then the second device shares the data request with the first device.
[0063] Based on this embodiment, the second device may send the data request only to the device corresponding to the data request according to the content in the data request, thereby reducing the communication volume between the second device and other devices.
[0064] S103, the first device encrypts the first key according to the public key of the third device to obtain a ciphertext of the first key.
[0065] Specifically, the first device may receive a data request from the second device, and authorize the third device to use the first data according to the data request. The first device may obtain the public key of the third device through the second device, and encrypt the first key according to the public key of the third device to obtain the ciphertext of the first key.
[0066] It is understandable that if the first device authorizes the third device to use the first data, the first key is encrypted using the public key corresponding to the third device to obtain the ciphertext of the first key. In other words, the ciphertext of the first key obtained according to the public key of the third device is the authorization information of the first device authorizing the third device to use the first data.
[0067] S104: The first device sends a ciphertext of the first key to the second device.
[0068] Specifically, after obtaining the ciphertext of the first key, the first device may send the ciphertext of the first key to the second device.
[0069] S105: The second device shares the ciphertext of the first key with p devices.
[0070] Specifically, after receiving the ciphertext of the first key from the first device, the second device may share the ciphertext of the first key with p devices.
[0071] It is understandable that according to the description of step S103, the ciphertext of the first key is obtained by the first device encrypting the first key according to the public key of the third device, and the other devices do not know the private key corresponding to the public key of the third device. Therefore, even if the other devices can obtain the ciphertext of the first key, they cannot obtain the first key according to the ciphertext of the first key. Therefore, this design can ensure the security of the first key.
[0072] Optionally, the second device may also only send the ciphertext of the first key to the third device, thereby reducing the communication volume between the second device and other devices.
[0073] S106: The third device decrypts the ciphertext of the first key according to the private key of the third device to obtain the first key, wherein the public key of the third device and the private key of the third device form a key pair.
[0074] Specifically, the third device may receive the ciphertext of the first key from the second device, and decrypt the ciphertext of the first key according to the private key corresponding to the public key of the third device to obtain the first key.
[0075] S107, the third device decrypts the ciphertext of the first data according to the first key to obtain the first data, wherein the ciphertext of the first data is obtained by the first device encrypting the first data according to the first key.
[0076] In one or more embodiments, the first device may encrypt the first data according to the first key to obtain the ciphertext of the first data. The first device sends the ciphertext of the first data to the second device.
[0077] Specifically, the first device can encrypt the first data using the first key according to a preset data encryption algorithm, obtain the ciphertext of the first data, and send the ciphertext of the first data to the second device. The data encryption algorithm can be an encryption algorithm pre-set by p devices. Alternatively, when the first device sends the ciphertext of the first data to the second device, it sends the encryption algorithm corresponding to the ciphertext of the first data to the second device. Accordingly, the second device receives the ciphertext of the first data from the first device and shares the ciphertext of the first data with the p devices. Therefore, the third device can obtain the ciphertext of the first data through the second device.
[0078] Optionally, if the ciphertext of the first data occupies a large storage space, the second device may store the ciphertext of the first data in the file system of the second device and share the storage location of the ciphertext of the first data with p devices. The p devices may obtain the ciphertext of the first data according to the storage location of the ciphertext of the first data.
[0079] It is understandable that the first device can generate the ciphertext of the first data and send the ciphertext of the first data to the second device after the first device receives the data request. That is, after receiving the request for the first data, the first device generates the ciphertext of the first data and sends the ciphertext of the first data to the second device, thereby reducing the computational complexity of the first device and saving the storage space of the second device.
[0080] Optionally, after receiving the request for the first data, the first device may simultaneously send the ciphertext of the first data and the ciphertext of the first key to the second device. For example, the first device may encrypt the first data by making a key envelope (that is, the first device encrypts the first data using the first key, and then encrypts the first key using the public key of the third device), and send the key envelope to the second device. The key envelope includes the ciphertext of the first key. The third device may obtain the key envelope and the ciphertext of the first data through the second device, and decrypt the key envelope using the private key of the third device to obtain the first key. The third device decrypts the ciphertext of the first data using the first key to obtain the first data.
[0081] The first device may also generate the ciphertext of the first data and send the ciphertext of the first data to the second device before receiving the data request. That is, the first device may generate the ciphertext of the first data in advance and send the ciphertext of the first data to the second device. When the first device authorizes the third device to use the first data, the first device only needs to generate and transmit the ciphertext of the first key, thereby improving the efficiency of data sharing.
[0082] Optionally, the first device may send the ciphertext of the first data and the ciphertext of the first key to the second device before receiving the data request. For example, the first device may encrypt the first data by making a key envelope (that is, the first device encrypts the first data using the first key to obtain the ciphertext of the first data, and then uses the public key of the first device to encrypt the first key), and send the key envelope to the second device. When the first device receives the data request, the first device can obtain the key envelope and the ciphertext of the first data through the second device, and use the private key of the first device to decrypt the key envelope to obtain the first key. The first device can use the public key of the third device to re-encrypt the first key to obtain a new key envelope, and send the new key envelope to the second device.
[0083] After obtaining the ciphertext of the first data, the third device can decrypt the ciphertext of the first data according to the first key to obtain the first data.
[0084] In one or more embodiments, the first device may process the first data according to a preset digest algorithm to obtain a standard digest of the first data. The first device may send the standard digest of the first data to the second device.
[0085] Specifically, in order to ensure that the first data obtained by the data-using device is the same as the first data provided by the first device, the first device may generate a standard digest of the first data according to a preset digest algorithm, and send the standard digest of the first data to the second device. Correspondingly, the second device receives the standard digest of the first data from the first device, and shares the standard digest of the first data with p devices.
[0086] In the present application, after obtaining the first data, the third device may process the first data according to a preset summary algorithm to obtain a summary of the first data. The third device may obtain the standard summary of the first data through the second device, and determine whether the first data is complete data according to the summary of the first data and the standard summary of the first data. That is, if the summary of the first data is the same as the standard summary of the first data, it means that the first data is complete data, and if the summary of the first data is different from the standard summary of the first data, it means that the first data is incomplete data.
[0087] Based on this embodiment, the third device can determine whether the first data is complete data according to whether the digest of the first data is the same as the standard digest of the first data, thereby ensuring the integrity of the first data used.
[0088] Understandably, in this application, if the second device is a blockchain, the actions of maintaining the information of p devices, providing data, and authorizing data can all be recorded on the blockchain. The entire process of data sharing can be traced back, thereby ensuring the security of shared data.
[0089] Based on the above content and the same concept, the present application provides a data sharing device. Figure 2 The figure shows a modular structure diagram of a data sharing device provided in an embodiment of the present application. The device may include a communication module 201 and a processing module 202 .
[0090] When implementing the actions performed by the first device in the above method embodiment, the communication module 201 is used to receive a data request and a public key of a third device, wherein the data request is used to request the first data of the first device. The processing module 202 is used to encrypt the first key according to the public key of the third device to obtain the ciphertext of the first key. The communication module 201 is also used to send the ciphertext of the first key.
[0091] In a possible design, the processing module 202 is further used to encrypt the first data according to the first key to obtain the ciphertext of the first data. The communication module 201 is further used to send the ciphertext of the first data.
[0092] The processing module 202 is further used to process the first data according to a preset digest algorithm to obtain a standard digest of the first data, and the standard digest of the first data is used to verify the integrity of the first data. The communication module 201 is further used to send the standard digest of the first data.
[0093] The processing module 202 is further used to obtain key information of the first data according to the first data. The communication module 201 is further used to send the key information of the first data.
[0094] When implementing the action performed by the second device in the above method embodiment, the communication module 201 is used to receive a data request and a public key of a third device, and share the data request and the public key of the third device with p devices, the data request is used to request the first data of the first device, the p devices include the first device and the third device, and p is an integer greater than 1. The communication module 201 is also used to receive the ciphertext of the first key, the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device. The communication module 201 is also used to share the ciphertext of the first key with p devices.
[0095] In one possible design, the communication module 201 is specifically used to receive the ciphertext of the first data, where the ciphertext of the first data is obtained by encrypting the first data according to the first key. The ciphertext of the first data is shared with p devices. Also, a standard summary of the first data is received, where the standard summary of the first data is obtained by processing the first data according to a preset summary algorithm, and the standard summary of the first data is used to verify the integrity of the first data. The standard summary of the first data is shared with p devices. Also, key information of the first data is received, where the key information of the first data is obtained based on the first data. The key information of the first data is shared with p devices.
[0096] When implementing the actions performed by the third device in the above method embodiment, the communication module 201 is used to send a data request and a public key of the third device, and the data request is used to request the first data of the first device. The communication module 201 is also used to receive the ciphertext of the first key, and the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device. The processing module 202 is used to decrypt the ciphertext of the first key according to the private key of the third device to obtain the first key, and the public key of the third device and the private key of the third device are a key pair. The processing module 202 is also used to decrypt the ciphertext of the first data according to the first key to obtain the first data.
[0097] In one possible design, the communication module 201 is specifically used to receive key information of the first data, where the key information of the first data is obtained based on the first data. The processing module 202 is specifically used to generate a data request based on the key information of the first data. The communication module 201 is also used to send the data request and the public key of the third device.
[0098] In a possible design, the communication module 201 is specifically used to receive the ciphertext of the first data, where the ciphertext of the first data is obtained by encrypting the first data according to the first key. The processing module 202 is specifically used to decrypt the ciphertext of the first data according to the first key to obtain the first data.
[0099] In a possible design, the communication module 201 is further used to receive a standard summary of the first data, where the standard summary of the first data is obtained by processing the first data according to a preset summary algorithm, and the standard summary of the first data is used to verify the integrity of the first data. The processing module 202 is further used to process the first data according to a preset summary algorithm to obtain a summary of the first data. The processing module 202 is further used to verify the integrity of the first data according to the summary of the first data and the standard summary of the first data.
[0100] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown.
[0101] The electronic device in the embodiment of the present application may include a processor 301. The processor 301 is the control center of the device, and various interfaces and lines can be used to connect various parts of the device, by running or executing instructions stored in the memory 303 and calling data stored in the memory 303. Optionally, the processor 301 may include one or more processing units, and the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 301. In some embodiments, the processor 301 and the memory 303 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0102] The processor 301 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The method steps disclosed in the embodiments of the present application may be directly executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0103] In the embodiment of the present application, the memory 303 stores instructions that can be executed by at least one processor 301. The at least one processor 301 can be used to execute the method steps disclosed in the embodiment of the present application by executing the instructions stored in the memory 303.
[0104] The memory 303 is a non-volatile computer-readable storage medium, which can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 303 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 303 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 303 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0105] In the embodiment of the present application, the device may further include a communication interface 302 , through which the electronic device may transmit data.
[0106] Optional, can be Figure 3 The processor 301 (or the processor 301 and the communication interface 302) implements Figure 2 The processing module 202 and / or the communication module 201 shown, that is, the actions of the processing module 202 and / or the communication module 201 can be executed by the processor 301 (or the processor 301 and the communication interface 302).
[0107] Based on the same inventive concept, the embodiment of the present application also provides a computer-readable storage medium, which may store instructions. When the instructions are executed on a computer, the computer executes the operation steps provided in the above method embodiment. The computer-readable storage medium may be Figure 3 The memory 303 is shown.
[0108] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0109] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0110] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0112] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A data sharing method, characterized in that: The method comprises: The first device receives a data request from the second device and a public key of a third device, wherein the data request is used to request first data of the first device; Encrypting a first key according to the public key of the third device to obtain a ciphertext of the first key, wherein the first key is used to encrypt the first data to obtain the ciphertext of the first data; Send the ciphertext of the first key to the second device.
2. The method according to claim 1, characterized in that The method further comprises: The first device encrypts the first data according to the first key to obtain a ciphertext of the first data; sending the ciphertext of the first data to the second device; and, Processing the first data according to a preset digest algorithm to obtain a standard digest of the first data, where the standard digest of the first data is used to verify the integrity of the first data; sending a standard summary of the first data to the second device; and, Obtaining key information of the first data according to the first data; Send key information of the first data to the second device.
3. A data sharing method, characterized in that: The method comprises: The second device receives a data request and a public key of the third device from a third device, and shares the data request and the public key of the third device with p devices, wherein the data request is used to request first data of the first device, the p devices include the first device and the third device, and p is an integer greater than 1; receiving a ciphertext of a first key from the first device, where the ciphertext of the first key is obtained by encrypting the first key by the first device according to the public key of the third device; The ciphertext of the first key is shared with the p devices.
4. The method according to claim 3, characterized in that The method further comprises: The second device receives a ciphertext of first data from the first device, where the ciphertext of the first data is obtained by encrypting the first data according to a first key; sharing the ciphertext of the first data with the p devices; and, receiving a standard digest of the first data from the first device, where the standard digest of the first data is obtained by the first device processing the first data according to a preset digest algorithm, and the standard digest of the first data is used to verify the integrity of the first data; sharing a standard summary of the first data to the p devices; and, receiving key information of the first data from the first device, where the key information of the first data is obtained according to the first data; Share key information of the first data with the p devices.
5. A data sharing method, characterized in that: The method comprises: The third device sends a data request and a public key of the third device to the second device, where the data request is used to request the first data of the first device; receiving a ciphertext of the first key from the second device, where the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device; decrypting the ciphertext of the first key according to the private key of the third device to obtain the first key, where the public key of the third device and the private key of the third device form a key pair; The ciphertext of the first data is decrypted according to the first key to obtain the first data.
6. The method according to claim 5, characterized in that The third device sends a data request and a public key of the third device to the second device, including: The third device receives key information of the first data shared by the second device, where the key information of the first data is obtained based on the first data; generating the data request according to the key information of the first data; The data request and the public key of the third device are sent to the second device.
7. The method according to claim 5, characterized in that Decrypting the ciphertext of the first data according to the first key to obtain the first data includes: The third device receives the ciphertext of the first data shared by the second device, where the ciphertext of the first data is obtained by encrypting the first data according to the first key; The ciphertext of the first data is decrypted according to the first key to obtain the first data.
8. The method according to claim 5 or 7, characterized in that The method further comprises: The third device receives the standard digest of the first data shared by the second device, where the standard digest of the first data is obtained by the first device processing the first data according to a preset digest algorithm, and the standard digest of the first data is used to verify the integrity of the first data; Processing the first data according to the preset digest algorithm to obtain a digest of the first data; The integrity of the first data is verified according to the digest of the first data and the standard digest of the first data.
9. A data sharing device, characterized in that: The device comprises: A communication module, configured to receive a data request and a public key of a third device, wherein the data request is used to request first data of the first device; A processing module, configured to encrypt a first key according to a public key of the third device to obtain a ciphertext of the first key, wherein the first key is used to encrypt the first data to obtain the ciphertext of the first data; The communication module is further used to send the ciphertext of the first key.
10. The device according to claim 9, characterized in that The device also includes: The processing module is further used to encrypt the first data according to the first key to obtain a ciphertext of the first data; The communication module is further used to send the ciphertext of the first data; and The processing module is further used to process the first data according to a preset digest algorithm to obtain a standard digest of the first data, where the standard digest of the first data is used to verify the integrity of the first data; The communication module is further configured to send a standard summary of the first data; and The processing module is further used to obtain key information of the first data according to the first data; The communication module is also used to send key information of the first data.
11. A data sharing device, characterized in that: The device comprises: a communication module, configured to receive a data request and a public key of a third device, and share the data request and the public key of the third device with p devices, wherein the data request is used to request first data of the first device, the p devices include the first device and the third device, and p is an integer greater than 1; The communication module is further configured to receive a ciphertext of a first key, where the ciphertext of the first key is obtained by encrypting the first key according to a public key of the third device; The communication module is further used to share the ciphertext of the first key with the p devices.
12. The device according to claim 11, characterized in that The communication module is specifically used for: receiving a ciphertext of first data, where the ciphertext of the first data is obtained by encrypting the first data according to a first key; sharing the ciphertext of the first data with the p devices; and, receiving a standard digest of the first data, where the standard digest of the first data is obtained by processing the first data according to a preset digest algorithm, and the standard digest of the first data is used to verify the integrity of the first data; sharing a standard summary of the first data to the p devices; as well as, receiving key information of the first data, where the key information of the first data is obtained based on the first data; Share key information of the first data with the p devices.
13. A data sharing device, characterized in that: The device comprises: a communication module, configured to send a data request and a public key of the third device, wherein the data request is used to request first data of the first device; The communication module is further configured to receive a ciphertext of the first key, where the ciphertext of the first key is obtained by encrypting the first key according to the public key of the third device; a processing module, configured to decrypt the ciphertext of the first key according to the private key of the third device to obtain the first key, wherein the public key of the third device and the private key of the third device form a key pair; The processing module is further used to decrypt the ciphertext of the first data according to the first key to obtain the first data.
14. The device according to claim 13, characterized in that The communication module is specifically used to receive key information of the first data, where the key information of the first data is obtained based on the first data; The processing module is specifically configured to generate the data request according to the key information of the first data; The communication module is further used to send the data request and the public key of the third device.
15. The device according to claim 13, characterized in that The communication module is specifically configured to receive a ciphertext of the first data, where the ciphertext of the first data is obtained by encrypting the first data according to a first key; The processing module is specifically configured to decrypt the ciphertext of the first data according to the first key to obtain the first data.
16. The device according to claim 13 or 15, characterized in that The communication module is further used to receive a standard summary of the first data, where the standard summary of the first data is obtained by processing the first data according to a preset summary algorithm, and the standard summary of the first data is used to verify the integrity of the first data; The processing module is further used to process the first data according to the preset digest algorithm to obtain a digest of the first data; The processing module is further used to verify the integrity of the first data according to the summary of the first data and the standard summary of the first data.
17. An electronic device, characterized in that: The electronic device comprises a processor, and the processor is used to implement the steps of any one of the methods as claimed in claims 1-8 when executing a computer program stored in a memory.
18. A computer-readable storage medium, characterized in that: The device stores a computer program, which implements the steps of the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Data sharing method and device
CN109246110A
Data encryption sharing method and system based on block chain
CN112287378A
Data encryption transmission method and system, computer equipment and storage medium
CN115567324A
Method of protecting data and computer device
US20220198051A1