Block chain data sharing encryption and decryption method and device, and storage medium
By encrypting and formatting the blockchain data, and combining it with the time verification mechanism, the problem of data encryption vulnerability in the existing technology is solved, significantly improving the security of data decryption.
Patent Information
- Application Number
- CN202411751352.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, blockchain data is easily subject to brute-force cracking and other attack methods after encryption, or the secret key is lost or leaked due to human reasons, resulting in the leakage of encrypted data, which poses a security risk.
The stored data is encrypted using encryption algorithms and converted and stored on the blockchain through format. Verify the correctness of the key through preset verification methods, and introduce a time verification mechanism to generate a preset time threshold through the historical verification time set, compare the verification time, and ensure that the decryption operation is completed within a reasonable time range.
Effectively prevent brute-force cracking, replay attacks or illegal data access, improve the security of data decryption, and reduce the security risks brought by secret key leakage.
Smart Images

Figure CN119670122A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain data processing, and in particular to a blockchain data sharing encryption and decryption method, device and storage medium. Background Art
[0002] With the development of blockchain technology, more and more data is stored and transmitted to blockchain networks. However, the security and privacy of blockchain data have also become the focus of attention. At present, there are some encryption and decryption methods on the market, but there are certain security risks such as threats from brute force attacks or human-caused loss of secret keys, which may lead to the leakage of encrypted data. Summary of the invention
[0003] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a blockchain data sharing encryption and decryption method, device and storage medium. The present invention solves the problem that the encrypted data in the prior art is easily threatened by attacks such as brute force cracking, or the encrypted data is leaked due to the loss and leakage of secret keys caused by human factors, which poses certain security risks.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] A blockchain data sharing encryption and decryption method, comprising:
[0006] Encrypt the data to be stored by using an encryption algorithm to obtain encrypted data;
[0007] Performing format conversion on the encrypted data to obtain received data;
[0008] Determine a storage blockchain, and store the accepted data on the corresponding blockchain to obtain storage data;
[0009] Verify the correctness of the secret key through a preset verification method to obtain a first verification result;
[0010] Determine whether it is within a preset time zone, and if so, calculate the verification time required to obtain the first verification result and compare the verification time with a preset time threshold to obtain a comparison result;
[0011] Verifying the difference of the comparison result to obtain a second verification result;
[0012] If both the first verification result and the second verification result are passed, the stored data is decrypted to obtain decrypted data.
[0013] Preferably, the encryption algorithm is a symmetric encryption algorithm or an asymmetric encryption algorithm.
[0014] Preferably, the step of converting the format of the encrypted data to obtain the received data includes:
[0015] Adding data identification information to the encrypted data to obtain identification data;
[0016] Adding the identification information to the encrypted key information to obtain the key data;
[0017] The secret key data is encapsulated to obtain the accepted data.
[0018] Preferably, the preset verification method includes:
[0019] Hash verification, digital signature verification, public key encryption verification, and key exchange protocol verification.
[0020] Preferably, the determination of whether it is within a preset time zone, if so, calculating the verification time required to obtain the first verification result and comparing the verification time with a preset time threshold to obtain a comparison result, includes:
[0021] Determine the preset time zone based on data sharing requirements;
[0022] Calculate the historical verification time set within the preset time zone;
[0023] Generate a preset time threshold according to the historical verification time set;
[0024] The verification time required for the current first verification result is compared with the preset time threshold to obtain a comparison result.
[0025] A device comprising:
[0026] A processor; and a memory for storing a blockchain data sharing encryption and decryption program of the processor.
[0027] A storage medium on which blockchain data sharing encryption and decryption programs are stored.
[0028] The present invention discloses the following technical effects:
[0029] The present invention provides a blockchain data sharing encryption and decryption method, including: using an encryption algorithm to encrypt data to be stored to obtain encrypted data; converting the format of the encrypted data to obtain received data; determining a storage blockchain, storing the received data on the corresponding blockchain, and obtaining storage data; verifying the correctness of the secret key by a preset verification method to obtain a first verification result; judging whether it is within a preset time zone, if so, calculating the verification time required for the first verification result and comparing the verification time with a preset time threshold to obtain a comparison result; verifying the difference of the comparison result to obtain a second verification result; if both the first verification result and the second verification result are passed, decrypting the stored data to obtain decrypted data. The present invention introduces a time verification mechanism. In a preset time zone, when data is decrypted, it is necessary to perform another verification according to the verification time after the first verification passes. Combining historical data, it is determined whether this verification can pass according to the verification time. This time verification mechanism can effectively prevent some common attacks, such as brute force cracking, replay attacks or illegal data access, and greatly improves the security of data decryption. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments 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.
[0031] Figure 1 A flowchart of a blockchain data sharing encryption and decryption method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0034] like Figure 1 As shown, the present invention provides a blockchain data sharing encryption and decryption method, comprising:
[0035] Step 100: Encrypt the data to be stored using an encryption algorithm to obtain encrypted data;
[0036] Step 200: converting the format of the encrypted data to obtain received data;
[0037] Step 300: Determine a storage blockchain, store the accepted data in the corresponding blockchain, and obtain storage data;
[0038] Step 400: Verify the correctness of the secret key by a preset verification method to obtain a first verification result;
[0039] Step 500: Determine whether it is within a preset time zone. If so, calculate the verification time required to obtain the first verification result and compare the verification time with a preset time threshold to obtain a comparison result.
[0040] Step 600: verifying the difference of the comparison result to obtain a second verification result;
[0041] Step 700: If both the first verification result and the second verification result are passed, the stored data is decrypted to obtain decrypted data.
[0042] Specifically, the time comparison of the authentication phase: after the authentication is passed, the time of this authentication is compared with the time of the previous authentications. If the authentication time exceeds the preset threshold, it is considered as an authentication failure. This helps detect possible malicious attempts or unauthorized access. This mechanism can add additional security to the authentication process.
[0043] More specifically, time verification during data decryption: During the data decryption process, particularly important data can be set up with multiple verification modes. For example, users are required to perform at least 3 time verifications before decryption. The time of each verification will be compared with the preset time requirement to ensure that the decryption operation is completed within a reasonable time frame. If the verification time does not meet expectations, it can be considered a decryption failure or access denial.
[0044] Furthermore, the encryption algorithm is a symmetric encryption algorithm or an asymmetric encryption algorithm.
[0045] Specifically, a key is generated according to the selected encryption algorithm. A symmetric encryption algorithm requires generating a key, while an asymmetric encryption algorithm requires generating a pair of public and private keys. The generated key is used to perform encryption operations on the data to be encrypted to obtain the encrypted data.
[0046] Furthermore, the format conversion of the encrypted data to obtain received data includes:
[0047] Adding data identification information to the encrypted data to obtain identification data;
[0048] Adding the identification information to the encrypted key information to obtain the key data;
[0049] The secret key data is encapsulated to obtain the accepted data.
[0050] Specifically, determine the source data format and the target data format: First, you need to clarify the format of the source data and the target data format that needs to be converted, such as converting a text file to JSON format.
[0051] Parse source data: Parse the source data according to the source data format and extract the required data fields and structures.
[0052] Perform data format conversion: According to the requirements of the target data format, the extracted data is reorganized, reconstructed or converted to conform to the specifications and structure of the target data format.
[0053] Format data: Format the converted data according to the specifications of the target data format to ensure the correctness and integrity of the data.
[0054] Generate target data: Generate target data from formatted data, that is, data that conforms to the target data format.
[0055] Verify conversion results: Verify the generated target data to ensure that the format conversion process does not lose or incorrectly convert data and that it meets the requirements of the target data format.
[0056] Furthermore, the preset verification method includes:
[0057] Hash verification, digital signature verification, public key encryption verification, and key exchange protocol verification.
[0058] Specifically, hash verification is used to confirm data integrity. The sender generates a hash value for the data and sends it to the receiver along with the data. The receiver calculates the hash value of the received data again and compares it with the hash value provided by the sender to verify the integrity of the data; digital signature verification is applied to ensure data authenticity. The sender signs the data with a private key and sends the data and digital signature to the receiver. The receiver verifies the digital signature using the sender's public key to confirm the authenticity of the data; the sender encrypts the data using the receiver's public key to ensure that only the receiver can decrypt the data; the key exchange protocol ensures that a secure channel is established between the communicating parties to ensure that the data is effectively encrypted and protected during transmission and storage. The above verification process is all carried out on a real platform, simulating the data verification process in different scenarios and recording the verification time.
[0059] Further, the determination is whether it is within a preset time zone, and if so, the verification time required to obtain the first verification result is calculated and the verification time is compared with a preset time threshold to obtain a comparison result, including:
[0060] Determine the preset time zone based on data sharing requirements;
[0061] Calculate the historical verification time set within the preset time zone;
[0062] Generate a preset time threshold according to the historical verification time set;
[0063] The verification time required for the current first verification result is compared with the preset time threshold to obtain a comparison result.
[0064] Specifically, the user makes a one-time setting in the system to determine the time to open and close the time verification. Once the setting is completed, the closing setting in the time verification mechanism cannot be changed again. If the user does not need to access data frequently, the interval that does not require time verification can be closed, that is, the time verification mechanism can be permanently turned on.
[0065] In this embodiment, the setting of the time mechanism interval depends on the user's high-frequency usage interval. For example, the high-frequency data access time is from 8 to 9 pm every day. In order to improve the user's efficiency and experience, the second time verification is closed, and time verification is required at the rest of the time. A comprehensive evaluation of multiple time verifications is set according to the importance of the data. When the user does not need to use the data frequently, time verification is required throughout the day, and the time verification mechanism is a one-time setting to prevent illegal behavior and malicious closure of the current verification.
[0066] More specifically, in order to prevent unexpected situations, the system can provide safety backup measures, such as setting up an emergency recovery function to allow users to request the system administrator to restore operations under certain conditions.
[0067] This embodiment also provides a device, including:
[0068] A processor; and a memory for storing a blockchain data sharing encryption and decryption program of the processor.
[0069] This embodiment further provides a storage medium on which blockchain data sharing encryption and decryption programs are stored.
[0070] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0071] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A blockchain data sharing encryption and decryption method, characterized in that: include: Encrypt the data to be stored by using an encryption algorithm to obtain encrypted data; Performing format conversion on the encrypted data to obtain received data; Determine a storage blockchain, and store the accepted data on the corresponding blockchain to obtain storage data; Verify the correctness of the secret key through a preset verification method to obtain a first verification result; Determine whether it is within a preset time zone, and if so, calculate the verification time required to obtain the first verification result and compare the verification time with a preset time threshold to obtain a comparison result; Verifying the difference of the comparison result to obtain a second verification result; If both the first verification result and the second verification result are passed, the stored data is decrypted to obtain decrypted data.
2. A blockchain data sharing encryption and decryption method according to claim 1, characterized in that: The encryption algorithm is a symmetric encryption algorithm or an asymmetric encryption algorithm.
3. A blockchain data sharing encryption and decryption method according to claim 1, characterized in that: The step of converting the format of the encrypted data to obtain received data includes: Adding data identification information to the encrypted data to obtain identification data; Adding the identification information to the encrypted key information to obtain the key data; The secret key data is encapsulated to obtain the accepted data.
4. A blockchain data sharing encryption and decryption method according to claim 1, characterized in that: The preset verification methods include: Hash verification, digital signature verification, public key encryption verification, and key exchange protocol verification.
5. A blockchain data sharing encryption and decryption method according to claim 1, characterized in that: The determining whether it is within a preset time zone, if so, calculating the verification time required to obtain the first verification result and comparing the verification time with a preset time threshold to obtain a comparison result, including: Determine the preset time zone based on data sharing requirements; Calculate the historical verification time set within the preset time zone; Generate a preset time threshold according to the historical verification time set; The verification time required for the current first verification result is compared with the preset time threshold to obtain a comparison result.
6. A device, characterized in that: include: processor; and a memory for storing a blockchain data sharing encryption and decryption program of the processor; wherein the processor is configured to execute the method described in any one of claims 1-5 by executing the blockchain data sharing encryption and decryption program.
7. A storage medium having a blockchain data sharing encryption and decryption program stored thereon, characterized in that: When the blockchain data sharing encryption and decryption program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.