A blockchain data sharing method and device
The method of generating dynamic symmetric keys by sharing dynamic information has solved the problem that blockchain data encryption sharing method is difficult to take into account both security and performance, and efficient and secure data transmission is achieved, which is suitable for the high security needs of the financial industry.
Patent Information
- Application Number
- CN202010894274.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-31
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2040-08-31
AI Technical Summary
The existing blockchain data encryption sharing method is difficult to take into account both security and performance, especially during multi-party negotiation, which is prone to performance bottlenecks, affecting the efficiency and security of data transmission.
The method of generating dynamic symmetric keys with shared dynamic information is adopted, and the key is dynamically updated in the master key and multiple subkeys is increased to increase the complexity and difficulty of the key. The initiator generates dynamic symmetric keys locally and encrypts the data. The receiver decrypts based on the same information, avoids the key interaction process, and improves security and performance.
It realizes the security and performance of data encryption sharing on the blockchain. Through multiple keys and dynamic update mechanisms, the difficulty of cracking and transmission efficiency of ciphertext data is improved, and the high security and real-time performance of the financial industry is met. Sexual needs.
Smart Images

Figure CN112039883B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain in the field of financial technology (Fintech), and in particular to a blockchain data sharing method and device. Background Art
[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech and blockchain. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. An institution has the need to store data on the blockchain for another cooperative institution to obtain. If the plain text is directly placed on the blockchain, all institutions can see it directly. Obviously, this requires a reasonable data encryption sharing solution.
[0003] At present, the general ideas of data encryption and sharing on blockchain can be divided into two categories: (1) Agreeing on a single key to encrypt and decrypt data. Once the key is cracked, all ciphertexts are useless and do not meet security requirements; (2) Multi-party key negotiation. Each time a key is used, multi-party encryption negotiation and simultaneous confirmation are required. When there are many participants, the negotiation process will become a performance bottleneck, thereby delaying the entire data encryption and sharing process. Therefore, the current encryption sharing method is difficult to balance security and performance, which is an urgent problem to be solved. Summary of the invention
[0004] The present invention provides a blockchain data sharing method and device, which solves the problem that the encryption sharing method in the prior art is difficult to strike a balance between security and performance.
[0005] In a first aspect, the present invention provides a data sharing method of a blockchain, comprising: an initiator generates a dynamic symmetric key based on shared dynamic information; the shared dynamic information is dynamically updated information agreed upon by the initiator and the recipient in a preset manner; the shared dynamic information comprises: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key; the initiator encrypts the shared data according to the dynamic symmetric key to obtain ciphertext data; and the initiator sends the ciphertext data to the blockchain.
[0006] In the above manner, since the shared dynamic information is dynamically updated information agreed upon by the initiator and the receiver in a preset manner, the initiator can generate the same dynamic symmetric key locally based on the same shared dynamic information, without the need to interact with the receiver to obtain the dynamic symmetric key before encrypting the shared data. Furthermore, the shared dynamic information includes: a master key and multiple subkeys, at least one of the master key and the multiple subkeys is a dynamically updated key. Since there are multiple keys, and some of them are dynamically updated, the difficulty of cracking the dynamic symmetric key is increased. Furthermore, the initiator encrypts the shared data according to the dynamic symmetric key, and sends the ciphertext data to the blockchain, so that the receiver can obtain the ciphertext data from the blockchain and decrypt it. In the process of sharing data, there is no need to communicate and interact with the receiver, avoiding the performance bottleneck of interactive dynamic symmetric keys. The shared dynamic key can be generated locally on the initiator by including multiple keys and a dynamically updated shared dynamic key, thereby ensuring the security of the ciphertext data, thereby taking into account both security and performance.
[0007] Optionally, the multiple subkeys include: multiple obfuscation information and a rotation number; the rotation number is a dynamically changing positive integer; the initiator generates a dynamic symmetric key based on the shared dynamic information, including: for any fragment information in each fragment information, the initiator iterates the fragment information through a first preset function N times to obtain an iterative result of the fragment information; wherein N is determined at least based on the rotation number; any fragment information in each fragment information is the master key and at least one of the multiple obfuscation information; based on the iterative results of each fragment information, the dynamic symmetric key is generated.
[0008] In the above method, any one of the fragment information is the master key and at least one of the multiple obfuscated information. For each fragment information, the initiator iterates the fragment information N times through the first preset function, and the specific N is determined at least according to the rotation number, and the rotation number is a dynamically changing positive integer. Therefore, the iteration result of each fragment information also changes dynamically, so the dynamic symmetric key generated according to the iteration result of each fragment information is more difficult to crack.
[0009] Optionally, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one recipient; the initiator agrees on the master key and the multiple obfuscation information with any recipient in the following manner: the initiator generates the master key and the obfuscation information of the initiator; the initiator sends the master key and the obfuscation information of the initiator to the recipient; the initiator obtains the obfuscation information of the at least one recipient; wherein the obfuscation information of the recipient is sent after the recipient verifies that the obfuscation information of the initiator is passed; the initiator sends the obfuscation information of the at least one recipient to the recipient; after determining that the recipient has verified the obfuscation information of the recipient in the obfuscation information of the at least one recipient, the initiator determines that the master key and the multiple obfuscation information are successfully agreed upon with the recipient.
[0010] In the above method, the multiple obfuscation information includes: the obfuscation information of the initiator and the obfuscation information of at least one receiver. The initiator obtains the obfuscation information of the at least one receiver, and the obfuscation information of the receiver is sent after the receiver verifies the obfuscation information of the initiator. After the initiator obtains the obfuscation information of the at least one receiver, the master key and the multiple obfuscation information are agreed upon by verifying the mutual obfuscation information, thereby increasing the reliability of the multiple obfuscation information and further increasing the security of the dynamic symmetric key.
[0011] Optionally, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information among the fragment information that contains the key.
[0012] In the above manner, each obfuscated information is uniquely mapped to the initiator or the receiver, so that each obfuscated information is subject to the constraints of the initiator or the receiver, and for any key, there is at least one fragment of the fragment information that contains the key, that is, the master key and each obfuscated information are used when generating the dynamic symmetric key, which is more difficult to crack and the generated dynamic symmetric key is more secure.
[0013] Optionally, the multiple subkeys include: a key update cycle and a dynamic timestamp; the initiator generates a dynamic symmetric key based on shared dynamic information, including: in any key update cycle, the initiator dynamically iterates according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; the initiator generates the dynamic symmetric key of the key update cycle through a second preset function based on the master key and the multiple subkeys; the master key is a dynamic symmetric key generated in a previous key update cycle or an original static key.
[0014] Under the above method, in any key update cycle, the initiator will obtain the dynamically updated dynamic timestamp, and can further generate the dynamic symmetric key of the key update cycle through a second preset function, thereby generating a more difficult to crack dynamic symmetric key based on dynamic iteration by adding a dynamic timestamp.
[0015] Optionally, the multiple subkeys also include: an encryption certificate; before the initiator generates a symmetric dynamic key based on the shared dynamic information, it also includes: the initiator generates an initial random value; the initiator generates the encryption certificate based on the initial random value, the initial timestamp and the key update period; the initiator generates the original static key based on the initial random value, the initial timestamp, the key update period and the encryption certificate; the initiator sends the encryption certificate to the recipient; the initiator determines that it is agreed with the recipient to generate shared dynamic information in a preset manner based on the encryption certificate verified by the recipient.
[0016] In the above manner, after the initiator generates the encryption certificate, it generates the original static key according to the initial random value, the initial timestamp, the key update cycle and the encryption certificate, and determines through the encryption certificate that it has agreed with the recipient to generate dynamic update information in a preset manner, thereby agreeing with the recipient to share dynamic information in a reliable manner, thereby increasing the security of the dynamic symmetric key.
[0017] Optionally, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; after the initiator sends the ciphertext data to the blockchain, it also includes: the initiator updates the transmission count within the cycle; the initial value of the transmission count within the cycle is a preset value; when the value of the transmission count within the cycle in the ciphertext data is not the preset value, it is used to trigger the receiver to regenerate the dynamic symmetric key based on the shared dynamic information.
[0018] In the above manner, the ciphertext data includes a transmission count within a cycle. After the initiator sends the ciphertext data to the blockchain, the initiator updates the transmission count within the cycle, so that the dynamic symmetric key can be regenerated each time according to changes in the transmission technology within the cycle, further increasing the difficulty of cracking the dynamic symmetric key.
[0019] In a second aspect, the present invention provides a blockchain data sharing method, comprising: a receiving party obtains ciphertext data uploaded by an initiator from the blockchain; the receiving party generates a dynamic symmetric key based on shared dynamic information; the shared dynamic information is dynamically updated information agreed upon by the initiator and the receiving party in a preset manner; the shared dynamic information includes: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key; the receiving party decrypts the ciphertext data according to the dynamic symmetric key to obtain shared data.
[0020] Optionally, the multiple subkeys include: multiple obfuscation information and rotation numbers; the rotation number is a dynamically changing positive integer; the receiver generates a dynamic symmetric key based on the shared dynamic information, including: for any fragment information in each fragment information, the receiver iterates the fragment information through a first preset function N times to obtain an iterative result of the fragment information; wherein N is determined at least based on the rotation number; any fragment information in each fragment information is the master key and at least one of the multiple obfuscation information; based on the iterative results of each fragment information, the dynamic symmetric key is generated.
[0021] Optionally, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one receiver; the receiver is any receiver of the at least one receiver; the receiver agrees on the master key and the multiple obfuscation information with the initiator in the following manner: the receiver obtains the obfuscation information from the initiator; after the receiver verifies that the obfuscation information of the initiator is passed, the receiver sends the obfuscation information of the receiver to the sender; the receiver obtains the obfuscation information of the at least one receiver from the sender, and after verifying the obfuscation information of the receiver in the obfuscation information of the at least one receiver, determines that the master key and the multiple obfuscation information are successfully agreed upon with the receiver.
[0022] Optionally, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information among the fragment information that contains the key.
[0023] Optionally, the multiple subkeys include: a key update cycle and a dynamic timestamp; the recipient generates a dynamic symmetric key based on the shared dynamic information, including: in any key update cycle, the recipient dynamically iterates according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; the recipient generates a dynamic symmetric key for the key update cycle through a second preset function based on the master key and the multiple subkeys; the master key is a dynamic symmetric key generated in a previous key update cycle or an original static key.
[0024] Optionally, the multiple subkeys also include: an encryption certificate; the encryption certificate is generated by the initiator based on the initial random value, the initial timestamp and the key update period; before the receiver generates a dynamic symmetric key based on the shared dynamic information, it also includes: the receiver obtains the encryption certificate from the initiator; after the receiver verifies the encryption certificate, it determines that it is agreed with the initiator to generate shared dynamic information in a preset manner.
[0025] Optionally, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; after the receiver obtains the ciphertext data uploaded by the initiator from the blockchain, it also includes: the receiver updates the transmission count within the cycle; the initial value of the transmission count within the cycle is a preset value; if the receiver determines that the value of the transmission count within the cycle in the ciphertext data is not the preset value, the dynamic symmetric key is re-generated based on the shared dynamic information.
[0026] The beneficial effects of the above-mentioned second aspect and each optional method of the second aspect can refer to the beneficial effects of the above-mentioned first aspect and each optional method of the first aspect, and will not be repeated here.
[0027] In the third aspect, the present invention provides a data sharing device of a blockchain, comprising: a generation module, used to generate a dynamic symmetric key based on shared dynamic information; the shared dynamic information is dynamically updated information agreed upon by an initiator and a receiver in a preset manner; the shared dynamic information includes: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key; an encryption module, used to encrypt shared data according to the dynamic symmetric key to obtain ciphertext data; a data transmission module, used to send the ciphertext data to the blockchain.
[0028] Optionally, the multiple sub-keys include: multiple obfuscation information and rotation numbers; the rotation number is a dynamically changing positive integer; the generation module is specifically used to: for any fragment information in each fragment information, iterate the fragment information N times through a first preset function to obtain an iterative result of the fragment information; wherein N is determined at least based on the rotation number; any fragment information in each fragment information is the master key and at least one of the multiple obfuscation information; based on the iterative results of each fragment information, generate the dynamic symmetric key.
[0029] Optionally, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one receiver; the receiver is any one of the at least one receiver; the generation module is also used to: generate the master key and the obfuscation information of the initiator; the data transmission module is also used to: send the master key and the obfuscation information of the initiator to the receiver; obtain the obfuscation information of the at least one receiver; wherein the obfuscation information of the receiver is sent after the receiver verifies that the obfuscation information of the initiator is passed; send the obfuscation information of the at least one receiver to the receiver; after determining that the receiver has verified the obfuscation information of the receiver in the obfuscation information of the at least one receiver, determine that the master key and the multiple obfuscation information are successfully agreed upon with the receiver.
[0030] Optionally, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information among the fragment information that contains the key.
[0031] Optionally, the multiple sub-keys include: a key update cycle and a dynamic timestamp; the generation module is specifically used to: in any key update cycle, dynamically iterate according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; generate the dynamic symmetric key of the key update cycle through a second preset function according to the master key and the multiple sub-keys; the master key is the dynamic symmetric key generated in the previous key update cycle or the original static key.
[0032] Optionally, the multiple subkeys also include: an encryption certificate; the generation module is also used to: generate an initial random value; generate the encryption certificate according to the initial random value, the initial timestamp and the key update period; generate the original static key according to the initial random value, the initial timestamp, the key update period and the encryption certificate; the data transmission module is also used to: send the encryption certificate to the recipient; based on the recipient verifying the encryption certificate, determine that it is agreed with the recipient to generate shared dynamic information in a preset manner.
[0033] Optionally, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; the generation module is also used to: update the transmission count within the cycle; the initial value of the transmission count within the cycle is a preset value; when the value of the transmission count within the cycle in the ciphertext data is not the preset value, it is used to trigger the recipient to regenerate the dynamic symmetric key based on the shared dynamic information.
[0034] The beneficial effects of the third aspect and each optional device of the third aspect can be referred to the beneficial effects of the first aspect and each optional method of the first aspect, and will not be repeated here.
[0035] In a fourth aspect, the present invention provides a blockchain data sharing device, comprising: a data transmission module, used to obtain ciphertext data uploaded by an initiator from the blockchain; a generation module, used to generate a dynamic symmetric key based on shared dynamic information; the shared dynamic information is dynamically updated information agreed upon by the initiator and the recipient in a preset manner; the shared dynamic information includes: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key; a decryption module, used to decrypt the ciphertext data according to the dynamic symmetric key to obtain shared data.
[0036] Optionally, the multiple sub-keys include: multiple obfuscation information and rotation numbers; the rotation number is a dynamically changing positive integer; the generation module is specifically used to: for any fragment information in each fragment information, iterate the fragment information N times through a first preset function to obtain an iterative result of the fragment information; wherein N is determined at least based on the rotation number; any fragment information in each fragment information is the master key and at least one of the multiple obfuscation information; based on the iterative results of each fragment information, generate the dynamic symmetric key.
[0037] Optionally, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one receiver; the receiver is any receiver of the at least one receiver; the data transmission module is also used to: obtain obfuscation information from the initiator; after verifying that the obfuscation information of the initiator is passed, send the obfuscation information of the receiver to the sender; obtain obfuscation information of the at least one receiver from the sender, and after verifying the obfuscation information of the receiver in the obfuscation information of the at least one receiver, determine that the master key and the multiple obfuscation information are successfully agreed upon with the receiver.
[0038] Optionally, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information among the fragment information that contains the key.
[0039] Optionally, the multiple sub-keys include: a key update cycle and a dynamic timestamp; the generation module is specifically used to: in any key update cycle, dynamically iterate according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; generate the dynamic symmetric key of the key update cycle through a second preset function according to the master key and the multiple sub-keys; the master key is the dynamic symmetric key generated in the previous key update cycle or the original static key.
[0040] Optionally, the multiple subkeys also include: an encryption certificate; the encryption certificate is generated by the initiator based on the initial random value, the initial timestamp and the key update cycle; the acquisition module is also used to: obtain the encryption certificate from the initiator; after verifying the encryption certificate, determine that it is agreed with the initiator to generate shared dynamic information in a preset manner.
[0041] Optionally, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; the generation module is also used to: update the transmission count within the cycle; the initial value of the transmission count within the cycle is a preset value; if it is determined that the value of the transmission count within the cycle in the ciphertext data is not the preset value, regenerate the dynamic symmetric key based on the shared dynamic information.
[0042] In a fifth aspect, the present invention provides a computer device, including a program or an instruction, which, when executed, is used to execute the above-mentioned first aspect or second aspect and each optional method.
[0043] In a sixth aspect, the present invention provides a storage medium, including a program or an instruction, which, when executed, is used to execute the above-mentioned first aspect or second aspect and each optional method.
[0044] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 This is a schematic diagram of the structure of the blockchain;
[0047] Figure 2 A flowchart corresponding to a blockchain data sharing method provided by an embodiment of the present invention;
[0048] Figure 3 A schematic diagram of public and private keys of a blockchain in a blockchain data sharing method provided by an embodiment of the present invention;
[0049] Figure 4 A schematic diagram of a process of agreeing to share dynamic information in a preset manner in a blockchain data sharing method provided by an embodiment of the present invention;
[0050] Figure 5 A schematic diagram of the structure of a blockchain data sharing device provided by an embodiment of the present invention;
[0051] Figure 6 A schematic diagram of the structure of another blockchain data sharing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] The definitions of terms appearing in this application are first listed below.
[0054] Hash algorithm: A type of hash algorithm used to generate a summary of a long data. In this article, Hash (x + y) means: concatenate x and y as strings and then call the Hash algorithm to generate the summary.
[0055] Blockchain: Figure 1 As shown in the figure, the blockchain is a chain composed of a series of blocks. In addition to recording the data of the current block, each block also records the hash value of the previous block, forming a chain in this way. There are two core concepts of the blockchain, one is cryptography technology, and the other is the idea of decentralization. Based on these two concepts, the historical information on the blockchain cannot be tampered with. A block consists of a block header and a block body. The block header definition includes the block height h, the hash of the previous block refers to important fields such as prevHash, and the block body mainly stores transaction data.
[0056] When a financial institution (bank, insurance or securities institution) is conducting business (such as bank loan business, deposit business, etc.), one institution needs to store data on the blockchain for another cooperative institution to obtain. If the plain text is directly placed on the blockchain, all institutions can directly see it. Obviously, this requires a reasonable data encryption sharing solution. However, the current encryption sharing method is difficult to balance security and performance. This situation does not meet the needs of banks and other financial institutions, and cannot guarantee the efficient operation of various businesses of financial institutions. For this reason, Figure 2 As shown, an embodiment of the present application provides a blockchain data sharing method.
[0057] Step 201: The initiator generates a dynamic symmetric key according to the shared dynamic information.
[0058] Step 202: The initiator encrypts the shared data according to the dynamic symmetric key to obtain ciphertext data.
[0059] Step 203: The initiator sends the ciphertext data to the blockchain.
[0060] In the method of steps 201 to 203, the shared dynamic information is dynamically updated information agreed upon by the initiator and the receiver in a preset manner; the shared dynamic information includes: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key.
[0061] The blockchain in the method of step 201 to step 203 may be a consortium blockchain composed of multiple organizations. Figure 3 As shown, each organization (that is, each participant, which can be the recipient or the initiator) can generate a pair of public and private keys locally, then connect to the blockchain and upload its own plaintext public key to the chain to ensure that each user can see the public keys of everyone else.
[0062] It should be understood that the method of steps 201 to 203 also has similar steps on the receiving side. After step 203, the receiving side can obtain the ciphertext data from the blockchain, generate the dynamic symmetric key based on the shared dynamic information, and decrypt the ciphertext data based on the dynamic symmetric key to obtain the shared data.
[0063] It should be noted that there are multiple ways to compose the master key and multiple subkeys in the shared dynamic information, and the initiator and the receiver may agree on multiple preset ways to share the dynamic information. Therefore, the methods of step 201 to step 203 may include multiple methods; the following describes the methods of step 203 to step 203 in detail using two methods as examples. The first method is a data sharing method based on obfuscated information and rotation number, and the second method is a data sharing method based on key update cycle and dynamic timestamp.
[0064] In an optional implementation manner (hereinafter referred to as the implementation manner of the fragment information), the multiple subkeys include: multiple obfuscation information and a rotation number; the rotation number is a dynamically changing positive integer; step 201 may be specifically as follows:
[0065] For any piece of information in each piece of information, the initiator iterates the piece of information N times through a first preset function to obtain an iterative result of the piece of information; and generates the dynamic symmetric key according to the iterative result of each piece of information.
[0066] Among them, N is determined at least according to the rotation number; any piece of information in the pieces of information is at least one of the master key and the multiple obfuscation information.
[0067] For example, the master key is M, and there are K obfuscated information: S1, S2, S3...SK. Then any of the fragment information can select at least one item from M and S1~SK. For example, fragment information 1: M, S1; fragment information 2: M, S2; fragment information 3: S1, S2; fragment information 4: M, S2, S3. How to select each fragment information can be based on the set rules. The number of each fragment information can be one or more, which is not limited here.
[0068] The first preset function is iterated N times. For example, the rotation number is N0. N can be N0 or a positive integer determined according to N0, such as N0+1, N0-1 or 2*N0-1, etc. N can also be determined according to the rotation number and specific fragment information. For example, for S1, it is determined that the N corresponding to S1 is N0+1; for S2, it is determined that the N corresponding to S2 is N0+2. The specific corresponding relationship can be set flexibly and is not limited here.
[0069] The first preset function may be a function such as a first preset hash function. When the first preset function is a hash function, the difficulty of cracking the dynamic symmetric key may be further increased due to the irreversibility of the hash function.
[0070] In the above implementation, one implementation method of generating the dynamic symmetric key according to the iteration results of each piece of information may be:
[0071] The cascade result of the hash results of the fragment information is used as the dynamic symmetric key.
[0072] In an implementation manner based on the fragment information, in an optional implementation manner, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one receiver; the initiator agrees on the master key and the multiple obfuscation information with any one of the at least one receiver in the following manner:
[0073] The initiator generates the master key and obfuscation information of the initiator.
[0074] The initiator sends the master key and the obfuscated information of the initiator to the receiver.
[0075] The initiator obtains obfuscation information of the at least one receiver.
[0076] The initiator sends the obfuscated information of the at least one receiver to the receiver.
[0077] After determining that the recipient has verified the obfuscated information of the recipient in the obfuscated information of the at least one recipient, the initiator determines that the master key and the multiple obfuscated information are successfully agreed upon with the recipient.
[0078] The obfuscated information of the receiving party is sent after the receiving party verifies that the obfuscated information of the initiator is passed.
[0079] It should be understood that the receiving side also has a similar interaction process for agreeing on the master key and the multiple obfuscated information, which will not be repeated here.
[0080] It should be noted that the sender and receiver can agree on the number of rotations in the following manner:
[0081] After the rotation number is temporarily generated, the sender can share it with the receiver by uploading it to the blockchain (either plain text or cipher text). The sender can interact with the receiver to agree on an initial rotation number and the update rules of the rotation number.
[0082] In an implementation method based on fragment information, in an optional implementation method, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information in each fragment information that contains the key.
[0083] Specifically, under the above implementation, the participants have: the initiator, receiver 1 and receiver 2. The initiator has the uniquely mapped obfuscated information: obfuscated information 1, receiver 1 has the uniquely mapped obfuscated information: obfuscated information 2, and receiver 2 has the uniquely mapped obfuscated information: obfuscated information 3.
[0084] For example, the master key is M, and there are K obfuscated information: S1, S2, S3...SK. Among the fragment information, there must be a fragment information containing M, there must be a fragment information S1 to SK, and there must be a fragment information containing SK. In other words, the fragment information completely covers the master key and the multiple subkeys, and there is no missing key.
[0085] Based on the above implementation, the data sharing method based on obfuscation information and rotation number is introduced in detail below.
[0086] like Figure 4 As shown in the figure, a scenario in which multiple organizations are a group and negotiate a master key and multiple subkeys based on the public key on the blockchain is used as an example. Without loss of generality, assume that three organizations A, B, and C form a group. Each organization encrypts the data and uploads it to the chain, and shares it with all member organizations in the group through the chain. Assume that organization A is the initiator of the group.
[0087] Step (1): Institution A generates a random string locally as the master key K0, with a self-determined length. The longer the length, the more difficult it is to crack. At the same time, a random string SA is generated as the obfuscated information of Institution A.
[0088] Step (2): Institution A concatenates K0 and SA and serializes them, uses the private key of Institution A to generate a signature for the master key K0, and obtains and uses the public keys of Institution B and Institution C from the blockchain, encrypts the entire string with the signature appended, and generates two sets of asymmetrically encrypted ciphertexts. Institution A sends these two sets of encrypted ciphertexts to Institution B and Institution C in any way.
[0089] Step (3): Institution B and Institution C use their own private keys to decrypt, and then use the public key of Institution A to verify whether the signature is legitimate. If it is legitimate, either Institution B or Institution C reads K0 and SA and stores them in the local database of the institution.
[0090] Step (4): Organization B and Organization C locally generate random character strings SB and SC of each organization respectively as obfuscated information of Organization B and C.
[0091] Step (5): Similar to step (2), organizations B and C each serialize their own obfuscated information, use their own private keys to generate signatures for the serialized strings, and obtain the public key of organization A from the blockchain, to which they append the signature string for encryption. Organizations B and C send their encrypted ciphertexts to organization A in any way.
[0092] Step (6): Similar to step (3), institution A uses the private key to decrypt the ciphertexts from institutions B and C and verify the signatures. If they are legitimate, read the SB and SC and store them in the local database.
[0093] At this point, the group initiator, that is, organization A, has completed the initialization and synchronization of the master key and obfuscation information from organizations B and C, but it still needs to complete the initialization between organizations B and C.
[0094] Step (7): Similar to step (2), organization A concatenates SB and SC and serializes them, generates a signature using the private key of organization A and encrypts them using the public keys of organizations B and C respectively, generates two sets of ciphertexts, and sends them to organizations B and C.
[0095] Step (8): Similar to step (3), institutions B and C use their own private keys to decrypt and institution A's public key to verify the legitimacy. If legal, institutions B and C each compare the received obfuscated information to see if it is consistent with the obfuscated information sent to institution A in step (4); if they are consistent, the obfuscated information of institutions B and C is stored in the local database.
[0096] Step (9): Similar to step (3), organizations B and C return the synchronization completion to organization A. This step can be transmitted with or without encrypted signature.
[0097] After executing steps (1) to (9), selective rotation can be performed, the number of rotations can be agreed upon, the data can be encrypted and decrypted, and uploaded to the blockchain smart contract for decryption by other organizations in the group. The master key and multiple subkeys have been successfully agreed upon. Furthermore, since synchronization has been completed, any organization can encrypt data on the chain. According to the role division of data uploader and data user, how data is uploaded to the chain and how group members decrypt data are introduced. Without loss of generality, we assume that organization A is the data uploader (encryptor, corresponding to the initiator) and organization C is the data user (decryptor, receiver), but the encryptor can also be the receiver and the decryptor can also be the initiator. Data is not restricted to one-way transmission. Any organization that uploads data to the chain can be used by any other organization in the group.
[0098] Table 1 is an example of the on-chain data format:
[0099]
[0100] Table 1
[0101] The data sharing process is as follows:
[0102] SA acts as the data uploader; it randomly generates a positive integer N0 as the rotation number for this data upload.
[0103] SA loads the master key K0 and the organization's obfuscated information SA from the local database.
[0104] SA calculates the dynamic symmetric key KN = Hash1(N0 times Hash1( K0 + SA ) + N0-1 times Hash1(K0 + SA) + Hash1(SB + SC)) for this chain. N0 times Hash1( K0 + SA ) means inputting K0 + SA into Hash1 and iterating N0 times; N0-1 times Hash1(K0 + SA) is similar, and Hash1 is the first preset function.
[0105] More specifically, the steps to generate the KN symmetric key are as follows:
[0106] First, use K0 to concatenate the organization's obfuscated information SA as the original text of Hash1, and iterate Hash1 N-1 times as the first hash result; execute Hash1 on the first hash result as the second hash result; concatenate the first hash result and the second hash result (that is, the cascade result).
[0107] After concatenating the obfuscated information of all other organizations (such as concatenating in alphabetical order), execute Hash1 to obtain the third hash result, and execute Hash1 again on the third hash result, which is KN.
[0108] Use KN to encrypt the shared data and upload the encrypted ciphertext data to the chain. According to the format of Table 1, fill in the rotation number, name of the uploading organization, and other necessary fields (such as transaction index), and write them into the on-chain smart contract as specified in the format of the table above.
[0109] As the user of data, SC obtains the shared data to be decrypted, the rotation number, and the name of the uploading organization from the blockchain smart contract. According to the name of the uploading organization, SA is obtained from the local database.
[0110] Calculate the dynamic symmetric key KN = Hash1(N0 times Hash1( K0 + SA ) + N0-1 times Hash1(K0 + SA) + Hash1(SB + SC)). N0 times Hash1( K0 + SA ) means inputting K0 + SA into Hash1 and iterating N0 times; N0-1 times Hash1(K0 + SA) is similar, and Hash1 is the first preset function.
[0111] Use KN to decrypt the shared data.
[0112] To summarize, in the data sharing method based on obfuscated information and rotation number, in the data encryption process, only the master key and multiple subkeys stored in the organization are used; in the data decryption process, since the master key and multiple subkeys in the group have been pre-synchronized, no additional synchronization process is required, and the process of calculating the dynamic symmetric key is calculated locally in the organization.
[0113] In the data sharing method based on obfuscated information and rotation number, even if the cracking of the dynamic symmetric key can only affect a single transaction, the dynamic symmetric key is different for each transaction. Furthermore, when the dynamic symmetric key is generated by using a hash function, the dynamic symmetric key is generated by two rounds of Hash1, the inner round is the splicing of two adjacent rotation numbers, and the outer round needs to supplement one round of Hash1. Even if the outer round of Hash1 is cracked, the attacker can only get the splicing result of three hash1s. Due to the existence of obfuscated information, at most one unknown obfuscated information is required to solve the value of K0 (mathematical proof omitted). Under the premise that K0 and obfuscated information S are not cracked at the same time, it is impossible to reverse the dynamic symmetric keys of the two times before and after through the number of transactions. Even if K0 is leaked, as long as the obfuscated information S of each institution is not leaked, the entire process is safe. Even if the K0 and salt value S of a single institution are leaked, only the data uploaded by this institution is no longer safe, and it does not affect the data uploaded and decrypted by other institutions.
[0114] The above method is to encrypt data in the application process. The above method borrows the idea of data isolation at the application layer to strengthen the symmetric key encryption mechanism. The two parties exchanging data first store their own public keys on the chain. First, the multiple parties who need to use the blockchain to share data negotiate a common initial random key and an initial encryption salt value for each party through the blockchain. Subsequently, each institution generates a rotation number based on this common initial random key and initial salt value, and rotates the initial key and encryption salt value "rotation number" times as the symmetric key for this transaction. Finally, the institution encrypts the data based on this symmetric key and sends it to the blockchain together with the transaction number. Other institutions can obtain the symmetric key for decryption based on the initiator of the data upload and the transaction number by local calculation alone.
[0115] In an optional implementation manner (hereinafter referred to as a dynamic timestamp implementation manner), the multiple subkeys include: a key update period and a dynamic timestamp; step 201 may be specifically as follows:
[0116] In any key update cycle, the initiator dynamically iterates according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; the initiator generates the dynamic symmetric key of the key update cycle through a second preset function according to the master key and the multiple subkeys; the master key is the dynamic symmetric key generated in the previous key update cycle or the original static key.
[0117] For example, the initial timestamp is T0, the initial test timestamp may also be the current block height, and the key update period is 30s. The second preset function may be a hash function.
[0118] In an optional implementation manner based on the dynamic timestamp, the multiple subkeys further include: an encrypted certificate; before step 201, the following steps may be performed:
[0119] The initiator generates an initial random value.
[0120] The initiator generates the encryption credential according to the initial random value, the initial timestamp and the key update period.
[0121] The initiator generates the original static key according to the initial random value, the initial timestamp, the key update period and the encryption certificate.
[0122] The initiator sends the encrypted credential to the recipient.
[0123] The initiator determines that it is agreed with the recipient to generate shared dynamic information in a preset manner based on the encrypted credential verified by the recipient.
[0124] It should be understood that the above steps also have corresponding similar steps on the receiving side.
[0125] It should be noted that the initiator determines that the recipient will generate the original static key based on the encryption certificate, the initial random value, the initial timestamp and the key update cycle, and determines that the recipient will iteratively update the dynamic timestamp and iteratively update the master key starting from the initial timestamp according to the key update cycle, thereby agreeing on the master key and the multiple sub-keys.
[0126] In an optional implementation manner based on a dynamic timestamp, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; after step 203, the following steps may also be performed:
[0127] The initiator updates the transmission count within the period; the initial value of the transmission count within the period is a preset value; when the value of the transmission count within the period in the ciphertext data is not the preset value, it is used to trigger the receiver to regenerate the dynamic symmetric key based on the shared dynamic information.
[0128] Based on the above implementation, the data sharing method based on the key update cycle and dynamic timestamp is introduced in detail below.
[0129] The initiator generates an initial random value locally, with a self-determined length (the longer the initial random value, the harder it is to crack). The initiator uses the initial random value of the initiator's private key to generate a signature, and uses the public key of the recipient to encrypt the initial random value with the signature appended as a whole according to the key update cycle and the initial test timestamp to generate an encrypted certificate. The key update cycle, such as 30s, means that regardless of whether there is a data exchange operation, the public key will be rotated every 30s; at the same time, a T0 is estimated and set as the initial timestamp, which can be set to a nearby moment. If the initiator and the recipient cannot synchronize the time accurately, the current blockchain block height can be used as an alternative value for the initial timestamp.
[0130] The initiator sends the encrypted certificate to the receiver in any way, for example, through the blockchain. The receiver uses the receiver's private key to decrypt the certificate ciphertext, and then verifies the validity of the signature through the initiator's public key. If the verification is successful, the initial random value is stored.
[0131] The receiver ensures that the service time of both parties is synchronized. After completing the above steps, the receiver replies to the initiator that the synchronization is successful in the same way as the sender.
[0132] Furthermore, the receiver generates the original static key = Hash2 (initial random value + T + Hash2 (serialization of the encryption certificate in Json format) + initial timestamp). Hash2 represents the second preset hash function. A list is maintained with T as the key update period. The table key is "all successfully confirmed data initiators", and the table value is the generated dynamic symmetric key, key update period T, dynamic timestamp, Hash2 (serialization of the encryption certificate in Json format). Among them, the initial value of the rotation timestamp is T0 sent by the data initiator; the Tick item is used for data exchange and is reset to 0 during initialization and each time the symmetric key is updated.
[0133] The periodic task runs continuously as a memory service. Compare the difference between the current time and T0. Once T has passed, recalculate the dynamic symmetric key = Hash (master key + T + Hash (credential serialized in Json format) + dynamic timestamp), update this dynamic symmetric key, and update the dynamic timestamp in the table.
[0134] Table 2 is an example:
[0135]
[0136] Table 2
[0137] Further, the initiator verifies the synchronization success information.
[0138] If the verification is successful, it can be considered that the initial random value has been confirmed by the initiator and the receiver. Then the initiator uses the calculation method and update method of generating dynamic symmetric keys to generate and rotate the dynamic symmetric key locally and maintain the same table content item. According to the above method, the symmetric keys generated locally by the initiator and receiver of the data should be completely consistent; the corresponding values of the table items maintained together should also be completely consistent.
[0139] If the verification fails, or the synchronization information is not received for a long time threshold, the initiator returns to step 1 and restarts the entire process of agreeing to share dynamic information. After the entire process is completed, it can be considered that a trusted encrypted data channel has been negotiated and established between the initiator and the receiver, and the encryption key security is rotated through the key update cycle. After that, the two parties in the exchange can use this channel for two-way data transmission at the same time.
[0140] On this basis, in order to further improve data security within the key update cycle, a transmission count within the cycle (Tick parameter) can also be introduced, which means that within a T, the dynamic symmetric key needs to be updated within the key update cycle after each transmission. This is different from the rotation after the key update cycle expires.
[0141] As the data sender:
[0142] Read the database and obtain the current dynamic symmetric key; use the dynamic symmetric key to encrypt the shared data to be transmitted; read the Tick value of the database and add it to the end of the ciphertext data; send the ciphertext data to the recipient by any means; increase the Tick value by 1.
[0143] As the recipient of the data:
[0144] Read the database to obtain the current dynamic symmetric key; read the Tick value at the end of the ciphertext; if the Tick value is not 0, re-iterate and calculate the dynamic symmetric key of the Tick times = Hash 2 (current symmetric key + T + Hash2 (credential serialized in Json format) + current timestamp) as the dynamic symmetric key; it can be seen that at this time, because the key update cycle rotation is not triggered, the dynamic timestamp remains unchanged; at the same time, the calculation of Tick by the data sender and receiver is completely independent, so it is also decoupled from each other. Use this dynamic symmetric key to decrypt.
[0145] The above-mentioned scheme based on the dynamic timestamp of both parties first negotiates an initial random value at the beginning of data exchange, and then based on this initial random value, the two parties automatically rotate and generate dynamic symmetric keys through the same time slot and frequency of data exchange under the premise of synchronizing dynamic timestamps of both parties, and use this dynamic symmetric key to encrypt and retransmit shared data. On an unreliable channel, each counterparty shares a communication channel and processes shared data based on application layer symmetric encryption and symmetric encryption key rotation, which is a general solution. The design of the present invention takes into account the transaction mode and data characteristics of the blockchain, and designs a symmetric encryption key rotation mechanism suitable for blockchain scenarios.
[0146] It should be noted that the two types of solutions unify efficiency and security. Only symmetric encryption is used in the data exchange process to ensure efficiency. The entire data exchange process does not require reconnecting to the blockchain node or conducting any form of key renegotiation with the counterparty, and all rotation calculations are local. Finally, through multiple keys, the scope of impact once the key is compromised is reduced as much as possible.
[0147] like Figure 5 As shown, the present invention provides a data sharing device of a blockchain, including: a generation module 501, used to generate a dynamic symmetric key according to shared dynamic information; the shared dynamic information is dynamically updated information agreed upon by an initiator and a receiver in a preset manner; the shared dynamic information includes: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key; an encryption module 502, used to encrypt shared data according to the dynamic symmetric key to obtain ciphertext data; a data transmission module 503, used to send the ciphertext data to the blockchain.
[0148] Optionally, the multiple sub-keys include: multiple obfuscation information and a rotation number; the rotation number is a dynamically changing positive integer; the generation module 501 is specifically used to: for any fragment information in each fragment information, iterate the fragment information N times through a first preset function to obtain an iterative result of the fragment information; wherein N is determined at least based on the rotation number; any fragment information in each fragment information is the master key and at least one of the multiple obfuscation information; based on the iterative results of each fragment information, generate the dynamic symmetric key.
[0149] Optionally, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one receiver; the receiver is any one of the at least one receiver; the generation module 501 is also used to: generate the master key and the obfuscation information of the initiator; the data transmission module 503 is also used to: send the master key and the obfuscation information of the initiator to the receiver; obtain the obfuscation information of the at least one receiver; wherein the obfuscation information of the receiver is sent after the receiver verifies that the obfuscation information of the initiator is passed; send the obfuscation information of the at least one receiver to the receiver; after determining that the receiver has verified the obfuscation information of the receiver in the obfuscation information of the at least one receiver, determine that the master key and the multiple obfuscation information are successfully agreed upon with the receiver.
[0150] Optionally, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information among the fragment information that contains the key.
[0151] Optionally, the multiple sub-keys include: a key update cycle and a dynamic timestamp; the generation module 501 is specifically used to: in any key update cycle, dynamically iterate according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; generate the dynamic symmetric key of the key update cycle through a second preset function according to the master key and the multiple sub-keys; the master key is the dynamic symmetric key generated in the previous key update cycle or the original static key.
[0152] Optionally, the multiple subkeys also include: an encryption certificate; the generation module 501 is also used to: generate an initial random value; generate the encryption certificate according to the initial random value, the initial timestamp and the key update period; generate the original static key according to the initial random value, the initial timestamp, the key update period and the encryption certificate; the data transmission module 503 is also used to: send the encryption certificate to the recipient; based on the recipient verifying the encryption certificate, determine and the recipient have agreed to generate shared dynamic information in a preset manner.
[0153] Optionally, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; the generation module 501 is also used to: update the transmission count within the cycle; the initial value of the transmission count within the cycle is a preset value; when the value of the transmission count within the cycle in the ciphertext data is not the preset value, it is used to trigger the recipient to regenerate the dynamic symmetric key according to the shared dynamic information.
[0154] like Figure 6 As shown, the present invention provides a data sharing device of a blockchain, including: a data transmission module 601, used to obtain ciphertext data uploaded by an initiator from the blockchain; a generation module 602, used to generate a dynamic symmetric key according to shared dynamic information; the shared dynamic information is dynamically updated information agreed upon by the initiator and the receiver in a preset manner; the shared dynamic information includes: a master key and multiple subkeys; at least one of the master key and the multiple subkeys is a dynamically updated key; a decryption module 603, used to decrypt the ciphertext data according to the dynamic symmetric key to obtain shared data.
[0155] Optionally, the multiple sub-keys include: multiple obfuscation information and rotation numbers; the rotation number is a dynamically changing positive integer; the generation module 602 is specifically used to: for any fragment information in each fragment information, iterate the fragment information N times through a first preset function to obtain an iterative result of the fragment information; wherein N is determined at least based on the rotation number; any fragment information in each fragment information is the master key and at least one of the multiple obfuscation information; based on the iterative results of each fragment information, generate the dynamic symmetric key.
[0156] Optionally, the multiple obfuscation information includes: obfuscation information of the initiator and obfuscation information of at least one receiver; the receiver is any receiver of the at least one receiver; the data transmission module 601 is also used to: obtain obfuscation information from the initiator; after verifying that the obfuscation information of the initiator is passed, send the obfuscation information of the receiver to the sender; obtain obfuscation information of at least one receiver from the sender, and after verifying the obfuscation information of the receiver in the obfuscation information of the at least one receiver, determine that the master key and the multiple obfuscation information are successfully agreed upon with the receiver.
[0157] Optionally, for any obfuscated information among the multiple obfuscated information, the obfuscated information has a uniquely mapped initiator or receiver; for the master key and any key among the multiple subkeys, there is at least one fragment information among the fragment information that contains the key.
[0158] Optionally, the multiple sub-keys include: a key update cycle and a dynamic timestamp; the generation module 602 is specifically used to: in any key update cycle, dynamically iterate according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; generate the dynamic symmetric key of the key update cycle through a second preset function according to the master key and the multiple sub-keys; the master key is the dynamic symmetric key generated in the previous key update cycle or the original static key.
[0159] Optionally, the multiple subkeys also include: an encryption certificate; the encryption certificate is generated by the initiator based on the initial random value, the initial timestamp and the key update cycle; the acquisition module is also used to: obtain the encryption certificate from the initiator; after verifying the encryption certificate, determine that it is agreed with the initiator to generate shared dynamic information in a preset manner.
[0160] Optionally, the ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; the generation module 602 is also used to: update the transmission count within the cycle; the initial value of the transmission count within the cycle is a preset value; if it is determined that the value of the transmission count within the cycle in the ciphertext data is not the preset value, regenerate the dynamic symmetric key based on the shared dynamic information.
[0161] Based on the same inventive concept, an embodiment of the present invention further provides a computer device, including a program or instructions. When the program or instructions are executed, the blockchain data sharing method and any optional method provided in the embodiment of the present invention are executed.
[0162] Based on the same inventive concept, an embodiment of the present invention also provides a computer-readable storage medium, including a program or instructions. When the program or instructions are executed, the blockchain data sharing method and any optional method provided in the embodiment of the present invention are executed.
[0163] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0164] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks 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.
[0165] 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.
[0166] 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.
[0167] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0168] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A data sharing method of blockchain, characterized in that: include: The initiator generates a dynamic symmetric key based on the shared dynamic information; The shared dynamic information includes: a master key and multiple subkeys; the multiple subkeys include: multiple obfuscation information and a rotation number N; the rotation number N is a dynamically changing positive integer randomly generated by the sender; the multiple obfuscation information includes: the obfuscation information of the initiator and the obfuscation information of the receiver; The initiator agrees with the receiver on the master key and the plurality of obfuscated information in the following manner: The initiator generates a random string locally as the master key, and generates a random string as the obfuscation information of the initiator at the same time; the initiator splices the master key and the obfuscation information together and serializes them, uses the private key of the initiator to generate a signature for the spliced master key, obtains the public key of the recipient from the blockchain and uses the public key of the recipient to encrypt the entire signed string to generate a ciphertext, and the sender sends the ciphertext to the recipient; The initiator stores the obfuscated information of the recipient in a local database, wherein the obfuscated information of the recipient is obtained by the sender using its own private key to decrypt the ciphertext from the recipient and then using the sender's public key to verify the legitimacy of the signature; the ciphertext of the recipient is generated by the recipient generating a random string locally as the obfuscated information of the recipient and serializing the obfuscated information of the recipient, then using the recipient's private key to generate a signature for the serialized string and encrypting the signed serialized string with the sender's public key obtained from the blockchain; The initiator concatenates the obfuscated information of at least two recipients and then serializes the concatenated information, generates a signature using the private key of the initiator, and then encrypts the signature using the public key of the recipient to obtain at least two sets of ciphertexts, and sends the at least two sets of ciphertexts to the recipient; after determining that the recipient has verified the obfuscated information of at least two recipients, the initiator determines that the master key and the multiple obfuscated information are successfully agreed upon with the recipient; The initiator generates the dynamic symmetric key according to the shared dynamic information, including: the sender loads the master key and the obfuscation information of the sender from the local database, and splices the master key and the obfuscation information of the sender as the original text of the first preset hash function, and iterates the first preset hash function for N-1 times on the original text as the first hash result; iterates the first preset hash function for N times on the original text as the second hash result; splices the first hash result and the second hash result together, and executes the first preset hash function after splicing the obfuscation information of other recipients to obtain a third hash result, and executes the first preset hash function again on the spliced first hash result, the second hash result, and the third hash result as a whole, so as to obtain the dynamic symmetric key; The initiator encrypts the shared data according to the dynamic symmetric key to obtain ciphertext data; the initiator sends the ciphertext data to the blockchain.
2. The method according to claim 1, characterized in that The multiple subkeys include: a key update period and a dynamic timestamp; The initiator generates a dynamic symmetric key according to the shared dynamic information, including: In any key update cycle, the initiator dynamically iterates according to the initial timestamp and the key update cycle to obtain the dynamic timestamp; The initiator generates a dynamic symmetric key for the key update period through a second preset function according to the master key and the multiple subkeys; the master key is a dynamic symmetric key generated in a previous key update period or an original static key.
3. The method according to claim 2, characterized in that The multiple subkeys also include: an encryption certificate; before the initiator generates a symmetric dynamic key according to the shared dynamic information, it also includes: The initiator generates an initial random value; The initiator generates the encryption credential according to the initial random value, the initial timestamp and the key update period; The initiator generates the original static key according to the initial random value, the initial timestamp, the key update period and the encryption certificate; The initiator sends the encrypted credential to the recipient; The initiator determines that it is agreed with the recipient to generate shared dynamic information in a preset manner based on the encrypted credential verified by the recipient.
4. The method according to claim 2 or 3, characterized in that The ciphertext data includes a transmission count within a cycle; the transmission count within a cycle is the number of times the initiator uploads data to the blockchain within a single key update cycle; After the initiator sends the ciphertext data to the blockchain, the process further includes: The initiator updates the transmission count within the period; the initial value of the transmission count within the period is a preset value; when the value of the transmission count within the period in the ciphertext data is not the preset value, it is used to trigger the receiver to regenerate the dynamic symmetric key based on the shared dynamic information.
5. A blockchain data sharing method, characterized in that: include: The receiver generates a dynamic symmetric key based on the shared dynamic information; The shared dynamic information includes: a master key and multiple subkeys; the multiple subkeys include: multiple obfuscation information and a rotation number N; the rotation number N is a dynamically changing positive integer randomly generated by the sender; the multiple obfuscation information includes: the obfuscation information of the initiator and the obfuscation information of the receiver; The receiving party agrees with the sending party on the master key and the plurality of obfuscated information in the following manner: The receiving party receives the encrypted ciphertext generated by the initiator, wherein the initiator concatenates the sender's master key and obfuscation information, generates a signature for the concatenated master key using the initiator's private key, and obtains the receiving party's public key from the blockchain to encrypt the signature; the sender's master key is randomly generated locally by the sender, and the sender's obfuscation information is a random string generated locally by the sender; The receiving party uses its own private key to decrypt the encrypted ciphertext, and then uses the public key of the initiator to verify that the signature in the encrypted ciphertext is legal, then reads the sender's master key and obfuscation information, and stores the sender's master key and obfuscation information in a local database; The receiver generates a random string locally as the receiver's obfuscated information, and uses the receiver's private key to generate a signature for the serialized string after serializing the receiver's obfuscated information. The receiver obtains the sender's public key from the blockchain to encrypt the signed serialized string and sends its encrypted ciphertext to the sender. The receiving party receives the ciphertext sent by the sending party, decrypts the ciphertext using its own private key, obtains the public key of the sending party for verification, and if the verification is successful, stores the obfuscated information of the receiving party in the local database and determines that the master key and the multiple obfuscated information have been successfully agreed upon with the initiator. The ciphertext is obtained by the initiator splicing the obfuscated information of multiple receiving parties, generating a signature with the spliced obfuscated information using the private key of the initiator, and encrypting the signature with the public key of the receiving party; The receiving party obtains the ciphertext data uploaded by the initiator from the blockchain; the receiving party decrypts the ciphertext data according to the dynamic symmetric key to obtain the shared data; The receiving party generates a dynamic symmetric key according to the shared dynamic information, including: Obtain the sender's master key and obfuscation information, and concatenate the sender's master key and obfuscation information as the original text of the first preset hash function, iterate the first preset hash function N-1 times on the original text as the first hash result; iterate the first preset hash function N times on the original text as the second hash result; concatenate the first hash result and the second hash result, and execute the first preset hash function after concatenating the recipient's obfuscation information to obtain a third hash result, and execute the first preset hash function again on the concatenated first hash result, the second hash result, and the third hash result as a whole to obtain the dynamic symmetric key.
6. A blockchain data sharing device, characterized in that: include: A generation module, used by the initiator to generate a dynamic symmetric key according to the shared dynamic information; The shared dynamic information includes: a master key and multiple subkeys; the multiple subkeys include: multiple obfuscation information and a rotation number N; the rotation number N is a dynamically changing positive integer randomly generated by the sender; the multiple obfuscation information includes: the obfuscation information of the initiator and the obfuscation information of the receiver; The encryption module is used for the initiator to agree with the receiver on the master key and the multiple obfuscated information in the following manner: The initiator generates a random string locally as the master key, and generates a random string as the obfuscation information of the initiator at the same time; the initiator splices the master key and the obfuscation information together and serializes them, uses the private key of the initiator to generate a signature for the spliced master key, obtains the public key of the recipient from the blockchain and uses the public key of the recipient to encrypt the entire signed string to generate a ciphertext, and the sender sends the ciphertext to the recipient; The initiator stores the obfuscated information of the recipient in a local database, wherein the obfuscated information of the recipient is obtained after the sender uses its own private key to decrypt the ciphertext from the recipient and uses the sender's public key to verify the legitimacy of the signature; the ciphertext of the recipient is generated after the recipient generates a random string locally as the obfuscated information of the recipient and serializes the obfuscated information of the recipient, generates a signature for the serialized string using the recipient's private key, and encrypts the signed serialized string with the sender's public key obtained from the blockchain; The initiator concatenates the obfuscated information of at least two recipients and then serializes the concatenated information, generates a signature using the private key of the initiator, and then encrypts the signature using the public key of the recipient to obtain at least two sets of ciphertexts, and sends the at least two sets of ciphertexts to the recipient; after determining that the recipient has verified the obfuscated information of at least two recipients, the initiator determines that the master key and the multiple obfuscated information are successfully agreed upon with the recipient; The initiator generates the dynamic symmetric key according to the shared dynamic information, including: the sender loads the master key and the obfuscation information of the sender from the local database, and splices the sender's master key and the obfuscation information as the original text of the first preset hash function, and iterates the first preset hash function for N-1 times on the original text as the first hash result; iterates the first preset hash function for N times on the original text as the second hash result; splices the first hash result and the second hash result together, and executes the first preset hash function after splicing the obfuscation information of other recipients to obtain a third hash result, and executes the first preset hash function again on the spliced first hash result, the second hash result, and the third hash result as a whole, so as to obtain the dynamic symmetric key; the initiator encrypts the shared data according to the dynamic symmetric key to obtain ciphertext data; a sending module is used for the initiator to send the ciphertext data to the blockchain.
7. A computer-readable storage medium, characterized in that: The method comprises a program or an instruction. When the program or the instruction is executed, the method according to any one of claims 1 to 4 or 5 is executed.
Citation Information
Patent Citations
Blockchain key sharing and dynamic updating method based on an elliptic curve
CN109768863A