A method for protecting archival data based on blockchain
By combining cryptographic algorithms and smart contracts with blockchain technology, the problem of insufficient privacy protection for archival data has been solved, achieving efficient and secure storage and access control of archival data, and ensuring data integrity and privacy.
Patent Information
- Application Number
- CN202410411000.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-04-08
AI Technical Summary
Existing archival data management systems suffer from insufficient privacy protection. Traditional data anonymization and access control mechanisms are ill-suited to complex data sharing scenarios, and storing feature parameters on the blockchain may lead to information leakage.
Cryptographic algorithms are used to generate verification codes and smart contracts are used for access authorization management. By classifying, compressing, encrypting and fragmenting archive data, and combining the immutability of blockchain, a verification code index table is generated and stored in an off-chain database. Smart contracts are used for integrity verification and access control.
It improves the privacy and integrity of archival data, prevents data tampering, enables fine-grained access control, and enhances the security and reliability of data storage.
Smart Images

Figure CN118228312B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of archival data technology, and in particular to an archival data protection method based on blockchain. Background Art
[0002] Archival data usually contains a large amount of sensitive personal information and key business data. Once leaked or illegally accessed, it will cause serious damage to personal privacy and organizational interests. Traditional archive management systems mostly adopt a centralized architecture, which is vulnerable to internal threats and external attacks, and the confidentiality and integrity of data are difficult to be effectively guaranteed.
[0003] Existing archival data privacy protection technologies, such as data desensitization and access control, have alleviated the problem of privacy leakage to a certain extent, but they still have many limitations. Data desensitization usually requires modification of the original data, which may affect the integrity and availability of the data; and traditional access control mechanisms are difficult to adapt to increasingly complex data sharing scenarios and lack flexibility and scalability.
[0004] In the related art, for example, Chinese patent document CN111611459B provides a method for protecting archival data based on blockchain, obtains archival data, classifies archival data to obtain at least two archival data sets, stores and backs up in corresponding storage spaces, stores the first characteristic parameter of each archival data set in the blockchain network, obtains the actual second characteristic parameter according to the target archival data set, and obtains the first characteristic parameter from the blockchain network, verifies according to the first characteristic parameter and the second characteristic parameter, and if the verification fails, replaces the archival data set stored in the backup space with the archival data set in the corresponding main storage space, and when the archival data is extracted, first performs identity authentication, and then compares the relevant verification code after passing, and then obtains and outputs the archival data set to be extracted. However, this scheme stores the characteristic parameters of the archival data set in the blockchain network for subsequent data integrity verification. However, the characteristic parameters themselves may contain certain sensitive information, and directly storing them on the blockchain will lead to information leakage. Summary of the invention
[0005] 1. Technical issues to be solved
[0006] In response to the problem of insufficient privacy protection of archival data in the prior art, the present application provides an archival data protection method based on blockchain, which uses cryptographic algorithms to generate verification codes and uses smart contracts to perform access authorization management, thereby improving the privacy protection of archival data.
[0007] 2. Technical solution
[0008] The purpose of this application is achieved through the following technical solutions.
[0009] The embodiment of the present specification provides a blockchain-based archival data protection method, including: obtaining archival data, classifying the obtained archival data according to a preset classification mechanism, and generating archival data subsets of different categories; wherein the preset classification mechanism includes classification according to the sensitivity and business type of the archival data; compressing the classified archival data subsets; generating a location index table for the compressed archival data subsets, the location index table including storage location and occupied space; compressing the archival data subsets; generating a check code of the compressed archival data subsets using a cryptographic algorithm, and generating a check code index table based on the check code; storing the compressed archival data subsets in a distributed database; The database is stored and the location information in the location index table is updated; the check code index table is encrypted by using a hash function and a random salt value to generate an encrypted check code index table; the location index table of the subset of archive data is encrypted and the encrypted location index table is stored in the blockchain; the encrypted check code index table is sharded and the sharded check code index table is stored in the blockchain; the original text of the check code index table is transmitted through a channel and stored in a database off the chain; a smart contract is deployed based on the blockchain, and the subset of archive data is verified by using the smart contract, and the check code on the blockchain is verified to be consistent with the original text of the check code in the database off the chain, so as to verify the integrity of the archive data.
[0010] Among them, the location index table is a data structure used to record the storage location and occupied space of archival data. In this scheme, when the archival data subset is stored in the distributed database, its storage location information will be recorded in the location index table to facilitate subsequent retrieval and access. The location index table contains the following fields: Archival data subset ID: used to uniquely identify an archival data subset, storage location: record the specific location of the archival data subset in the distributed database, such as node IP, file path, etc., occupied space: record the compressed size of the archival data subset, used to optimize storage and transmission. Among them, the cryptographic algorithm is a mathematical algorithm used to protect information security, which is commonly used in data encryption, signature verification, integrity verification and other fields. In this scheme, two types of cryptographic algorithms are mainly used: Hash function: The hash function can map data of any length to a hash value of a fixed length, and has one-way and collision resistance. Hash algorithms include MD5, SHA-1, SHA-256, etc. In this scheme, the hash function is mainly used to generate the check code of the archival data subset and encrypt the check code index table. Symmetric encryption algorithm: The symmetric encryption algorithm uses the same key for encryption and decryption, which is more efficient. Symmetric encryption algorithms include DES, AES, 3DES, etc. In this solution, the symmetric encryption algorithm is mainly used to encrypt and protect the location index table to prevent unauthorized access.
[0011] Among them, the check code index table is a data structure used to record the check code of the archive data subset. In this scheme, a cryptographic algorithm (such as SHA-256) is used to generate a unique check code for each archive data subset to verify the integrity and accuracy of the data. The check code index table contains the following fields: Archive data subset ID: used to uniquely identify an archive data subset, check code: the unique fingerprint of the archive data subset calculated using the cryptographic algorithm, timestamp: records the generation time of the check code, used to verify the timeliness of the check code.
[0012] Among them, channel transmission refers to the path or medium for transmitting information between two communicating entities. In this scheme, the original text of the verification code index table needs to be transmitted from the chain to the off-chain database through a secure channel for storage. The channel here can be an encrypted network connection, such as HTTPS, SSL / TLS, etc., or a physically isolated dedicated line. The security of channel transmission is crucial to protecting the verification code index table, because once the original text of the verification code index table is leaked, it may be used by attackers to tamper with archive data. Secure channel transmission protocols include IPSec, SSL / TLS, SSH, etc.
[0013] Among them, smart contracts are programs running on the blockchain, which can automatically execute predefined rules and logic to realize complex business functions. The code and status of smart contracts are stored on the blockchain, which has the characteristics of being tamper-proof, verifiable, transparent and auditable. In this solution, smart contracts are used to implement the integrity check of archive data: the smart contract reads the encrypted check code index table from the blockchain, decrypts and parses it, and then compares it with the original check code stored in the off-chain database to verify whether the archive data is complete and accurate. If the verification fails, it means that the data may have been tampered with, and an alarm and disposal are required. Archive data authorization access control: the smart contract maintains a set of access control lists (ACLs) that record which users or roles have read and write permissions for which archive data. When a user requests to access a certain archive data, the smart contract will verify its identity and permissions, and only verified requests can be allowed, thereby realizing fine-grained access control.
[0014] Furthermore, the archive data subset is compressed, including: dividing the archive data subset to obtain multiple data blocks; performing hash operation on each data block to obtain hash records of each data block; performing combined hash operation on the hash records of each data block to obtain a check code of the archive data subset, and generating a check code index table based on the check code; binding the check code with metadata of the corresponding archive data subset to generate check code metadata; wherein the metadata includes an identifier, a timestamp and an access policy of the archive data subset; encoding the data block using an error correction coding algorithm according to the check code metadata to generate a corresponding check block; storing the data block of the archive data subset, the corresponding check block and the check code index table to obtain redundant coded data; and compressing the obtained redundant coded data using a compression algorithm to obtain a compressed archive data subset.
[0015] The hash record refers to the hash value obtained by performing a hash operation on a data block. In this scheme, the archive data subset is divided into multiple data blocks, and then a hash operation is performed on each data block to obtain a hash value of a fixed length, which is used to uniquely identify the data block. The hash record can be used to verify the integrity and consistency of the data block, because even if one bit in the data block changes, its hash record will change significantly.
[0016] Among them, data block refers to dividing a large data set (such as an archive data subset) into multiple small, fixed-size data units. Data blockization is conducive to parallel processing, fault-tolerant storage, and incremental synchronization. In this scheme, the archive data subset is first divided into multiple data blocks, and then each data block is hashed and error-corrected. Finally, all data blocks and check blocks are compressed and stored together. Among them, metadata refers to data that describes data, which provides contextual information about the data, such as the type, format, source, and timestamp of the data. In this scheme, the check code of the archive data subset is bound to its metadata to generate check code metadata. Check code metadata includes: archive data subset ID: used to uniquely identify an archive data subset, check code: the unique hash summary of the archive data subset, timestamp: record the generation time of the check code, used to verify the timeliness of the check code, access policy: defines which users or roles can access the archive data subset. Among them, the error correction coding algorithm is a technology that detects and automatically repairs data errors by introducing redundant information. Error correction coding algorithms include RS code, LDPC code, Hamming code, etc. In this solution, an error correction coding algorithm is used to encode the data blocks of the archive data subset to generate corresponding check blocks. In this way, even if a small number of data blocks are lost or damaged, they can be restored through the redundant information in the check blocks. This greatly improves the reliability and fault tolerance of data storage.
[0017] Among them, identification refers to a symbol or code used to uniquely identify an object. In this scheme, an ID is used to uniquely identify a subset of archival data as a basis for retrieval and management. The naming rules of the archival data subset ID can be designed according to the specific business scenario, and generally contain information such as date, type, and serial number. Among them, the compression algorithm is a technology that reduces the volume of data by reducing redundant information in the data. Compression algorithms include LZ77, LZ78, Huffman coding, arithmetic coding, etc. In this scheme, after error correction coding of the archival data subset, a set of redundant coded data is obtained, including original data blocks and check blocks. In order to reduce storage and transmission overhead, a compression algorithm can be used to compress these redundant coded data to obtain a smaller compressed package.
[0018] Furthermore, a hash operation is performed on each data block, and a random salt value is introduced to obtain a hash record of each data block, including: generating a random salt value with a length greater than Q bits through a random number generator; concatenating the generated random salt value with each data block to obtain an extended data block; performing a hash operation on the extended data block using the SR3 algorithm to obtain a hash value of the data block; obtaining metadata of the data block including location information and a timestamp, and concatenating the obtained metadata with the obtained hash value to generate a hash record of the data block.
[0019] Among them, the random salt value (Salt) refers to a randomly generated additional data before the hash operation. Its purpose is to increase the randomness and uniqueness of the original data, thereby improving the security and anti-collision of the hash algorithm. In this scheme, a random salt value is introduced for each data block, which is then spliced with the original data block to obtain an extended data block. In this way, even if the contents of two data blocks are exactly the same, their hash values will be very different due to different salt values.
[0020] Among them, the random number generator (RNG) refers to an algorithm or hardware device that can generate a series of random numbers. Random numbers are widely used in cryptography, such as key generation, random salt values, challenge values, etc. Among them, SR3 (Secure Remote Random Rendezvous) is a password-based key negotiation algorithm. In this solution, the SR3 algorithm is used to perform hash operations on the extended data block to obtain the hash value of the data block. The SR3 algorithm here mainly draws on the idea of adding salt to the password, and enhances the security of the hash algorithm by introducing a random salt value. The specific hash algorithm can choose standard algorithms such as SHA-256.
[0021] Furthermore, a random salt value having a length greater than Q bits is generated by a random number generator, including: determining the length of an initial seed in a hash-DRBG algorithm according to the output length of a hash function SHA-512; generating a true random number equal to the determined length as an initial seed of the hash-DRBG algorithm through a quantum entropy source; setting the number of iterations of the hash-DRBG algorithm and the length of the generated random number; performing multiple iterative operations on the obtained initial seed using the hash-DRBG algorithm, with the number of iterations being the set number of iterations; extracting a random bit string of the first R1 bits from the final output of the hash-DRBG algorithm as a candidate random salt value; determining whether the length of the extracted candidate random salt value is greater than or equal to Q bits, and if not, using the candidate random salt value as a new seed, and repeating the steps of iterative operations and extracting candidate random salt values until a random salt value having a length greater than Q bits is obtained.
[0022] Among them, SHA-512 is one of the Secure Hash Algorithm series. SHA-512 is a member of the SHA-2 family, and its output length is 512 bits (64 bytes). It uses Merkle- The structure divides the input message into blocks, each block is 1024 bits, and after 80 rounds of iterative compression, a 512-bit hash value is finally generated. SHA-512 inherits the security features of SHA-256 in design, but provides longer hash values and better security. In this scheme, the output length of SHA-512 (512 bits) is used to determine the length of the initial seed in the hash-DRBG algorithm to ensure the security of random number generation. Among them, hash-DRBG (Hash-based Deterministic Random Bit Generator) is a deterministic random bit generation algorithm based on hash functions, defined by NIST in the SP800-90A standard. It uses cryptographically secure hash functions (such as SHA-256, SHA-512, etc.) to expand an initial seed into a string of random bit sequences through iterative operations. In this scheme, the hash-DRBG algorithm is used to perform multiple iterative operations on the initial seed to generate a random bit string with controllable length as a candidate random salt value.
[0023] Among them, the quantum entropy source is a physical device that uses quantum physical effects to generate true random numbers. It uses the uncertainty principle of quantum systems to generate unpredictable and unclonable random numbers by measuring quantum states such as the polarization state of photons and the spin state of electrons. In this scheme, a quantum entropy source is used to generate true random numbers with the same length as the SHA-512 output as the initial seed of the hash-DRBG algorithm to ensure the randomness and security of the random salt value. It can be used: Quantum optical entropy source: using quantum properties such as the polarization state and phase of photons to generate random numbers through single-photon detector measurement. Quantum electronic entropy source: using quantum properties such as the spin state and energy level transition of electrons to generate random numbers through magnetic resonance, quantum dots, etc. Quantum noise entropy source: using the noise in quantum devices, such as the shot noise of tunneling junctions and the thermal noise of resistors, etc., to generate random numbers after amplification and digitization. Among them, true random numbers refer to random numbers that are completely unpredictable and non-repeatable and generated through physical processes. They do not rely on any deterministic algorithm and are completely determined by the randomness of physical processes. In this scheme, a quantum entropy source is used to generate true random numbers as the initial seed of the hash-DRBG algorithm, and then expanded into a large number of pseudo-random numbers through the hash-DRBG algorithm, taking into account both randomness and efficiency. Among them, bit is the basic unit in information theory, representing the minimum amount of information. A bit can represent one of two states, usually represented by 0 and 1. In this scheme, a string of random bit sequences is first generated by the hash-DRBG algorithm, and then the first several bits are taken as candidate random salt values, and it is determined whether its length is full of the preset length.
[0024] Furthermore, a random number having the same length as the determined length is generated as an initial seed through an entropy source, including: measuring the time interval of atomic decay through a quantum random number generator to obtain a random bit string; truncating or splicing the random bit string to generate a true random number having the same length as the preset initial seed as the initial seed.
[0025] Among them, atomic decay refers to the process in which some unstable atomic nuclei spontaneously release particles or energy and transform into another atomic nucleus. Decay is a random process that follows statistical laws, but the decay time of a single atomic nucleus cannot be accurately predicted. Atomic decay that can be used: α decay: The atomic nucleus releases an α particle (helium nucleus) containing 2 protons and 2 neutrons. β decay: The neutrons in the atomic nucleus are transformed into protons, and an electron (β particle) and an anti-electron neutrino are released at the same time. γ decay: The atomic nucleus transitions from an excited state to a ground state, releasing high-energy electromagnetic radiation (γ rays). In this scheme, a quantum random number generator is used to measure the time interval of atomic decay to obtain a random bit string as the initial seed of the hash-DRBG algorithm. This can ensure the randomness and unpredictability of the initial seed. Among them, truncation and concatenation are two basic operations for adjusting the length of a bit string or a data block. The truncation operation refers to taking a part of a longer bit string or data block as a new bit string or data block. The splicing operation refers to connecting two or more bit strings or data blocks end to end to form a new, longer bit string or data block. In this scheme, a random bit string is first obtained through a quantum random number generator, and then the random bit string is truncated or spliced according to the preset initial seed length. If the length of the random bit string is greater than the initial seed length, the first several bits are truncated as the initial seed. If the length of the random bit string is less than the initial seed length, it is spliced with the next random bit string until the length meets the requirements. In this way, the length of the initial seed can be guaranteed to be the same as the output length of SHA-512, meeting the input requirements of the hash-DRBG algorithm. At the same time, through truncation or splicing operations, the indefinite length random bit string generated by the quantum random number generator can be flexibly converted into an initial seed of the required length.
[0026] Furthermore, metadata including location information and timestamp of the data block is obtained, and the obtained metadata is concatenated with the obtained hash value to generate a hash record of the data block, including: obtaining the location information of the data block, the location information including the starting position and the ending position of the data block in the archive data subset; obtaining the start time and the end time of the hash operation of the data block through the network time protocol QTP, and using the start time and the end time and the corresponding difference as the timestamp of the hash operation of the data block; digitally signing the obtained location information, timestamp and hash value of the data block to obtain a digital signature value; serializing the obtained location information, timestamp, hash value and corresponding digital signature value of the data block to generate a hash record of the data block.
[0027] Among them, NTP (Network Time Protocol) is a protocol for synchronizing clocks in computer networks. It transmits timestamp information through the network so that the clocks on different computers can be consistent. NTP adopts a hierarchical server structure. The top layer is a high-precision time source such as an atomic clock. The lower server obtains time from the upper server and synchronizes layer by layer. The NTP protocol uses UDP transmission, and the port number is 123. In this scheme, the start time and end time of the data block hash operation are obtained through the NTP protocol as the timestamp of the data block hash record. This ensures that the timestamps on different nodes are consistent, which is convenient for subsequent verification and auditing. Among them, digital signature is a message authentication mechanism based on public key cryptography. It implements message integrity protection and identity authentication through signature algorithms and verification algorithms. Digital signature algorithms include RSA, DSA, ECDSA, etc., which are based on different mathematical problems, such as integer decomposition, discrete logarithm, etc. In this scheme, the location information, timestamp and hash value of the data block are digitally signed to generate a digital signature value. This ensures the integrity and non-repudiation of the data block hash record and prevents the record from being tampered with or forged.
[0028] Among them, serialization is the process of converting the data structure or object state in memory into a format that can be stored or transmitted. It writes the state of the data structure or object to disk, memory buffer or network data stream so that an identical copy can be recreated later. The serialization formats are: JSON (Java Script Object Notation): a lightweight data exchange format that uses JavaScript syntax to represent structured data. XML (eXtensible Markup Language): a markup language used to mark electronic files to make them structured, using tags to represent the structure and semantics of data. Protocol Buffers: a platform-independent, language-independent extensible data serialization format developed by Google, using .proto files to define data structures. Thrift: a cross-language RPC framework developed by Facebook, using IDL (Interface Definition Language) to define data types and service interfaces. In this solution, the location information, timestamp, hash value and digital signature value of the data block are serialized to generate a hash record of the data block. In this way, these different types of data can be combined into a byte string in a standard format, which is convenient for subsequent storage, transmission and verification.
[0029] Furthermore, a hash operation is performed on the hash record of each data block to obtain a check code of the archive data subset, including: extracting a corresponding hash value from the hash record of each data block to obtain a set of data block hash values; using the Shamir secret sharing algorithm based on threshold cipher to generate a key splitting threshold, splitting the key into N subkeys, and setting at least M subkeys to restore the original key; splicing the extracted set of data block hash values in sequence, encrypting the spliced hash values using the generated key splitting threshold to obtain an initial check code; using a quantum random number generator to generate a random salt value with a length of R2 bits, and performing data splicing on the generated random salt value and the initial check code to obtain an extended check code; using the LRS hash algorithm to perform a hash operation on the extended check code to obtain a check code of the archive data subset with a length of R3 bits; binding the generated check code of the archive data subset with the metadata of the archive data subset to form a check code index table.
[0030] Among them, threshold cryptography is a cryptographic primitive that allows a secret (such as a key) to be split into multiple sub-secrets (sub-keys), and requires at least a certain number of sub-secrets to restore the original secret. In this scheme, the Shamir secret sharing algorithm based on threshold cryptography is used to split the encryption key into multiple sub-keys. This can improve the security of key management and avoid single-point leakage of the key. Among them, Shamir's Secret Sharing is a threshold cryptographic scheme based on polynomial interpolation. The security of the Shamir secret sharing algorithm is based on the uniqueness of polynomial interpolation. Given k-1 points, only a k-1 degree polynomial can be uniquely determined. Therefore, any sub-secrets less than k cannot leak any information about the original secret. In this scheme, the Shamir secret sharing algorithm is used to generate a key split threshold to split the encryption key into n sub-keys. This ensures that the original key can only be restored when enough sub-keys are collected, which improves the security of key management. Among them, the splitting threshold is a key parameter in the threshold cryptographic scheme, which specifies the minimum number of sub-secrets required to recover the original secret. In this scheme, the key splitting threshold is set to M, that is, at least M sub-keys are required to recover the original encryption key. This can balance the security and availability of the system, prevent malicious behavior of a few participants, and ensure that the key can be successfully recovered with the cooperation of a certain number of participants.
[0031] Among them, the LRS (Luby Rackoff Schnorr) hash algorithm is a provably secure hash function construction method based on the Feistel structure. The security of the LRS hash algorithm is based on the security of the pseudo-random function and the provable security of the Feistel structure. Under ideal conditions, the LRS hash algorithm can resist cryptanalysis methods such as birthday attacks and differential attacks. In this scheme, the LRS hash algorithm is used to perform a hash operation on the extended check code to obtain a check code with a length of R3 bits. This can ensure the security of the check code.
[0032] Further, the obtained hash values are concatenated, and the generated segmentation threshold is used for key encryption to generate an initial check code, including: arranging the obtained hash values in sequence according to the order of the data blocks in the archive data subset to obtain a hash value sequence; dividing the hash value sequence into n substrings of length L according to a preset substring length L, taking the value of each substring as the y value of a coordinate point, and taking the sequence number of the substring as the x value of the corresponding coordinate point to form n coordinate points (x i ,y i ); Generate a k-order polynomial f(x) through the threshold cryptographic algorithm, where k is the key segmentation threshold and k is less than the number of coordinate points n; Calculate nk coordinate points (x i ,y i ) as the evaluation point, calculate the function value of the evaluation point on the polynomial f(x), and get the x value x of nk evaluation points j and the corresponding function value y j , forming the evaluation point set {(x j ,y j )}; Using the shaRir key splitting algorithm, the k coefficients of the generated k-order polynomial f(x) are used as the original key, m-1 polynomial coefficients are randomly generated over the finite field GF(p), and m-1 polynomials g of no more than k-1 order are constructed. 1 (x),g 2 (x),......,g m-1 (x); calculate the function values of the generated m-1 polynomials at the n substring sequence numbers x, and perform a membrane p addition operation on the calculated function values and the function values of f(x) at the corresponding x values to obtain m subkey polynomials h 1 (x),h 2 (x),......,h m (x); Subkey polynomial h 1 (x),h 2 (x),......,h m (x) Concatenate the function values at the n substring sequence numbers x to get the initial check code.
[0033] Modular Addition modulo p is an addition operation performed on a finite field GF(p), where p is a prime number. In the modular addition operation, all operation results must be modulo p so that the results fall within the range of 0 to p-1. For any two integers a and b, their sum in the sense of modulo p is (a+b) mod p, that is, the remainder of (a+b) divided by p. In this scheme, when constructing the subkey polynomial, the function values of the generated m-1 polynomials at the values of n substring sequence numbers x are added to the function values of the original key polynomial f(x) at the corresponding values of x by the modulo p addition operation. The purpose of this is to mix the function values of the original key polynomial with the function values of the randomly generated polynomial to obtain m subkey polynomials. Each subkey polynomial contains part of the information of the original key, but a single subkey polynomial cannot leak the original key. At the same time, due to the nature of the modular addition operation, even if some subkey polynomials are obtained, it is difficult to directly restore the original key polynomial. This enhances the security of the scheme and prevents the disclosure of the subkey from leading to the disclosure of the original key.
[0034] Among them, the finite field (Finite Field), also known as the Galois field (Galois Field), is an algebraic structure that contains only a finite number of elements. It satisfies all the axioms of the field, that is, the operations of addition, subtraction, multiplication, and division (except division by 0) are defined, and it conforms to the basic operation laws such as the commutative law, the associative law, and the distributive law. The finite field is usually represented by the symbol GF(p) or Fp, where p is a prime number, indicating the number of elements in the finite field. The elements in the finite field can be represented by integers between 0 and p-1, and the results of the operations also fall within this range. In this scheme, polynomials are constructed and operations are performed on the finite field GF(p), and the mathematical properties of the finite field are used to realize the division and recovery of the key. By appropriately selecting the modulus p of the finite field, the security and efficiency of the scheme can be guaranteed. Among them, the evaluation point (Evaluation Point) is a concept in polynomial interpolation, which refers to a set of special points used to recover the coefficients of the polynomial. In this scheme, nk coordinate points (x i ,y i ) as evaluation points to verify whether the recovered polynomial is correct. By comparing whether the function value of the recovered polynomial at the evaluation point is consistent with the actual yi value, the correctness of the recovery result can be judged. At the same time, the number of evaluation points cannot be too large to prevent leaking too much polynomial information.
[0035] Further, the obtained hash values are concatenated, and the generated segmentation threshold is used for key encryption to generate an initial check code, which also includes: converting the generated m subkey polynomials h 1 (x),h 2(x),......,h m (x) and the corresponding function value h at the n substring sequence number x value 1 (x j ),h 2 (x j ),......,h m (x j ) are sent to m participants through a secure channel as their respective secret shares; each participant performs Lagrange interpolation on any t secret shares received through a secret reconstruction algorithm according to a predetermined secret recovery threshold t, and obtains the function value f(x) of the original k-order polynomial f(x) at the n substring sequence number x value. j ); the function value f(x) of the original polynomial f(x) at the n substring sequence number x value is obtained j ) are concatenated in the order of increasing x values to obtain the initial check code of the hash value of the data block.
[0036] Among them, a secure channel refers to a communication channel that can provide confidentiality, integrity, authentication and other security guarantees between the two communicating parties. Compared with ordinary channels, secure channels use security mechanisms such as encryption, signature, and verification when transmitting data to prevent data from being eavesdropped, tampered with, or forged during transmission. The establishment of a secure channel is usually based on various cryptographic protocols, such as SSL / TLS, IPSec, and SSH. These protocols use cryptographic technologies such as symmetric encryption, public key encryption, and message authentication codes to negotiate a shared session key between the two communicating parties, and use the key to encrypt and authenticate the transmitted data. In this scheme, the generated m subkey polynomials and corresponding function values are sent to the m participants through a secure channel as their respective secret shares. This can prevent the secret share from being leaked or tampered with during transmission, ensuring the security of the scheme.
[0037] Among them, secret share refers to the multiple sub-secrets into which the original secret is divided in the secret sharing scheme. Each participant holds one or more secret shares, and a single secret share cannot leak any information about the original secret. In the threshold cryptography scheme, the secret share is usually the function value of the original secret polynomial at different x values. By expressing the original secret as a constant term of the polynomial and randomly generating other coefficients, a polynomial f(x) with a degree not exceeding k-1 is constructed. Then, the function value of the polynomial at n different x values is calculated to obtain n secret shares. In this scheme, the generated m sub-key polynomials and the corresponding function values are sent to the m participants as secret shares. Each participant only holds his own secret share and cannot recover the original key polynomial alone. Only when enough participants carry their secret shares can the original secret be recovered through the secret reconstruction algorithm.
[0038] Among them, the secret reconstruction algorithm refers to the algorithm used to recover the original secret from a certain number of secret shares in the secret sharing scheme. In the threshold cryptographic scheme, the secret reconstruction algorithm is usually based on the polynomial interpolation principle. Given k or more secret shares (x i ,y i ), where x i is the number of the secret share, y i is the corresponding polynomial function value, a k-1 degree polynomial f(x) can be uniquely determined through the interpolation algorithm. The original secret is the constant term f(0) of the polynomial. In this scheme, the Lagrange interpolation algorithm is used as the secret reconstruction algorithm. Each participant performs Lagrange interpolation on any t secret shares received according to the predetermined secret recovery threshold t, and obtains the function value f(x) of the original k-order polynomial f(x) at the n substring sequence number x value. j ). Then, these function values are concatenated in the order of increasing x values to obtain the initial checksum of the hash value of the data block.
[0039] Among them, Lagrange interpolation is a polynomial interpolation algorithm used to calculate the value of a given point (x i ,y i ) to construct a unique polynomial function f(x) such that the function value of the polynomial function at each known point is equal to the given y i The values are equal, that is, f(x i )=y i Lagrange interpolation is based on the following principle: for a given k different points (x 1 ,y 1 ),(x2 ,y 2 ),......,(x k ,y k ), there exists a unique polynomial f(x) of degree not exceeding k-1 such that f(x i )=y i (i=1,2,......,k). In this application, the original secret is usually expressed as a constant term of a polynomial, and then other coefficients are randomly generated over a finite field to construct a polynomial f(x) of degree not exceeding k-1. The secret share is the function value of the polynomial at different x values. When the original secret needs to be restored, it is only necessary to collect at least k secret shares, and the original polynomial f(x) can be reconstructed through the Lagrange interpolation algorithm, and f(0) can be calculated as the original secret.
[0040] Furthermore, the generated check code of the archive data subset is bound to the metadata of the archive data subset to form a check code index table, including: obtaining the unique identifier, creation time and owner identity of the archive data subset; the creation time indicates the generation time of the archive data subset, and the owner identity indicates the ownership information of the archive data subset; using an attribute-based encryption algorithm to generate an access policy key according to the attribute set of the owner identity; data binding the generated access policy key, the metadata of the archive data subset and the check code to generate a check code binding record; calculating the hash value of the attribute encrypted ciphertext of the check code binding record, and using the calculated hash value as a leaf node of the Merkle tree; using a homomorphic encryption algorithm, for every two adjacent leaf nodes The hash value of the point is homomorphically encrypted to generate the corresponding parent node hash value as a non-leaf node of the Merkle tree; the homomorphic encryption merging process is recursively performed to merge the non-leaf nodes of the Merkle tree in pairs to generate new non-leaf nodes until the root node of the Merkle tree is generated; a zero-knowledge proof protocol is used to generate a zero-knowledge proof for the root node of the Merkle tree to prove the correctness of the Merkle tree construction process and the root node hash value; a check code index table is constructed based on the generated Merkle tree zero-knowledge proof, the check code of the archive data subset, and the metadata information; the constructed check code index table is sent to the blockchain through a channel, and the smart contract in the blockchain network verifies and stores the check code index table;
[0041] Among them, the owner identity refers to the ownership information of the archival data subset, indicating which entity or individual created and owned the subset. In the digital world, the owner identity is usually associated with a digital identity or credential, such as a digital certificate, a public key, a user name, etc. In attribute-based encryption and access control, the owner identity is usually associated with a set of attributes that describe the characteristics or roles of the owner, such as department, position, security level, etc. Access policies can be formulated based on these attributes to control access rights to the archival data subset. In this scheme, the owner identity of the archival data subset is obtained and bound to the metadata of the archival data subset to form a checksum index table. In this way, the ownership and management rights of the archival data subset can be clarified, and a basis for subsequent access control can be provided. Among them, the access policy key refers to a key generated based on the attribute set of the owner identity, which is used to control access rights to the archival data subset. The access policy key is usually associated with a certain encryption algorithm, such as an attribute-based encryption algorithm. In attribute-based encryption, the access policy key is generated based on the attribute set and the access policy. Only when the user's attributes meet the access policy can the corresponding key be used to decrypt the data. Access policies can use Boolean operators (such as AND, OR) to combine multiple attribute conditions to form complex access control rules. In this scheme, an attribute-based encryption algorithm is used to generate access policy keys based on the attribute set of the owner identity. Then, the access policy key is data-bound with the metadata and verification code of the archive data subset to generate a verification code binding record. This ensures that only users who meet the access policy can access and verify the archive data subset.
[0042] Among them, attribute-based encryption (ABE) is a public key encryption algorithm that allows data to be encrypted and decrypted based on a set of attributes. Unlike traditional public key encryption, ABE can formulate flexible access control policies based on a combination of attributes. There are two main types of ABE: Ciphertext-Policy ABE (CP-ABE) and Key-Policy ABE (KP-ABE). In CP-ABE, the access policy is embedded in the ciphertext, and the user's private key is associated with the attributes. Data can only be decrypted when the user's attributes meet the access policy in the ciphertext. In KP-ABE, the access policy is embedded in the user's private key, and the ciphertext is associated with the attributes. Data can only be decrypted when the attributes of the ciphertext meet the access policy in the user's private key. In this scheme, an attribute-based encryption algorithm is used to generate an access policy key and bind it to the metadata and checksum of the archive data subset. This enables fine-grained access control, where only users who meet specific attribute conditions can access and authenticate subsets of archive data.
[0043] Among them, the Merkle tree, also known as the hash tree, is a data structure used to efficiently verify the integrity of a large amount of data. It is a binary tree, each leaf node stores the hash value of the data block, and each non-leaf node stores the hash value of its child node hash value. The root node hash value of the Merkle tree can be used to verify the integrity of the entire tree. When it is necessary to verify whether a data block belongs to the Merkle tree, it is only necessary to provide the hash values of all nodes on the path from the leaf node to the root node corresponding to the data block, as well as the hash values of the sibling nodes of each node on the path. By recursively calculating these hash values, the root node hash value can be finally obtained and compared with the known root node hash value to verify the integrity of the data block. In this scheme, the Merkle tree is used to organize the hash values of the checksum binding records. By taking the hash value of each record as a leaf node, recursively calculating the non-leaf node hash values, and finally generating the root node of the Merkle tree. The root node hash value of the Merkle tree can be used to verify the integrity and consistency of the checksum index table.
[0044] Among them, homomorphic encryption is a special encryption algorithm that allows certain calculations to be performed directly on encrypted data without decrypting the data. The result of homomorphic encryption is consistent with the result of the same calculation on the plaintext after decryption. The mathematical basis of homomorphic encryption usually involves algebraic structures such as lattices, rings or polynomials. Homomorphic encryption algorithms include Paillier encryption, ElGamal encryption, Boneh-Goh-Nissim encryption, etc. These algorithms use specific mathematical properties, such as modular exponentiation, elliptic curve arithmetic, etc. to implement homomorphic operations on encrypted data. In this scheme, the homomorphic encryption algorithm is used to encrypt the hash values of every two adjacent leaf nodes in the Merkle tree to generate the corresponding parent node hash value. By recursively executing the homomorphic encryption merging process, the root node of the Merkle tree is finally generated. In this way, the integrity and consistency of the Merkle tree can be verified without leaking the plaintext hash value of the leaf node.
[0045] Among them, in the Merkle tree, non-leaf nodes refer to all nodes except leaf nodes. Non-leaf nodes store the hash values of their child nodes and are used to build the hierarchical structure of the Merkle tree. In the construction process of the Merkle tree, the hash values of every two adjacent leaf nodes are hashed to generate a non-leaf node. Then, the hash values of every two adjacent non-leaf nodes are hashed to generate new non-leaf nodes until the root node of the Merkle tree is generated. In this scheme, the hash values of every two adjacent leaf nodes are encrypted by the homomorphic encryption algorithm to generate the corresponding non-leaf node hash value. Then, the homomorphic encryption merging process is recursively performed to merge the non-leaf nodes in pairs to generate new non-leaf nodes until the root node of the Merkle tree is generated. The hash values of non-leaf nodes are used to build the hierarchical structure of the Merkle tree and support efficient data integrity verification. Among them, the root node is the top-level node of the Merkle tree, which is obtained by recursively calculating the hash values of all leaf nodes and non-leaf nodes. The hash value of the root node represents the data integrity and consistency of the entire Merkle tree. In the application of Merkle trees, the root node hash value is usually used as a summary or fingerprint of the entire data set to quickly verify the integrity of the data or synchronize data between different nodes. In this scheme, the non-leaf nodes of the Merkle tree are merged two by two by recursively executing the homomorphic encryption merging process, and finally the root node of the Merkle tree is generated. The hash value of the root node represents the integrity and consistency of the entire checksum index table, which can be used to quickly verify the correctness of the index table.
[0046] Among them, the zero-knowledge proof protocol (Zero-Knowledge Proof Protocol) is a cryptographic protocol that allows the prover to prove the correctness of a statement to the verifier without revealing any information other than the correctness. In zero-knowledge proof, the prover has a secret information, but does not want to reveal the content of this information to the verifier. Zero-knowledge proof protocols include: Schnorr protocol: used to prove the knowledge of discrete logarithms. Fiat-Shamir protocol: used to prove the knowledge of quadratic residues. zk-SNARKs (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge): used to prove the correctness of arbitrarily complex calculations, with simplicity and non-interactivity. In this scheme, the zero-knowledge proof protocol is used to generate a zero-knowledge proof for the root node of the Merkle tree, proving the construction process of the Merkle tree and the correctness of the hash value of the root node. Through zero-knowledge proof, the integrity and consistency of the checksum index table can be proved to the blockchain network without revealing the specific content of the index table, thereby protecting data privacy.
[0047] Among them, smart contract is a computer protocol based on blockchain technology, which can automatically execute, verify and enforce the terms of the contract. Smart contracts are written in the form of code, deployed on the blockchain network, and automatically triggered and executed when specific conditions are met. Smart contracts are usually written using specific programming languages, such as Solidity (Ethereum), Chain code (Hyperledger Fabric), etc. These languages provide tools and frameworks for writing, testing and deploying smart contracts. In this solution, the constructed checksum index table is sent to the blockchain through a channel, and is verified and stored by the smart contract in the blockchain network. The smart contract can automatically verify the integrity and consistency of the index table to ensure that it has not been tampered with. At the same time, the smart contract can also control the access rights of the index table, allowing only authorized users to query and use the index table. By storing the checksum index table in the smart contract of the blockchain, the characteristics of blockchain such as immutability, transparency and verifiability can be used to improve the security and credibility of the index table. As an automated contract execution mechanism, smart contracts can simplify the verification and management process of the index table, improve efficiency and reduce costs.
[0048] Specifically, the present application adopts an attribute-based encryption algorithm to generate access policy keys according to the attribute set of the owner identity to achieve fine-grained access control. The access policy key, metadata and check code are data-bound to generate a check code binding record to ensure the integrity and consistency of the data. The Merkle tree and homomorphic encryption algorithm are used to construct a hash value tree of the check code binding record to support efficient integrity verification. The zero-knowledge proof protocol is used to prove the correctness of the Merkle tree construction process and the root node hash value without leaking the data content. According to the zero-knowledge proof, check code and metadata of the Merkle tree, a check code index table is constructed to facilitate data query and verification. The check code index table is sent to the blockchain, verified and stored by the smart contract, and the characteristics of the blockchain such as non-tamperability, transparency and verifiability are used to improve the security and credibility of the index table.
[0049] 3. Beneficial effects
[0050] Compared with the prior art, the advantages of this application are:
[0051] By classifying the archival data and using cryptographic algorithms to generate checksums and bind them to metadata, combined with the tamper-proof nature of blockchain, the integrity and traceability of the archival data are guaranteed, effectively preventing the archival data from being maliciously tampered with;
[0052] A quantum random number generator is used to obtain high-quality random numbers as salt values, and the hash-DRBG algorithm is used for multiple iterations to generate random salt values that meet the length requirements. The salt values are then combined with the data blocks for hash operations, which greatly enhances the randomness and unpredictability of the hash results and improves the security of the archive data.
[0053] The threshold cryptographic algorithm is used to convert the hash value sequence of the archive data subset into a polynomial, and a subkey polynomial is generated. The original polynomial function value is restored by reconstructing the secret share to form the initial check code, avoiding the risk of single point leakage and ensuring the confidentiality of the check code.
[0054] Bind the checksum to the metadata of the archive data subset, generate the access policy key using the attribute encryption algorithm, and build the checksum index table through the Merkle tree and zero-knowledge proof mechanism. While protecting the privacy of metadata, the checksum is verifiable and prevented from being forged.
[0055] The use of error correction coding algorithms and data compression technology improves the storage efficiency and disaster recovery capabilities of archival data. Combined with the distributed storage architecture, single point failures are avoided, ensuring the availability and reliability of archival data.
[0056] The encrypted verification code index table is sharded and stored in the blockchain. The original verification code index table is stored in the off-chain database, which disperses security risks. At the same time, the openness and transparency of the blockchain are used to facilitate the verification and audit of the verification code, further improving the credibility of the archive data.
[0057] The location index table is encrypted and stored on the blockchain. The immutability of the blockchain is used to protect the location information of the archive data. At the same time, it prevents the location index table from being maliciously modified, ensuring the traceability of the archive data.
[0058] Smart contracts are used to verify and authorize access to archival data, and verification and access control logic are automatically executed according to preset rules, eliminating the security risks caused by manual operations and improving the flexibility and scalability of archival data management. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is an exemplary flow chart of a blockchain-based archival data protection method according to some embodiments of this specification;
[0060] Figure 2 is an exemplary flow chart of obtaining a compressed subset of archive data according to some embodiments of this specification;
[0061] Figure 3 is an exemplary flow chart of obtaining hash records according to some embodiments of this specification;
[0062] Figure 4 This is an exemplary flow chart of obtaining a verification code index table according to some embodiments of this specification. DETAILED DESCRIPTION
[0063] The method and system provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0064] The archival data is obtained, and the obtained archival data is classified according to a preset classification mechanism to generate archival data subsets of different categories. A location index table is generated for the classified archival data subsets, and the location index table contains storage location and occupied space information. The archival data subsets are compressed to obtain compressed archival data subsets.
[0065] Specifically, in a specific embodiment of the present application, a batch of medical archive data needs to be securely stored and verified. This batch of archive data includes different types of files such as medical records, examination reports, and medical images. The archive data is obtained, and the acquired archive data is classified according to a preset classification mechanism to generate archive data subsets of different categories: according to the file type and patient ID, the archive data is divided into the following subsets: Medical Records / PatientID1 / , Medical Reports / PatientID2 / , Medical Images / PatientID3 / .
[0066] Generate a location index table for the classified archive data subsets, which contains storage location and occupied space information: Generate a location index table for each subset, for example: Medical Records / PatientID1 / index.csv, record001.pdf, / data / archive / records / patient1 / record001.pdf, 2.1MB, record002.pdf, / data / archive / records / patient1 / record002.pdf, 1.7MB. MedicalReports / PatientID2 / index.csv, report001.doc, / data / archive / reports / patient2 / report001.doc, 3.2MB, report002.doc, / data / archive / reports / patient2 / report002.doc, 2.9MB.
[0067] The archive data subsets are compressed to obtain compressed archive data subsets: each subset is compressed using the bzip2 algorithm to generate compressed packages: Medical Records / PatientID1.bz2, Medical Reports / PatientID2.bz2, Medical Images / PatientID3.bz2. The archive data subsets are divided to obtain multiple data blocks: the data block size is set to 128MB, and each compressed subset is divided into fixed-size data blocks, and the data blocks less than 128MB are regarded as a data block. A random salt value is introduced into each data block for hash operation to obtain the hash record of each data block: the parameters are determined: the random salt value length Q = 256 bits, the hash function is SHA-512, the output length is 512 bits, the hash-DRBG algorithm iteration number is 10,000 times, the quantum random number generator sampling time interval is 10 milliseconds, and the final random salt value length R1 = 512 bits. A 512-bit true random number is obtained through a quantum random number generator as the initial seed of the hash-DRBG algorithm: a random bit string is obtained by measuring the time interval of cesium atom decay (with a time accuracy of 10 milliseconds), and the random bit string is truncated or spliced into 512 bits as the seed of the hash-DRBG algorithm. The hash-DRBG algorithm is used to iterate the initial seed 10,000 times, and the first 512 bits of the hash-DRBG algorithm output result are extracted as the random salt value.
[0068] The compressed archive data subset PatientID1.bz2 is 500MB in size. It is divided into 4 data blocks according to the data block size of 128MB: Block1, Block2, Block3, Block4. The following processing is performed on each data block: Get the metadata of data block Block1: start position: 0; end position: 128MB; Get the start time of Block1 hash operation through NTP protocol as 2023-04-0110:00:00.000, and the end time as 2023-04-0110:00:01.500, with a time difference of 1.5 seconds. Concatenate Block1 with the random salt value Salt1 to obtain the extended data block ExtBlock1; perform SR3 hash operation on ExtBlock1 to obtain a 512-bit hash value Hash1; concatenate the location information and timestamp of Block1 with the hash value Hash1 to obtain a string: "0, 134217728, 2023-04-0110:00:00.000, 2023-04-0110:00:01.500, 1.500, Hash1"; digitally sign the string to obtain the signature value Sig1; serialize the location information, timestamp, hash value, and signature value into JSON format to obtain the hash record of Block1: {"start Pos": 0, "end Pos": 134217728, "start Time": "2023-04-0110:00:00.000", "end Time": "2023-04-0110:00:01.500", "duration": 1.500, "hash": "Hash1", "signature": "Sig1"}. Repeat for Block2, Block3, and Block4 to obtain their hash records.Arrange the hash records of the four data blocks in the order of the data blocks to obtain the complete hash record of PatientID1.bz2: [{"start Pos":0,"end Pos":134217728,"startTime":"2023-04-0110:00:00.000","end Time":"2023-04-0110:00:01.500","duration":1.500,"hash":"Hash1","signature":"Sig1"},{"start Pos":134217728,"end Pos":268435456,"start Time":"2023-04-0110:00:00.000","end Time":"2023-04-0110:00:01.500","duration":1.500,"hash":"Hash1","signature":"Sig1"} Time": "2023-04-0110:00:03.200", "duration": 1.700, "hash": "Hash2", "signature": "Sig2"}, {"start Pos": 268435456, "end Pos": 402653184, "start Time": "2023-04-0110:00:03.200", "end Time": "2023-04-0110:00:04.800", "duration": 1.600, "hash": "Hash3", "signature": "Sig3"}, {"start Pos": 402653184, "end Pos": 524288000, "start Time": "2023-04-0110:00:04.800", "end Through this process, the location information, timestamp, SR3 hash value and digital signature of each data block are bound to form a complete and verifiable hash record of the archive data subset. This hash record can be stored on the blockchain for subsequent data integrity verification and auditing.
[0069] Extract the corresponding hash values from the hash records of the four data blocks to obtain a set of data block hash values: [Hash1, Hash2, Hash3, Hash4]. Use the Shamir secret sharing algorithm, set the key segmentation threshold k = 3, and divide the key into 5 subkeys (m = 5). At least 3 subkeys are required to restore the original key. Concatenate the extracted data block hash values in sequence to obtain the string: "Hash1Hash2Hash3Hash4". First, according to the preset substring length L = 128, divide the hash value sequence into 32 substrings of length 128: the hash value sequence of the data block is: "0123456789abcdef, ..., 0123456789abcdef", a total of 512 characters. Divide it into 32 substrings of length 128: substring 1: "0123456789abcdef, ..., 0123456789abcdef" (the 1st to the 128th characters), substring 2: "0123456789abcdef, ..., 0123456789abcdef" (the 129th to the 256th characters), ..., substring 32: "0123456789abcdef, ..., 0123456789abcdef" (the 3841st to the 4096th characters). Then, use the value of each substring as the y value and the substring number as the x value to form 32 coordinate points (x i ,y i ): Coordinate point 1: (1, "0123456789abcdef, ..., 0123456789abcdef"), coordinate point 2: (2, "0123456789abcdef, ..., 0123456789abcdef"); coordinate point 32: (32, "0123456789abcdef, ..., 0123456789abcdef"). Next, a third-order polynomial f(x) is generated by the threshold cryptographic algorithm: On the finite field GF(p), a large prime number p = 2 is selected. 521 -1, which ensures that the hash value can be directly used as the coefficient and constant term of the polynomial. Randomly select 3 coordinate points, substitute them into the Lagrange interpolation formula, and calculate the coefficients of the third-order polynomial f(x): Let the selected 3 coordinate points be: (x 1 ,y 1 ),(x 2 ,y 2 ), (x 3 ,y 3 ), then the expression of f(x) is: Expand and combine like terms to obtain the general form of f(x): f(x) = ax 3 +bx2 +cx+d, where a, b, c, d are the coefficients of f(x), can be obtained by substituting the x and y values of the three selected coordinate points and solving a system of three linear equations. The resulting third-order polynomial is:
[0070] f(x)=785139642x 3 +2048767352x 2 +35782193724x+908731278. At this point, the hash value sequence is divided into 32 coordinate points according to the preset substring length, and a third-order polynomial f(x) is generated through the threshold cryptographic algorithm. This polynomial plays a key role in the subsequent secret division and recovery process.
[0071] First, randomly select 29 of the 32 coordinate points generated in the previous step as evaluation points: the x values of the 29 randomly selected coordinate points are: 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113. Substitute these 29 x values into the third-order polynomial f(x) generated in the previous step and calculate the corresponding function value y:
[0072] f(3)=785139642×3 3 +2048767352×3 2 +35782193724×3+908731278=143867142551;
[0073] f(5)=785139642×5 3 +2048767352×5 2 +35782193724×5+908731278=384625836551,
[0074] f(113)=785139642×113 3 +2048767352×113 2 +35782193724×113+908731278=116834279511
[0075] Get the x value x of 29 evaluation points j and the corresponding function value y j , forming the evaluation point set {(x j ,y j)}: {(3, 143867142551), (5, 384625836551), ..., (113, 116834279511)}. Then, using the Shamir key splitting algorithm, the three coefficients of the third-order polynomial f(x) are split as the original key: f(x) = 785139642x 3 +2048767352x 2 +35782193724x+908731278, the original key is: k1=785139642, k2=2048767352, k3=35782193724, randomly generate 4 polynomial coefficients over the finite field GF(p), and construct 4 polynomials g of no more than 2nd order 1 (x),g 2 (x),g 3 (x),g 4 (x):
[0076] g 1 (x) = 976483261x 2 +1867594320x+2981475622;
[0077] g 2 (x) = 1532689014x 2 +2385691037x+762841365;
[0078] g 3 (x) = 495208361x 2 +3167840152x+149625374;
[0079] g 4 (x) = 216583941x 2 +4268319705x+1089716432;
[0080] g1(x)=976483261x^2+1867594320x+2981475622;
[0081] Substitute the original keys k1, k2, k3 into the four polynomials respectively, and calculate their function values at x=1, 2, 3: g1(1)=976483261+1867594320+2981475622=5825553203;
[0082] g1(2)=3906233044+3735188640+2981475622=10622897306;
[0083] g1(3)=8789715349+5602782960+2981475622=17373973931;
[0084] g4(3)=1949004673+12804959115+1089716432=15843680220. Perform modulo p addition operation on the calculated function value and the original key to obtain 12 subkeys:
[0085] s11=(k1+g1(1))mod p=6610692845;
[0086] s12=(k1+g1(2))mod p=11408036948;
[0087] s13=(k1+g1(3))mod p=18159113573,
[0088] s43 = (k3 + g4 (3)) mod p = 51625874944; In this way, the original key is divided into 12 subkeys using the Shamir key splitting algorithm. These 12 subkeys can be distributed to different participants for the subsequent key recovery process. At the same time, since a random polynomial of no more than 2nd order is used, the security of key splitting is guaranteed. Only when at least 3 subkeys are collected can the original key be recovered.
[0089] First, calculate the four generated polynomials g 1 (x),g 2 (x),g 3 (x),g 4 (x) Function values at 32 substring numbers x: The 32 substring numbers x are 1, 2, 3, ..., 32 respectively; substitute these 32 x values into the 4 polynomials and calculate the corresponding function values:
[0090] g1(1)=976483261+1867594320+2981475622=5825553203;
[0091] g1(2)=3906233044+3735188640+2981475622=10622897306;
[0092] g1(32)=1010387841284+59921509440+2981475622=1073290826346;
[0093] g2(1)=1532689014+2385691037+762841365=4681221416;
[0094] g2(2)=6130756056+4771382074+762841365=11664979495;
[0095] g4(32)=222784319684+136589430560+1089716432=360463466676.
[0096] Then, the calculated function value is added to the function value of the original polynomial f(x) at the corresponding x value by modulo p to obtain 5 subkey polynomials: h 1 (x) = f(x) + g 1 (x) modp; h 2 (x) = f(x) + g 2 (x) modp; h 3 (x) = f(x) + g 3 (x) modp; h 4 (x) = f(x) + g 4 (x) modp; h 5 (x) = f(x) + g 5 (x) modp; calculate the function values of these five subkey polynomials at the 32 substring sequence numbers x:
[0097] h1(1)=(f(1)+g1(1))mod p=(908731278+5825553203) mod p=6734284481;
[0098] h1(2)=(f(2)+g1(2))mod p=(35786335994+10622897306)mod p=46409233300,......,
[0099] h5(32)=f(32)mod p=1155251375938608816998. Finally, the subkey polynomial h 1 (x),h 2 (x),h 3 (x),h 4 (x),h 5(x) The function values at the 32 substring numbers x are concatenated to obtain the initial check code: Initial Code = "6734284481464092333001348942302, ..., 1155251375938608816998"; this initial check code is actually a 1024-bit large integer, which is concatenated by the function values of the 5 subkey polynomials at the 32 substring numbers. It can be used as the unique identifier of the archive data subset for subsequent data integrity verification.
[0100] First, the generated 5 subkey polynomials and the corresponding function values at the 32 substring sequence numbers x are sent to the 5 participants through a secure channel: the 5 participants are: P1, P2, P3, P4, P5. 1 (x) and the corresponding function value h at the 32 substring sequence numbers x 1 (x j ) is sent to the participant P1 and the subkey polynomial h 2 (x) and the corresponding function value h at the 32 substring sequence numbers x 2 (x j ) is sent to participant P2; the subkey polynomial h 5 (x) and the corresponding function value h at the 32 substring sequence numbers x 5 (x j ) is sent to participant P5. A secure channel is needed here to transmit the subkey polynomial and function value to prevent the data from being eavesdropped or tampered with during transmission. Secure channels include SSL / TLS encrypted communication, VPN virtual private network, hardware encryption equipment, etc. Then, each participant performs Lagrange interpolation on any three received secret shares through the secret reconstruction algorithm according to the predetermined secret recovery threshold t=3: participant P1 receives the secret shares of the other two participants, which are h 2 (x), h 3 (x) and the corresponding function value.
[0101] For each substring number x j , participant P1 uses the 3 secret shares received to make a transaction at point x j The function value at point x is restored by the Lagrange interpolation formula to obtain the original polynomial f(x) at point x. j Function value at:
[0102] Among them, x 1 , x 2 , x 3are the substring sequence number of participant P1 and the substring sequence numbers of the other two participants. In this way, participant P1 can recover the function values of the original polynomial f(x) at all 32 substring sequence numbers. Other participants can also perform a similar recovery process. Finally, the function values f(x) of the original polynomial f(x) at the 32 substring sequence numbers x are recovered. j ) are concatenated in the order of increasing x values: Recovered Code = "f(1)f(2), ..., f(32)", where f(1), f(2), ..., f(32) represent the function values of the original polynomial f(x) at substring numbers 1, 2, ..., 32 respectively. By concatenating them in the order of increasing x values, the initial check code of the hash value of the data block is obtained.
[0103] First, use the quantum random number generator to generate a random salt value of R2 bits in length, and concatenate it with the initial check code: The R2-bit random salt value generated by the quantum random number generator is: Salt = "01101001, ..., 10011010" (length is R2 bits). This random salt value is concatenated with the initial check code recovered in the previous step to obtain the extended check code: Extended Code = Initial Code||Salt = "f(1)f(2), ..., f(32)01101001, ..., 10011010" (length is 1024 + R2 bits), where "||" represents the data concatenation operation, that is, the initial check code and the random salt value are concatenated in order. Adding a random salt value can further enhance the randomness and uniqueness of the check code and prevent potential hash collision attacks. Then, the LRS hash algorithm is used to perform a hash operation on the extended check code: Assume that the output length of the LRS hash algorithm is R3 bits, and perform a hash operation on the extended check code: Final Code = LRS_Hash (Extended Code) = "10010111,..., 00101101" (length is R3 bits). The LRS hash algorithm is a lattice-based, strongly collision-resistant hash function with good randomness and security. It can map input data of any length to a hash value of a fixed length, and it is difficult to find two different input data with the same hash value. Finally, the generated check code is bound to the metadata of the archive data subset to form a check code index table: The metadata of the archive data subset includes: subset ID, timestamp, data format, data volume and other information. The check code is bound to these metadata to form a check code index table:
[0104] This verification code index table can be stored in the distributed ledger of the blockchain network for all participants to query and verify.
[0105] Subset ID Timestamp Data Format Data volume Check code 001 2022-01-01 JSON 1.5GB 10010111,......,00101101 002 2022-01-02 XML 2.3GB 01101001,......,10011010
[0106] Through the index table, it is easy to find the corresponding check code according to the metadata of the archive data subset, or to reversely trace the source and attributes of the archive data subset according to the check code.
[0107] Bind the checksum to the metadata of the subset of archive data: the unique identifier of the subset of archive data is "20220101001", the creation time is "2022-01-0109:30:00", and the owner identity is "Alice". Bind these metadata with the checksum "10010111, ..., 00101101" generated in the previous step to form a metadata record: {"id": "20220101001", "timestamp": "2022-01-0109:30:00", "owner": "Alice", "checksum": "10010111, ..., 00101101"}. Then, use the attribute-based encryption algorithm to generate the access policy key according to the attribute set of the owner identity: the attribute set of the owner Alice is {"department": "archive department", "role": "administrator", "level": "senior"}. Based on this attribute set, an access policy key is generated: Access Key = ABE_Encrypt({"Department":"Archives Department","Role":"Administrator","Level":"Senior"}), where ABE_Encrypt represents an attribute-based encryption algorithm, which can generate an access policy key based on the attribute set. Only users with qualified attribute certificates can decrypt and access the corresponding data.
[0108] Next, the generated access policy key, metadata of the archive data subset, and verification code are data-bound to generate a verification code binding record: Binding Record = {"metadata": {"id":"20220101001","timestamp":"2022-01-0109:30:00","owner":"Alice"},"checksum":"10010111,......,00101101","access_key":Access Key}. Then, the hash value of the attribute encrypted ciphertext of the verification code binding record is calculated and used as a leaf node of the Merkle tree: Leaf Node = Hash(ABE_Encrypt(Binding Record)). Here, Hash represents a hash function, and ABE_Encrypt represents attribute encryption of the binding record to generate a ciphertext. The hash value of the ciphertext is used as the leaf node of the Merkle tree. Next, the homomorphic encryption algorithm is used to perform homomorphic encryption operations on the hash values of every two adjacent leaf nodes to generate the corresponding parent node hash value: Parent Node = Homomorphic Encrypt (Left Child, Right Child). HomomorphicEncrypt here represents the homomorphic encryption algorithm, which can calculate data in an encrypted state, and the generated result is consistent with the result of the plaintext calculation after decryption. By performing homomorphic encryption on the hash values of the left and right child nodes, their parent node hash values can be obtained.
[0109] Recursively execute the homomorphic encryption merging process to pairwise merge the non-leaf nodes of the Merkle tree until the root node of the Merkle tree is generated: while(Non Leaf Nodes.length>1){New Nodes=[]for(i=0;i<NonLeaf Nodes.length;i+=2){Left Child=Non Leaf Nodes[i]Right Child=Non LeafNodes[i+1],Parent Node=Homomorphic Encrypt(Left Child,Right Child)NewNodes.push(Parent Node)},Non Leaf Nodes=New Nodes},Root Node=Non Leaf Nodes[0]. This process traverses each layer of non-leaf nodes of the Merkle tree through a loop, pairwise performs homomorphic encryption merging on them until only one root node remains. Then, use the zero-knowledge proof protocol to generate a zero-knowledge proof for the root node of the Merkle tree: Proof=ZKP_Prove(Root Node), where ZKP_Prove represents the zero-knowledge proof protocol, which can prove the correctness of the root node hash value without revealing the specific construction process of the Merkle tree. The generated proof can be used by others for verification to ensure that the Merkle tree has not been tampered with. Finally, based on the generated zero-knowledge proof of the Merkle tree, the checksum of the archival data subset, and the metadata information, construct a checksum index table: Index Table={"proof":Proof,"entries":[{"id":"20220101001","timestamp":"2022-01-01 09:30:00","owner":"Alice","checksum":"10010111,......,00101101"}}. Send the constructed checksum index table to the blockchain network through a secure channel: Block chain.Verify And Store(Index Table), and the smart contract in the blockchain network will verify the received checksum index table, check whether the zero-knowledge proof of the Merkle tree is legal, and then store the verified index table in the distributed ledger of the blockchain for all nodes to query and audit.
[0110] Store the compressed archive data subset in a distributed database: Use IPFS (Interplanetary File System) as a distributed database. IPFS is a content-addressed distributed storage protocol that can divide files into small blocks and store them in multiple nodes, achieving efficient, reliable, and decentralized data storage and sharing. Upload the compressed archive data subset to the IPFS network: Upload the local compressed file to the IPFS network through the IPFS API interface, and return the IPFS address of the file, where the 'Hash' field represents the IPFS address of the file, which is a unique identifier calculated based on the file content. The corresponding file content can be queried and obtained in the IPFS network through this address. Then, update the storage location information in the location index table: The location index table is a relational database table containing the following fields: subset_id: the unique identifier of the archive data subset, ipfs_hash: the address of the archive data subset in the IPFS network, timestamp: the creation timestamp of the archive data subset, size: the size of the archive data subset (bytes).
[0111] When the subset of archive data is successfully uploaded to the IPFS network, insert a new record into the location index table: import pymysql, connection = pymysql.connect(host = 'local host', user = 'root', password = '123456', database = 'archiving', char set = 'utf8'), try: withconnection.cursor() as cursor: sql = "INSERT INTO location_index, (subset_id, ipfs_hash, timestamp, size), VALUES (%s, %s, %s, %s)", cursor.execute(sql, ('20220101001', 'QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o', '2022-01-0110:00:00', 452191)), connection.commit(x), finally: connection.close(). Connect to the MySQL database through the pymysql library and execute an INSERT statement to insert the metadata information of the archive data subset into the location index table. Among them, subset_id is the unique identifier of the archive data subset, ipfs_hash is the address of the data subset in the IPFS network, timestamp is the creation timestamp of the data subset, and size is the compressed size of the data subset (in bytes). In this way, a mapping relationship between the archive data subset and its storage location is established. Users can query the location index table according to the identifier of the archive data subset (subset_id) to obtain the IPFS address of the corresponding data; then download and access the actual data file through IPFS related tools.
[0112] First, the check code index table is encrypted using the hash function and salt value to generate an encrypted check code index table: The original check code index table is as follows:
[0113] subset_id checksum timestamp 20220101001 10010111,......,00101101 2022-01-0110:00:00 20220101002 01101001,......,10011010 2022-01-0111:00:00
[0114] In order to protect the sensitive information in the checksum index table, you can use a hash function and a random salt value to encrypt it. The specific steps are as follows: Generate a random salt value (salt) for each record, concatenate the salt value with the key field of the record (such as subset_id), and perform a hash operation on the concatenated result to obtain the encrypted field value. Replace the original field with the encrypted field value to obtain the encrypted checksum index table.
[0115] Take the subset_id field as an example: import hash lib, import random, defencrypt_field(value, salt): concat_str=str(value)+str(salt), hash_obj=hash lib.sha256(), hash_obj.update(concat_str.encode('utf-8')), return hash_obj.hex digest(), encrypted_table=[], for record in original_table: subset_id=record['subset_id'], salt=random.randint(1000000, 9999999), encrypted_id=encrypt_field(subset_id, salt), encrypted_record={'subset_id': encrypted_id, 'checksum': record['checksum'], 'timestamp':
[0116] record['timestamp']}encrypted_table.append(encrypted_record). Traverse each record in the original verification code index table, generate a random salt value for the subset_id field, then concatenate the salt value with the subset_id and perform a SHA256 hash operation to obtain the encrypted field value, and finally replace the original field with the encrypted field value to generate the encrypted verification code index table.
[0117] The encrypted checksum index table is as follows:
[0118]
[0119] It can be seen that the subset_id field has been replaced by a hash value, and the original information cannot be directly obtained from it, while the checksum and timestamp fields remain unchanged. This not only protects key information, but also verifies data integrity. Next, encrypt the location index table of the archive data subset and store the encrypted result in the blockchain: Similarly, the key fields in the location index table can be encrypted using a hash function and a salt value to obtain an encrypted location index table:
[0120]
[0121]
[0122] Then, the encrypted location index table is stored in the distributed ledger of the blockchain network. The location index table of the archive data subset is encrypted and the encrypted result is stored in the blockchain: The original location index table is as follows:
[0123]
[0124] Encrypt the location index table using a symmetric encryption algorithm such as AES and a random key: import json, from Crypto.Cipher import AES, from Crypto.Random import get_random_bytes. Generate a random AES key, key = get_random_bytes(32). Convert the location index table to a JSON string, table_json = json.dumps(location_index_table). Encrypt the JSON string with AES, cipher = AES.new(key, AES.MODE_EAX), cipher text, tag = cipher.encrypt_and_digest(table_json.encode('utf-8')), nonce = cipher.nonce. Package the encrypted result into a JSON object, encrypted_data = {'cipher text': ipher text.hex(), 'tag': tag.hex(), 'nonce': nonce.hex()}. Next, store the encrypted result in the smart contract on the blockchain: import json, fromweb3importWeb3. Load the smart contract ABI, with open('abi.json', 'r') asf: abi = json.load(f). Instantiate the smart contract object,
[0125] contract_address = '0x1234567890123456789012345678901234567890', contract = w3.eth.contract(address = contract_address, abi = abi). Convert the encrypted data to a JSON string, encrypted_json = json.dumps(encrypted_data). Call the smart contract's storage method to store the encrypted data in the blockchain, tx_hash = contract.functions.store Encrypted Index
[0126] (encrypted_json).transact(). In this way, the encrypted location index table is securely stored on the blockchain. Even if an attacker obtains the data, he cannot decrypt the original information without knowing the key. At the same time, the AES key can be stored in a secure key management system, and only authorized users can obtain the key and decrypt the data.
[0127] Next, the encrypted checksum index table is sharded and stored in the blockchain, and the original text of the checksum index table is stored in the off-chain database: Use the same method as above to encrypt the checksum index table to obtain the encrypted checksum index table encrypted_checksum_index. Then, the encrypted checksum index table is sharded: importmath, specify the size of each shard (in bytes), CHUNK_SIZE = 1024*1024#1MB, convert the encrypted checksum index table to a byte array, table_bytes = json.dumps(encrypted_checksum_index).encode('utf-8'). Calculate the number of shards, chunk_count = math.ceil(len(table_bytes) / CHUNK_SIZE), and shard the byte array, chunks = [table_bytes[i:i+CHUNK_SIZE]for iin range(0, len(table_bytes), CHUNK_SIZE)]. First, the size of each shard is specified as 1MB, then the encryption checksum index table is converted to a byte array, the number of shards is calculated, and finally the byte array is sharded using list derivation to obtain a shard list chunks. Next, hash each shard and store the shard hash value in the Merkle tree of the blockchain: import hash lib. Calculate the SHA256 hash value of each shard, chunk_hashes = [hashlib.sha256(chunk).hexdigest()for chunk in chunks]. Build a Merkle tree: new_hashes=[], for iin range(0, len(hashes), 2): ifi+1==len(hashes): new_hashes.append(hashes[i]); else: concat_hash=hashes[i]+hashes[i+1]; new_hash=hash lib.sha256(concat_hash.encode('utf-8')).hexdigest();
[0128] new_hashes.append(new_hash); return build_Merkle_tree(new_hashes).
[0129] Calculate the root hash value of the Merkle tree, Merkle_root = build_Merkle_tree (chunk_hashes), and store the root hash value of the Merkle tree in the smart contract of the blockchain, tx_hash = contract.functions.store Merkle Root (Merkle_root).transact (), tx_receipt = w3.eth.wait For Transaction Receipt (tx_hash). First, perform SHA256 hash operation on each shard to obtain the shard hash value list chunk_hashes. Then define a recursive function build_Merkle_tree to build a Merkle tree based on the shard hash value list and return the root hash value of the Merkle tree. Next, call the build_Merkle_tree function to calculate the root hash value Merkle_root of the Merkle tree, and finally store it in the smart contract of the blockchain.
[0130] Finally, store the shard data through IPFS, and store the original text of the encrypted checksum index table in an off-chain database such as MongoDB: import ipfshttp client. Connect to the IPFS node, client = ipfshttpclient.connect(' / ip4 / 127.0.0.1 / tcp / .
[0131] First, use the smart contract to verify the subset of archive data: In the previous step, the Merkle tree root hash value of the encrypted checksum index table is stored in the smart contract of the blockchain. Now, the integrity and accuracy of the subset of archive data can be verified by the smart contract. Assuming that the subset of archive data with ID 20220101001 is to be verified, the specific steps are as follows: According to the data subset ID, query the corresponding encrypted checksum index table record in the off-chain database (such as MongoDB): {"subset_id": "20220101001", "checksum": "10010111,......,00101101", "timestamp": "2022-01-0110:00:00"}. Using the same hash function and salt value as used for encryption, subset_id is encrypted to obtain the encrypted ID: encrypted_id = encrypt_field ("20220101001", salt). In the shard data of the encrypted verification code index table, the shard containing the corresponding record of encrypted_id is located. The original data of the shard is obtained from IPFS, and its SHA256 hash value is calculated. The verification method of the smart contract is called, and the subset_id, shard index, shard hash value, and Merkle proof path are passed in: import json, fromweb3importWeb3. The verify Subset method of the smart contract is called, and the subset_id, chunk_index (shard index), chunk_hash (shard hash value), and Merkle_proof (Merkle proof path) are passed in. The smart contract execution verification logic is triggered by sending a transaction. The smart contract performs the following verification steps based on the parameters passed in: use subset_id and known salt value to calculate encrypted_id, find the corresponding shard hash value in Sparse Merkle Tree based on encrypted_id and chunk_index, check whether the Merkle proof path is valid, and verify whether chunk_hash is consistent with the hash value in the Merkle tree. If the verification passes, it means that the archive data subset is complete and accurate, otherwise there may be tampering. First, calculate encrypted_id based on subset_id, then find the corresponding shard hash value in chunk Hashes, and then use the hash value in the Merkle Proof array to calculate the hash value of the Merkle tree node from bottom to top, and finally get the root hash value, and compare it with the Merkle Root stored in the contract. If they are equal, it means the verification passes.If the verification result is true, it means that the archive data subset is complete and reliable; if the verification result is false, it means that the archive data subset may have been tampered with and further investigation is needed. In this way, the tamper-proof nature of the blockchain is used to achieve reliable verification of off-chain archive data, ensuring the integrity and accuracy of the data. Even if the database is hacked, as long as the Merkle tree root hash value is regularly uploaded to the chain, tampering can be discovered in a timely manner.
Claims
1. A blockchain-based archival data protection method, comprising: Acquire archival data, classify the acquired archival data according to a preset classification mechanism, and generate archival data subsets of different categories; wherein the preset classification mechanism includes classification according to sensitivity and business type of the archival data; Perform compression processing on the classified subset of archival data; Generate a location index table for the compressed archive data subset, the location index table including storage location and occupied space; Generate a check code of the compressed archive data subset using a cryptographic algorithm, and generate a check code index table based on the check code; The compressed archive data subset is stored in the distributed database, and the storage location information in the location index table is updated; The check code index table is encrypted using a hash function and a random salt value to generate an encrypted check code index table; Encrypt the location index table of the archive data subset and store the encrypted location index table in the blockchain; The encrypted check code index table is sharded, and the sharded check code index table is stored in the blockchain; wherein the original text of the check code index table is transmitted through the channel and stored in the off-chain database; Deploy smart contracts based on blockchain, use smart contracts to verify subsets of archive data, and verify whether the verification code on the blockchain is consistent with the original verification code in the off-chain database to verify the integrity of the archive data; Compress a subset of archive data, including: Performing data partitioning on the archive data subset to obtain multiple data blocks; Perform hash operation on each data block to obtain the hash record of each data block; Perform a combined hash operation on the hash records of each data block to obtain a check code of the archive data subset, and generate a check code index table based on the check code; Binding the verification code with the metadata of the corresponding archive data subset to generate verification code metadata; wherein the metadata includes the identifier, timestamp and access policy of the archive data subset; According to the check code metadata, the data block is encoded using an error correction coding algorithm to generate a corresponding check block; The data blocks, corresponding check blocks and check code index table of the archive data subset are stored to obtain redundant coded data; The redundant coded data obtained is compressed using a compression algorithm to obtain a compressed archive data subset.
2. The archival data protection method based on blockchain according to claim 1 is characterized in that: Perform a hash operation on each data block to obtain a hash record of each data block, including: Generate a random salt value with a length greater than Q bits through a random number generator; Concatenate the generated random salt value with each data block to obtain an extended data block; Use the SR3 algorithm to perform hash operation on the extended data block to obtain the hash value of the data block; The metadata of the data block including the location information and the timestamp is obtained, and the obtained metadata is concatenated with the obtained hash value to generate a hash record of the data block.
3. The archival data protection method based on blockchain according to claim 2 is characterized in that: Generate a random salt value greater than Q bits in length using a random number generator, including: Determine the length of the initial seed in the hash-DRBG algorithm based on the output length of the hash function SHA-512; Generate a true random number of the same length as the determined length through a quantum entropy source as the initial seed of the hash-DRBG algorithm; Set the number of iterations of the hash-DRBG algorithm and the length of the generated random number; The hash-DRBG algorithm is used to perform multiple iterations on the obtained initial seed, and the number of iterations is the set number of iterations; From the final output of the hash-DRBG algorithm, extract the random bit string of the first R1 bits as the candidate random salt value; Determine whether the length of the extracted candidate random salt value is greater than or equal to Q bits. If not, use the candidate random salt value as a new seed and repeat the steps of iterative operation and extracting the candidate random salt value until a random salt value with a length greater than Q bits is obtained.
4. The archival data protection method based on blockchain according to claim 3 is characterized in that: Generate a random number with the same length as the initial seed through an entropy source, including: The quantum random number generator is used to measure the time interval between atomic decays to obtain a random bit string. The random bit string is truncated or concatenated to generate a true random number with the same length as the preset initial seed as the initial seed.
5. The archival data protection method based on blockchain according to claim 4 is characterized in that: Obtain metadata including location information and timestamp of the data block, concatenate the obtained metadata with the obtained hash value, and generate a hash record of the data block, including: Obtaining location information of the data block, the location information including the starting position and the ending position of the data block in the archive data subset; The start time and end time of the data block hash operation are obtained through the network time protocol QTP, and the start time, end time and corresponding difference are used as the timestamp of the data block hash operation; Digitally sign the location information, timestamp and hash value of the acquired data block to obtain a digital signature value; The obtained data block's location information, timestamp, hash value and corresponding digital signature value are serialized to generate a hash record of the data block.
6. The blockchain-based archival data protection method according to any one of claims 1 to 5, characterized in that: Hash records of each data block are hashed to obtain the checksum of the archive data subset, including: Extract the corresponding hash value from the hash record of each data block to obtain a set of data block hash values; The Shamir secret sharing algorithm based on threshold cryptography is used to generate the key splitting threshold, and the key is split into N subkeys. At least M subkeys are required to restore the original key. The hash values of a group of extracted data blocks are concatenated in order, and the concatenated hash values are encrypted using the generated key segmentation threshold to obtain an initial check code; A quantum random number generator is used to generate a random salt value of R2 bits in length, and the generated random salt value is concatenated with the initial check code to obtain an extended check code. The extended check code is hashed using the LRS hash algorithm to obtain a check code of the archive data subset with a length of R3 bits; The generated check code of the archive data subset is bound to the metadata of the archive data subset to form a check code index table.
7. The archival data protection method based on blockchain according to claim 6 is characterized in that: Concatenate the obtained hash values, use the generated segmentation threshold to perform key encryption, and generate the initial verification code, including: Arrange the obtained hash values in sequence according to the order of the data blocks in the archive data subset to obtain a hash value sequence; According to the preset substring length L, the hash value sequence is divided into n substrings of length L, the value of each substring is used as the y value of a coordinate point, and the sequence number of the substring is used as the x value of the corresponding coordinate point, forming n coordinate points (x i ,y i ); Generate a k-order polynomial f(x) through a threshold cryptographic algorithm, where k is the key split threshold and k is less than the number of coordinate points n; Calculate nk coordinate points (x i ,y i ) as the evaluation point, calculate the function value of the evaluation point on the polynomial f(x), and obtain the x value xj and the corresponding function value yj of nk evaluation points, forming the evaluation point set {(x j ,y j )}; Using Shamir's key splitting algorithm, the k coefficients of the generated k-order polynomial f(x) are used as the original key, and m-1 polynomial coefficients are randomly generated over the finite field GF(p), and m-1 polynomials g1(x), g2(x), ..., g are constructed with an order not exceeding k-1. m-1 (x); Calculate the function values of the generated m-1 polynomials at the n substring sequence numbers x, and perform a membrane p addition operation on the calculated function values and the function values of f(x) at the corresponding x values to obtain m subkey polynomials h1(x), h2(x), ..., h m (x); Subkey polynomials h1(x),h2(x),......,h m (x) Concatenate the function values at the n substring sequence numbers x to get the initial check code.
