A blockchain-based encrypted data sharing method and device
By generating temporary encryption private keys and public keys in the field of financial technology, encrypting plaintext data, and uploading public keys and encrypted data to the blockchain, the complexity and security risks of data sharing parties when managing large amounts of keys is solved, and efficient and secure data sharing is achieved.
Patent Information
- Application Number
- CN202011475283.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-14
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2040-12-14
AI Technical Summary
In the field of fintech, data sharing parties need to manage a large amount of keys when processing large amounts of data, resulting in increased management complexity and security risks.
By generating temporary encryption private keys and public keys, plaintext data is encrypted and the public keys and encrypted data are uploaded to the blockchain. After the data user obtains plain text data, he uses the public key to encrypt the data and compare it with the encrypted data on the blockchain to verify the authenticity and integrity of the data.
It realizes that when managing large amounts of data, you only need to manage the master and private key, which reduces the complexity and security risks of key management and improves the efficiency and security of data sharing.
Smart Images

Figure CN112487464B_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 method and device for sharing encrypted data based on blockchain. 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. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. Blockchain, as an unalterable database, is often used in the field of financial technology. Data sharers can upload data to the blockchain, and then the blockchain can share data across platforms through distributed ledgers, declaring the credibility and tamper-proofness of the data. When using data, data users request and obtain the original data from the data sharer in a secure manner. After obtaining the original data, the data user compares it with the encrypted data on the chain through the same encryption algorithm to ensure the authenticity of the original data.
[0003] For some data with high confidentiality, considering the easy duplication and spread of electronic data, the data sharing party will first encrypt the data and then upload the encrypted data to the blockchain to prevent the data from being abused. However, for some regular data, there is a risk of being cracked by brute force, such as ID card numbers. In the current method, in order to prevent data from being cracked by brute force, the data encryption party uses different keys to encrypt different data. Although it can avoid the risk of brute force cracking, the data sharing party needs to manage the keys for the encrypted data. When the amount of data is large, a large number of keys need to be managed. Summary of the invention
[0004] The present invention provides a blockchain-based encrypted data sharing method and device, which solves the problem in the prior art that when the amount of data is relatively large, the data sharing party needs to manage a large number of keys.
[0005] In a first aspect, the present invention provides an encrypted data sharing method based on blockchain, comprising: for the i-th plaintext data, according to a first encryption algorithm, obtaining an i-th first-layer encryption value; generating an i-th encryption private key for the i-th plaintext data according to the i-th first-layer encryption value and at least one random salt value; wherein any random salt value is generated at least based on a master private key and the i-th plaintext data; generating an i-th encryption public key according to a third encryption algorithm at least based on the i-th encryption private key; encrypting the i-th plaintext data according to the third encryption algorithm at least based on the i-th encryption public key to obtain the i-th encrypted data; uploading the i-th encryption public key and the i-th encrypted data to the blockchain; the i-th encryption public key is used by the data user to encrypt the i-th plaintext data after obtaining it, and compare it with the i-th encrypted data.
[0006] In the above method, for any i-th plaintext data, the i-th encryption private key of the i-th plaintext data can be generated according to the i-th first-layer encryption value and at least one random salt value, and any random salt value is generated at least according to the master private key and the i-th plaintext data, that is, a master private key can generate at least one random salt value, and then generate the i-th encryption private key for the i-th plaintext data, generate the i-th encryption public key, and encrypt any i-th plaintext data. It only needs to temporarily generate the i-th encryption private key and the i-th encryption public key, and then encrypt the i-th plaintext data to obtain the i-th encrypted data. The data sharing party only needs to save the master private key, and does not need to save the i-th encryption private key. After obtaining the i-th plaintext data, the data provider can encrypt the i-th plaintext data through the i-th encryption public key published on the blockchain. If it is the same as the i-th encrypted data, it proves that the obtained data is indeed the i-th plaintext data declared on the blockchain. Therefore, even when the data sharing party shares a large amount of encrypted data, it only needs to manage the master private key.
[0007] Optionally, the at least one random salt value is m random salt values, where m is an integer greater than 1; and generating the i-th encryption private key of the i-th plaintext data according to the i-th first-layer encryption value and the at least one random salt value includes:
[0008] Obtaining a kth private key fragment according to a kth random salt value among the m random salt values and the ith first-layer encryption value;
[0009] After accumulating m private key shards, the i-th encrypted private key is obtained according to the m private key shards and a preset operation.
[0010] In the above method, each private key shard is obtained after being confused with the i-th first-layer encryption value and the k-th random salt value, and has stronger randomness. Further, according to the m private key shards, the i-th encrypted private key is obtained according to the preset operation, so it is more difficult to be cracked.
[0011] Optionally, the kth private key shard is obtained according to the kth random salt value among the m random salt values and the i-th first-layer encryption value, including: according to the second encryption algorithm, according to the kth random salt value and the i-th first-layer encryption value, the first nested encryption value is obtained; starting from j=1, iteratively executing c-1 times: according to the second encryption algorithm, according to the j-th nested encryption value and the i-th first-layer encryption value, the j+1-th nested encryption value is obtained; thereby obtaining c-1 nested encryption values; c is a positive integer greater than 2; according to the c nested encryption values, according to the preset operation, the kth private key shard is obtained; the c nested encryption values include the c-1 nested encryption values and the first encryption value.
[0012] In the above method, the first nested encryption value is obtained according to the kth random salt value and the i-th first-layer encryption value, and the process is iterated c-1 times to obtain c-1 nested encryption values, and then the kth private key shard is obtained. Therefore, the kth private key shard is more random after being confused and iterated with the kth random salt value for multiple times.
[0013] Optionally, the kth random salt value is obtained in the following manner: generating a kth random number based on the i-th plaintext data, the master private key and the k-th identifier; and obtaining the kth random salt value according to the k-th random value and the first encryption algorithm.
[0014] In the above manner, the kth random number is first generated in combination with the kth identifier, and the kth identifier is further encrypted to generate the kth random number, thereby making the kth random salt value more random.
[0015] Optionally, generating a kth random number according to the i-th plaintext data, the master private key and the k-th identifier includes: obtaining a random intermediate result according to the preset operation according to the i-th plaintext data and the master private key; obtaining a kth random code according to a preset random encoding method according to the k-th identifier; and generating the kth random number according to the random intermediate result and the k-th random code.
[0016] In the above method, after obtaining the random intermediate result, the kth random code is obtained according to the preset random coding method, and is confused with the kth identifier to obtain the kth random number, thereby making the kth random number more concealed.
[0017] Optionally, the preset operation is a preset logical bit operation.
[0018] In the above manner, by selecting a preset logic bit operation as the preset operation, the operation efficiency can be improved.
[0019] Optionally, generating the i-th encrypted public key at least according to the i-th encrypted private key and in accordance with a third encryption algorithm includes:
[0020] Determine the i-th encrypted public key according to the i-th encrypted private key and a generator of an elliptic curve and in accordance with the third encryption algorithm;
[0021] The step of encrypting the i-th plaintext data at least according to the i-th encryption public key and in accordance with the third encryption algorithm to obtain the i-th encrypted data comprises:
[0022] According to the i-th encryption public key, the encrypted random number and the generator, the i-th plaintext data is encrypted according to the third encryption algorithm to obtain the i-th encrypted data.
[0023] After the i-th encryption public key is determined by the generator of the elliptic curve, the i-th plaintext data is encrypted to obtain the i-th encrypted data. During verification, there is no need to disclose the corresponding plaintext of the i-th encrypted data, so the encryption is more confidential.
[0024] In a second aspect, the present invention provides an encrypted data sharing device based on blockchain, comprising: an encryption module, for obtaining an i-th first-layer encryption value according to a first encryption algorithm for an i-th plaintext data; generating an i-th encryption private key for the i-th plaintext data according to the i-th first-layer encryption value and at least one random salt value; wherein any random salt value is generated at least according to a master private key and the i-th plaintext data; generating an i-th encryption public key according to a third encryption algorithm at least according to the i-th encryption private key; encrypting the i-th plaintext data according to the third encryption algorithm at least according to the i-th encryption public key to obtain the i-th encrypted data;
[0025] A data transmission module is used to upload the i-th encryption public key and the i-th encrypted data to the blockchain; the i-th encryption public key is used by the data user to encrypt the i-th plaintext data after obtaining it, and compare it with the i-th encrypted data.
[0026] Optionally, the at least one random salt value is m random salt values, where m is an integer greater than 1; and the encryption module is specifically used for:
[0027] Obtaining a kth private key fragment according to a kth random salt value among the m random salt values and the ith first-layer encryption value;
[0028] After accumulating m private key shards, the i-th encrypted private key is obtained according to the m private key shards and a preset operation.
[0029] Optionally, the encryption module is specifically used to: obtain a first nested encryption value according to the kth random salt value and the ith first-layer encryption value according to the second encryption algorithm;
[0030] Starting from j=1, iterate c-1 times: according to the second encryption algorithm, obtain the j+1th nested encryption value according to the jth nested encryption value and the ith first-layer encryption value; thereby obtaining c-1 nested encryption values; c is a positive integer greater than 2;
[0031] According to the c nested encrypted values, the kth private key fragment is obtained according to the preset operation; the c nested encrypted values include the c-1 nested encrypted values and the first encrypted value.
[0032] Optionally, the encryption module is specifically used for:
[0033] Generate a kth random number according to the i-th plaintext data, the master private key and the k-th identifier;
[0034] According to the kth random value and in accordance with the first encryption algorithm, the kth random salt value is obtained.
[0035] Optionally, the encryption module is specifically used to: obtain a random intermediate result according to the i-th plaintext data and the master private key according to the preset operation;
[0036] According to the kth identifier, a kth random code is obtained according to a preset random coding method;
[0037] The kth random number is generated according to the random intermediate result and the kth random code.
[0038] Optionally, the preset operation is a preset logical bit operation.
[0039] Optionally, the encryption module is specifically used to: determine the i-th encryption public key according to the i-th encryption private key and the generator of the elliptic curve in accordance with the third encryption algorithm; encrypt the i-th plaintext data according to the i-th encryption public key, the encrypted random number and the generator in accordance with the third encryption algorithm to obtain the i-th encrypted data.
[0040] The beneficial effects of the above-mentioned second aspect and each optional device 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.
[0041] In a third 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 and each optional method of the first aspect.
[0042] In a fourth 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 and each optional method of the first aspect.
[0043] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] 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.
[0045] Figure 1 A schematic diagram of a specific process flow corresponding to a blockchain-based encrypted data sharing method provided in an embodiment of the present invention;
[0046] Figure 2 A specific flow chart corresponding to a blockchain-based encrypted data sharing method provided in an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of generating the kth private key shard in a blockchain-based encrypted data sharing method provided in an embodiment of the present invention;
[0048] Figure 4 A schematic diagram of the structure of a blockchain-based encrypted data sharing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] 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.
[0050] The following first describes the nouns that appear in the embodiments of the present application.
[0051] Blockchain: A new distributed infrastructure and computing method that uses block chain data structures to verify and store data, distributed node consensus algorithms to generate and update data, cryptography to ensure the security of data transmission and access, and smart contracts composed of automated script codes to program and operate data.
[0052] Public key system: keys are generated in pairs, each pair of keys consists of a public key and a private key. In practical applications, the private key is kept by the owner, while the public key needs to be made public.
[0053] Private key: The private key is the unique credential of a blockchain account and is used to sign transactions.
[0054] Asymmetric encryption: Asymmetric encryption algorithms require two keys: a public key (publickey: referred to as the public key) and a private key (privatekey: referred to as the private key). The public key and the private key are a pair. If the public key is used to encrypt data, it can only be decrypted with the corresponding private key.
[0055] Hash algorithm: also known as hash or hash algorithm, is a family of cryptographic hash functions that can calculate a fixed-length string (also known as a message digest) corresponding to a digital message.
[0056] HMAC algorithm: HMAC is a key-related hash operation message authentication code (Hash-based Message Authentication Code). The HMAC operation uses a hash algorithm, takes a key and a message as input, and generates a message digest as output.
[0057] When a financial institution (banking institution, insurance institution or securities institution) is conducting business (such as bank loan business, deposit business, etc.), the data sharer can upload the data to the blockchain, and then the blockchain can share data across platforms through a distributed ledger. The data sharer will first encrypt the data, and then upload the encrypted data to the blockchain to prevent the data from being abused. However, for some regular data, there is a risk of brute force cracking. If the data encryption party uses different keys to encrypt it, although the risk of brute force cracking can be avoided, the data sharer needs to manage the keys for the encrypted data. When the amount of data is relatively large, a large number of keys need to be managed. 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. If Figure 1 As shown, the present application provides an encrypted data sharing method based on blockchain.
[0058] Step 101: For the i-th plaintext data, obtain the i-th first-layer encryption value according to the first encryption algorithm.
[0059] Step 102: Generate an i-th encryption private key for the i-th plaintext data according to the i-th first-layer encryption value and at least one random salt value.
[0060] Wherein, any random salt value is generated based on at least the master private key and the i-th plaintext data.
[0061] Step 103: Generate an i-th encryption public key at least based on the i-th encryption private key and in accordance with a third encryption algorithm.
[0062] Step 104: Encrypt the i-th plaintext data at least according to the i-th encryption public key and in accordance with the third encryption algorithm to obtain the i-th encrypted data.
[0063] Step 105: Upload the i-th encrypted public key and the i-th encrypted data to the blockchain.
[0064] The i-th encryption public key is used by the data user to encrypt the i-th plaintext data after obtaining it, and compare it with the i-th encrypted data.
[0065] It should be noted that the method of steps 101 to 105 above proposes a method for sharing encrypted data based on blockchain. In the method of steps 101 to 105, the first encryption algorithm is an irreversible algorithm by default, that is, the algorithm for reversing the i-th plaintext data cannot be used through the i-th first-layer encryption value, such as a hash algorithm. The random salt value is random obfuscation information generated according to certain rules, which is used to increase the randomness of data encryption. It should be noted that there are many ways to generate the random salt value, such as generating it based on a random number, a master private key and the i-th plaintext data, and some other random information or preset information can also be added.
[0066] In the method of steps 101 to 105, the master private key can be generated by any publicly available private key generation algorithm, and then for each piece of plaintext data, a random salt value of the plaintext data can be generated based on at least the encrypted data and the master private key, and then a sub-private key of the plaintext data is generated, and the plaintext data is encrypted with the sub-private key, so that the data sharing party only needs to manage the master private key even when sharing a large amount of encrypted data.
[0067] For example, the plaintext data set to be encrypted is D = {d1,...,d i ,...,d n}, D includes n plain text data, i, n are positive integers, where d i is the i-th plaintext data, then the i-th encryption public key K i It can be uploaded to the chain. The data provider does not need to store the encrypted private key of the i-th plaintext data, but only needs to store the master private key.
[0068] It should be noted that there are many ways to obtain the i-th encryption private key, such as directly using the encryption result of the i-th first-layer encryption value and at least one random salt value as the i-th encryption private key of the i-th plaintext data according to the preset encryption algorithm, or first calculating the i-th intermediate private key based on the encryption result of the i-th first-layer encryption value and at least one random salt value, and then encrypting the i-th intermediate private key to obtain the i-th encryption private key, which is not limited here. In addition, in addition to the i-th first-layer encryption value and at least one random salt value, other information can also be added to generate the i-th encryption private key of the i-th plaintext data.
[0069] In an optional implementation manner, the at least one random salt value is m random salt values, where m is an integer greater than 1; step 102 may specifically be:
[0070] Step 1021: Obtain a kth private key fragment according to the kth random salt value among the m random salt values and the i-th first-layer encryption value.
[0071] Step 1022: After accumulating m private key shards, obtain the i-th encrypted private key according to the m private key shards and the preset operation.
[0072] For example, the m random salt values include: a first random salt value, a second random salt value, ..., an mth random salt value.
[0073] Furthermore, the first private key shard can be obtained based on the first random salt value and the first first-layer encryption value; the second private key shard can be obtained based on the second random salt value and the second first-layer encryption value; and so on, the mth private key shard can be obtained based on the mth random salt value and the mth first-layer encryption value.
[0074] Then the m private key shards include: the first private key shard, the second private key shard, ..., the mth private key shard. Then, according to the preset calculation, the i-th encrypted private key is obtained.
[0075] In an optional implementation, the preset operation is a preset logic bit operation.
[0076] For example, the logic bit operation is preset to be an XOR operation, thereby improving the operation efficiency.
[0077] In an optional implementation manner, step 1021 may specifically be:
[0078] Step (1021-1): According to the second encryption algorithm, the first nested encryption value is obtained based on the kth random salt value and the i-th first-layer encryption value.
[0079] Step (1021-2): Starting from j=1, iterate c-1 times: according to the second encryption algorithm, obtain the j+1th nested encryption value based on the jth nested encryption value and the i-th first-layer encryption value; thereby obtaining c-1 nested encryption values.
[0080] c is a positive integer greater than 2.
[0081] Step (1021-3): Based on the c nested encryption values, according to the preset operation, obtain the kth private key fragment; the c nested encryption values include the c-1 nested encryption values and the first encryption value.
[0082] It should be noted that in step (1021-2), starting from the second nested encrypted value, each nested encrypted value is generated by the previous nested encrypted value and the i-th first-layer encryption value, so that c-1 nested encrypted values are obtained through multiple layers of iteration, which increases the difficulty of cracking.
[0083] Furthermore, based on the c nested encryption values, according to the preset operation, the k-th private key shard is obtained, so that the k-th private key shard is more random.
[0084] In an optional implementation manner, the kth random salt value is obtained specifically in the following manner:
[0085] Generate a kth random number according to the i-th plaintext data, the master private key and the k-th identifier; and obtain the k-th random salt value according to the k-th random value and the first encryption algorithm.
[0086] For example, the kth identifier is a function about k and can be associated with k. Combined with the random generation algorithm, the kth random number can be obtained, and further according to the first encryption algorithm, the kth random salt value can be obtained, so the kth random salt value is more difficult to crack.
[0087] More specifically, the kth random value can be obtained in the following manner:
[0088] According to the i-th plaintext data and the master private key, a random intermediate result is obtained according to the preset operation; according to the k-th identifier, a k-th random code is obtained according to a preset random encoding method; according to the random intermediate result and the k-th random code, the k-th random number is generated.
[0089] In the above method, after obtaining the random intermediate result, the randomness can be further enhanced by presetting the random encoding method, such as presetting the random encoding method as big byte encoding.
[0090] In an optional implementation manner, step 103 may specifically be:
[0091] Determine the i-th encrypted public key according to the i-th encrypted private key and the generator of the elliptic curve, in accordance with the third encryption algorithm.
[0092] Step 104 may specifically be:
[0093] Encrypt the i-th plaintext data according to the i-th encrypted public key, the encryption random number, and the generator, in accordance with the third encryption algorithm, to obtain the i-th encrypted data.
[0094] After determining the i-th encrypted public key through the generator of the elliptic curve and encrypting the i-th plaintext data to obtain the i-th encrypted data, the corresponding plaintext of the i-th encrypted data does not need to be disclosed during verification, so the concealment after encryption is stronger.
[0095] Next, in combination with Figure 2 , a blockchain-based encrypted data sharing method provided by the present application will be described in detail.
[0096] Step (1): Generate a master private key using any publicly available private key generation algorithm, denoted as the master private key MK, which is kept by the data provider.
[0097] Step (2): Considering the security of the encrypted private key and to avoid brute force cracking due to a small isomorphic data sample library, the data provider needs to customize the length (ckLen) of the i-th encrypted private key for the i-th plaintext data. The sub-private key of the i-th encrypted private key is generally an integer multiple of 256 bits. If the length of the sub-private key generated at one time does not meet the specified private key length, it needs to be generated multiple times and concatenated. Therefore, first, the number of shards m of the encrypted private key needs to be calculated as follows.
[0098]
[0099] Step (3): For each private key shard, such as the k-th private key shard, generate a k-th random number R according to the i-th data plaintext, the master private key MK, and the k-th identifier (subscript k) of the encrypted private key shard k , where 0 < k ≤ m, and the generation method is to perform an exclusive OR operation on the master private key and the data plaintext, and concatenate the 32-bit integer k value encoded in big endian, as shown below.
[0100] R k = MK ^ d i || INT_32_BE(k);
[0101] In the present application, || represents concatenation.
[0102] Step (4): Calculate the k-th random salt value according to the k-th random number R k to prevent reverse lookup methods and rainbow table attacks on the encrypted private key shards.
[0103] 盐 k = SHA256(R k ); SHA256表示SHA256哈希算法;
[0104] Step (5): Calculate the first HMAC_SHA_256 value using the k-th random salt value and the master private key. When k equals 1, it is as follows. When adding a random salt value in the HMAC and SHA calculations, the possibility of brute-force attacks can be reduced. However, due to the extremely fast operation of HASH, it is still not possible to guarantee that it cannot be cracked on super hardware devices (such as GPUs). Therefore, the following can increase randomness by performing Step (6).
[0105] HMAC1 = HMAC_SHA_256(SHA_256(MK) + Salt k );
[0106] Step (6): Through the iteration factor, perform multiple forward iterations to reduce the speed of reverse calculation. The method is to continuously iterate the HMAC_SHA_256 value multiple times to increase the difficulty of being cracked. Each iteration is denoted as HMAC j , where 0 < j < c, c is the number of iterations, and the number of iterations can be set, such as more than 10,000 times. The random salt value of HMAC j is the HMAC_SHA_256 value obtained from the previous calculation, that is, HMAC j-1 . As Figure 3 shown.
[0107] HMAC j = HMAC_SHA_256(SHA_256(MK) + HMAC j-1 ), 1 < j < c;
[0108] Step (7): Perform an exclusive OR operation of " ^ " on all HMACs to calculate the encrypted private key shard S m , as follows.
[0109] S K = HMAC1 ^ HMAC2 ^... ^ HMAC c ;
[0110] Step (8): According to the number of private key shards, loop through Steps (3) to (7) to generate the other m - 1 private key shards, and splice the m private key shards to generate the encrypted private key of the d i th data.
[0111] CK i = S1 || S2 ||... || S m ;
[0112] Step (9): Take a public elliptic curve, select a public point G as the generator, and calculate the public key K corresponding to the i-th encrypted private key. i :
[0113] K i =CK i *G;
[0114] Step (10): Select a random number r and perform a random operation on the i-th plaintext data d i The i-th encrypted data C is generated by encrypting with the corresponding i-th encryption public key i :
[0115] C i ={rG,d i +rK i};
[0116] Step (11): Set {K i ,C i} information on the chain, making it easier to decrypt the data and verify its correctness.
[0117] like Figure 4 As shown, the present invention provides an encrypted data sharing device based on blockchain, including: an encryption module 401, used for obtaining an i-th first-layer encryption value according to a first encryption algorithm for the i-th plaintext data; generating an i-th encryption private key for the i-th plaintext data according to the i-th first-layer encryption value and at least one random salt value; wherein any random salt value is generated at least according to a master private key and the i-th plaintext data; generating an i-th encryption public key according to a third encryption algorithm at least according to the i-th encryption private key; encrypting the i-th plaintext data according to the third encryption algorithm at least according to the i-th encryption public key to obtain the i-th encrypted data;
[0118] The data transmission module 402 is used to upload the i-th encryption public key and the i-th encrypted data to the blockchain; the i-th encryption public key is used by the data user to encrypt the i-th plaintext data after obtaining it, and compare it with the i-th encrypted data.
[0119] Optionally, the at least one random salt value is m random salt values, where m is an integer greater than 1; and the encryption module 401 is specifically used for:
[0120] Obtaining a kth private key fragment according to a kth random salt value among the m random salt values and the ith first-layer encryption value;
[0121] After accumulating m private key shards, the i-th encrypted private key is obtained according to the m private key shards and a preset operation.
[0122] Optionally, the encryption module 401 is specifically used to: obtain a first nested encryption value according to the kth random salt value and the ith first-layer encryption value according to the second encryption algorithm;
[0123] Starting from j=1, iterate c-1 times: according to the second encryption algorithm, obtain the j+1th nested encryption value according to the jth nested encryption value and the ith first-layer encryption value; thereby obtaining c-1 nested encryption values; c is a positive integer greater than 2;
[0124] According to the c nested encrypted values, the kth private key fragment is obtained according to the preset operation; the c nested encrypted values include the c-1 nested encrypted values and the first encrypted value.
[0125] Optionally, the encryption module 401 is specifically used for:
[0126] Generate a kth random number according to the i-th plaintext data, the master private key and the k-th identifier;
[0127] According to the kth random value and in accordance with the first encryption algorithm, the kth random salt value is obtained.
[0128] Optionally, the encryption module 401 is specifically used to: obtain a random intermediate result according to the i-th plaintext data and the master private key according to the preset operation;
[0129] According to the kth identifier, a kth random code is obtained according to a preset random coding method;
[0130] The kth random number is generated according to the random intermediate result and the kth random code.
[0131] Optionally, the preset operation is a preset logical bit operation.
[0132] Optionally, the encryption module 401 is specifically used to: determine the i-th encryption public key according to the i-th encryption private key and the generator of the elliptic curve according to the third encryption algorithm; encrypt the i-th plaintext data according to the i-th encryption public key, the encrypted random number and the generator according to the third encryption algorithm to obtain the i-th encrypted data.
[0133] Based on the same inventive concept, an embodiment of the present invention also provides a computer device, including a program or instructions. When the program or instructions are executed, the blockchain-based encrypted data sharing method and any optional method provided in the embodiment of the present invention are executed.
[0134] 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-based encrypted data sharing method and any optional method provided in the embodiment of the present invention are executed.
[0135] 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.
[0136] 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 blockchain-based encrypted data sharing method, characterized in that: include: For the i-th plaintext data, obtain the i-th first-layer encryption value according to the first encryption algorithm; Obtaining a first nested encrypted value according to the kth random salt value and the ith first-layer encrypted value according to the second encryption algorithm; The number of random salt values is m, where m is an integer greater than 1; Starting from j=1, iterate c-1 times: according to the second encryption algorithm, obtain the j+1th nested encryption value according to the jth nested encryption value and the ith first-layer encryption value; Thus, c-1 nested encrypted values are obtained; c is a positive integer greater than 2; According to the c nested encrypted values, according to the preset operation, the kth private key fragment is obtained; the c nested encrypted values include c-1 nested encrypted values and the first nested encrypted value; After accumulating m private key shards, obtain the i-th encrypted private key according to the m private key shards and the preset operation; wherein any random salt value is generated according to at least the master private key and the i-th plaintext data; generating an i-th encrypted public key according to at least the i-th encrypted private key and a third encryption algorithm; At least according to the i-th encryption public key and in accordance with the third encryption algorithm, encrypt the i-th plaintext data to obtain the i-th encrypted data; The i-th encrypted public key and the i-th encrypted data are uploaded to the blockchain; the i-th encrypted public key is used by the data user to encrypt the i-th plaintext data after obtaining it, and compare it with the i-th encrypted data.
2. The method according to claim 1, characterized in that The kth random salt value is obtained in the following manner: Generate a kth random number according to the i-th plaintext data, the master private key and the k-th identifier; According to the kth random value and in accordance with the first encryption algorithm, the kth random salt value is obtained.
3. The method according to claim 2, characterized in that The step of generating a kth random number according to the i-th plaintext data, the master private key and the k-th identifier comprises: According to the i-th plaintext data and the master private key, a random intermediate result is obtained according to the preset operation; According to the kth identifier, a kth random code is obtained according to a preset random coding method; The kth random number is generated according to the random intermediate result and the kth random code.
4. The method according to claim 1, characterized in that The preset operation is a preset logic bit operation.
5. The method according to any one of claims 1 to 4, characterized in that: The step of generating the i-th encrypted public key at least according to the i-th encrypted private key and in accordance with a third encryption algorithm comprises: Determine the i-th encrypted public key according to the i-th encrypted private key and a generator of an elliptic curve and in accordance with the third encryption algorithm; The step of encrypting the i-th plaintext data at least according to the i-th encryption public key and in accordance with the third encryption algorithm to obtain the i-th encrypted data comprises: According to the i-th encryption public key, the encrypted random number and the generator, the i-th plaintext data is encrypted according to the third encryption algorithm to obtain the i-th encrypted data.
6. A blockchain-based encrypted data sharing device, characterized in that: include: An encryption module, for obtaining an i-th first-layer encryption value according to a first encryption algorithm for the i-th plaintext data; Obtaining a first nested encrypted value according to the kth random salt value and the ith first-layer encrypted value according to the second encryption algorithm; The number of random salt values is m, where m is an integer greater than 1; Starting from j=1, iterate c-1 times: according to the second encryption algorithm, obtain the j+1th nested encryption value according to the jth nested encryption value and the ith first-layer encryption value; Thus, c-1 nested encrypted values are obtained; c is a positive integer greater than 2; According to the c nested encrypted values, according to the preset operation, the kth private key fragment is obtained; the c nested encrypted values include c-1 nested encrypted values and the first nested encrypted value; After accumulating m private key shards, according to the m private key shards, according to the preset operation, obtain the i-th encrypted private key; wherein any random salt value is generated at least according to the master private key and the i-th plaintext data; at least according to the i-th encrypted private key, according to the third encryption algorithm, generate the i-th encrypted public key; at least according to the i-th encrypted public key, according to the third encryption algorithm, encrypt the i-th plaintext data to obtain the i-th encrypted data; A data transmission module is used to upload the i-th encryption public key and the i-th encrypted data to the blockchain; the i-th encryption public key is used by the data user to encrypt the i-th plaintext data after obtaining it, and compare it with the i-th encrypted data.
7. A computer device, 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 5 is performed.
8. 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 5 is performed.
Citation Information
Patent Citations
Block chain based electronic copyright protection method
CN106250721A
Digital asset private key storage and extraction method and device
CN111192050A