Data storage method and system based on national secret

Through the data storage method based on the Guomi algorithm, combining differential privacy processing and the encryption and signature mechanism of the Guomi algorithm SM4 and SM2, the problem of insufficient data security and privacy protection in the existing technology is solved, and multi-level data protection is realized , improves the security and reliability of data processing, and ensures the confidentiality and integrity of data during storage and transmission.

CN119047002APending Publication Date: 2024-11-29ZHUBEN (SHANGHAI) SOFTWARE TECHNOLOGY CO LTD

Patent Information

Application Number
CN202410951635.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The existing data storage methods have shortcomings in data security and privacy protection, and cannot effectively deal with complex attacks and tampering behaviors. The noise generation and data processing of differential privacy methods still need to be improved, and the data is stored. The integrity verification and dynamic monitoring mechanism during transmission are not perfect enough, resulting in data leakage, tampering and untraceable problems.

Method used

Using the data storage method based on the Guomi algorithm, combining differential privacy processing and the encryption and signature mechanism of the Guomi algorithm SM4 and SM2, through data segmentation, differential privacy processing, encryption and digital signature, data storage and index generation, and periodic checksum Dynamic verification and other steps to achieve multi-level protection of data. Specifically, it includes steps such as data segmentation, differential privacy processing, data encryption and digital signature, data storage and index generation, data verification and dynamic verification, etc., and the encryption processing is used for the Guoxin algorithm SM4, and the Guoxin algorithm SM2 generates a digital signature, combined with Blockchain technology and dynamic hashing algorithms are used for real-time monitoring and verification.

Benefits of technology

Through the combination of differential privacy processing and national secret algorithm, data is ensured to have high security before encryption, the security and reliability of data processing are improved, the confidentiality and integrity of data during storage and transmission are ensured, and the data is realized The efficient retrieval and security management enhances the overall security and credibility of the data storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119047002A_ABST
    Figure CN119047002A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data storage, in particular to a national secret-based data storage method and system, and the method comprises the following steps: S1, data segmentation: segmenting to-be-stored data; s2, data disturbance processing based on differential privacy: performing differential privacy processing on each data block; s3, data encryption and digital signature: obtaining an encrypted data block, and generating digital signature information; s4, data storage and index generation: storing the encrypted data blocks and the digital signature information corresponding to the encrypted data blocks in a database; s5, data verification and dynamic verification: after data storage is completed, carrying out regular verification on the stored encrypted data blocks and the digital signature information corresponding to the encrypted data blocks; and S6, data decryption and signature verification: obtaining original data. According to the method and the device, the effectiveness and the accuracy of differential privacy processing are ensured, so that the security and the reliability of data processing are improved while the data privacy is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data storage technology, and in particular to a data storage method and system based on national encryption. Background Art

[0002] With the rapid development of information technology and the growing demand for data storage, secure storage and privacy protection of data have become key areas of current research. Driven by technologies such as big data, cloud computing, and the Internet of Things, various data storage and processing technologies are becoming increasingly mature, and data security and privacy protection issues are becoming increasingly prominent. Especially in areas with high security and high privacy requirements such as government, finance, and medical care, how to effectively protect data security and privacy has become an issue that needs to be urgently addressed.

[0003] Although many existing data storage methods can achieve a certain degree of data encryption and privacy protection, they still have many shortcomings. For example, traditional encryption methods mainly rely on a single encryption algorithm and cannot cope with complex attacks and tampering. Although differential privacy methods can protect data privacy, in practical applications, the effectiveness and reliability of noise generation and data processing need to be further improved. In addition, the integrity verification and dynamic monitoring mechanisms of data during storage and transmission are not perfect, which can easily lead to problems such as data leakage, tampering and non-traceability. These shortcomings seriously restrict the development and application of data security storage technology.

[0004] The present invention aims to overcome the shortcomings of the prior art and proposes a data storage method based on the national secret algorithm, which realizes multi-level protection of data by combining differential privacy processing with the encryption and signature mechanism of the national secret algorithms SM4 and SM2. Summary of the invention

[0005] Based on the above objectives, the present invention provides a data storage method and system based on national encryption.

[0006] A data storage method based on national encryption includes the following steps:

[0007] S1, data segmentation: segment the data to be stored according to a preset size to obtain multiple data blocks;

[0008] S2, data perturbation processing based on differential privacy: Perform differential privacy processing on each data block, protect data privacy by adding random noise, and form a perturbed data block, including:

[0009] S21, data block initialization: mark each data block as an original data block, initialize its privacy parameters, and set different privacy protection levels according to the sensitivity of the data;

[0010] S22, random noise generation: using the differential privacy algorithm to generate corresponding random noise for each original data block;

[0011] S23, noise addition: adding the generated random noise to the corresponding original data block to form a disturbed data block;

[0012] S24, disturbed data block verification: verify the disturbed data block after adding noise. If the verification fails, regenerate noise and add it again until the requirements are met;

[0013] S25, disturbed data block output: output the disturbed data block after noise addition and verification;

[0014] S3, data encryption and digital signature: Use the national secret algorithm SM4 to encrypt each disturbed data block to obtain an encrypted data block, and generate a corresponding digital signature for each encrypted data block, and use the national secret algorithm SM2 to sign the encrypted data block to generate digital signature information;

[0015] S4, data storage and index generation: storing the encrypted data block and its corresponding digital signature information in a database, generating a unique index identifier for each encrypted data block, and storing the index identifier in association with the encrypted data block and the digital signature information;

[0016] S5, data verification and dynamic validation: after the data storage is completed, the stored encrypted data blocks and their corresponding digital signature information are regularly verified;

[0017] S6, data decryption and signature verification: When the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, and the national secret algorithm SM4 is used to decrypt it to obtain the original data.

[0018] Furthermore, the data segmentation in S1 includes:

[0019] S11, data preprocessing: preprocessing the data to be stored to remove redundant and invalid information in the data to be stored;

[0020] S12, segmentation rule setting: determining the size of the data block according to the preset segmentation rule and the actual situation of the data to be stored, the segmentation rule includes data type, data structure and storage requirements;

[0021] S13, data segmentation execution: according to the set segmentation rule, the data to be stored is segmented into multiple data blocks of uniform size, and the amount of data contained in each data block is consistent with the preset segmentation size;

[0022] S14, data block numbering: numbering each data block obtained by segmentation.

[0023] Furthermore, the data block initialization in S21 includes:

[0024] S211, data block marking: mark each data block as an original data block and record its unique identifier (Block_ID);

[0025] S212, privacy parameter initialization: Initialize the privacy parameters for each original data block, and set different privacy protection levels according to the sensitivity and classification of the data, including:

[0026] S2121, Sensitivity Assessment: Each raw data block is assessed for sensitivity and classified into different levels, including high sensitivity, medium sensitivity and low sensitivity, according to the sensitivity and importance of the data content;

[0027] S2122, privacy protection level setting: assign each original data block to a corresponding privacy protection level according to its sensitivity, expressed as:

[0028]

[0029] S2123, privacy parameter configuration: configure corresponding privacy parameters for each original data block, including noise amplitude and disturbance intensity.

[0030] Furthermore, the differential privacy algorithm in S22 adopts a smoothing sensitivity mechanism, and the smoothing sensitivity mechanism includes:

[0031] S221, data block initialization: marking the data block as an original data block and initializing its privacy parameters;

[0032] S222, calculate smoothed sensitivity: calculate smoothed sensitivity according to the sensitivity of the data block, the privacy budget parameter and the dynamic adjustment factor, and the calculation formula is:

[0033] S(x)=max x '∈B(x,r)(Δf·e -d(x,x') )×AF;

[0034] Where S(x) is the smoothed sensitivity, Δf is the sensitivity of the data block, is the privacy budget parameter, B(x,r) is the neighborhood with radius r, d(x,x') is the distance between data, and AF is the dynamic adjustment factor;

[0035] S223, calculate the noise standard deviation: use the smoothing sensitivity to calculate the noise standard deviation, the calculation formula is:

[0036]

[0037] Where, σ is the noise standard deviation;

[0038] S224, generate Gaussian noise:

[0039] Generate two uniformly distributed random numbers u1 and u2: u1, u2 ~ U(0,1);

[0040] Generate a random number z0 from a standard normal distribution using the Box-Muller transformation:

[0041] Generate random noise of target Gaussian distribution: Noise(x) = σ·z0;

[0042] S225, adding noise: adding the generated Gaussian noise to the original data block to form a disturbed data block. The calculation formula is:

[0043] D′=D+Noise(x);

[0044] Among them, D is the original data block data, and D' is the perturbed data block after adding noise.

[0045] Furthermore, the disturbance data block check in S24 includes:

[0046] S241, verification standard setting: setting verification standards according to the preset privacy protection level and data integrity requirements, the verification standards including statistical characteristics of the data and the range of noise amplitude;

[0047] S242, disturbed data block verification: verify the disturbed data block after adding noise to check whether the disturbed data block meets the preset verification standard. The calculation formula is:

[0048]

[0049] Where D' is the perturbed data block after adding noise, and D is the original data block;

[0050] S243, regenerate noise: if the verification result is not passed, regenerate noise and add it to the original data block, and verify again until the verification result is passed.

[0051] Furthermore, the data encryption and digital signature in S3 include:

[0052] S31, data encryption: Use the national secret algorithm SM4 to encrypt each disturbance data block to obtain an encrypted data block, specifically including:

[0053] Key generation: Generate or obtain the key K used for SM4 encryption;

[0054] Encryption processing: Use the SM4 algorithm and key K to encrypt the disturbance data block D' to generate the encrypted data block C. The calculation formula is:

[0055] C = SM4_Encrypt (K, D');

[0056] Among them, SM4_Encrypt represents the process of encryption using the SM4 algorithm;

[0057] S32, digital signature generation: Generate a corresponding digital signature for each encrypted data block, use the national secret algorithm SM2 to sign the encrypted data block, and generate digital signature information, specifically including:

[0058] Key pair generation: Generate or obtain the private key SK and public key PK for SM2 signature;

[0059] Signature generation: Use the SM2 algorithm and private key SK to sign the encrypted data block C and generate a digital signature S. The calculation formula is:

[0060] S = SM2_Sign (SK, C);

[0061] Among them, SM2_Sign represents the process of digital signature using SM2 algorithm.

[0062] Furthermore, the data storage and index generation in S4 includes:

[0063] S41, data storage: storing the encrypted data block C and its corresponding digital signature information S in a database;

[0064] S42, generating a unique index identifier: generating a unique index identifier Index for each encrypted data block, specifically including:

[0065] S421, use a hash function to perform hash calculation on the encrypted data block to generate a unique identification ID C , the calculation formula is:

[0066] ID C =Hash(C);

[0067] S422, using a hash function to perform hash calculation on the digital signature information to generate a unique identification ID S , the calculation formula is:

[0068] ID S =Hash(S);

[0069] S423, Merge ID C and ID S Generate the final unique index identifier Index, the calculation formula is:

[0070] Index=ID C ⊕ID S ;

[0071] Among them, ⊕ represents the XOR operation, which is used to merge two hash values;

[0072] S43, associated storage: the generated unique index identifier Index is associated with the encrypted data block C and its corresponding digital signature information S and stored in the database.

[0073] Furthermore, the data verification and dynamic validation in S5 include:

[0074] S51, calibration plan setting: formulate a regular calibration plan, including setting the calibration frequency and time interval;

[0075] S52, data verification: at a predetermined verification time, the stored encrypted data block C and its corresponding digital signature information S are verified, specifically including:

[0076] Extract stored data: extract the encrypted data block C and its corresponding digital signature information S from the database;

[0077] Digital signature verification: Use the public key PK of the national secret algorithm SM2 to verify the digital signature of the extracted encrypted data block C;

[0078] S53, Dynamic Verification: Combine blockchain technology and dynamic hashing algorithm to monitor and verify the storage and transmission process of each encrypted data block in real time, including:

[0079] Hash value calculation: Calculate the current hash value H for each encrypted data block C C , the calculation formula is:

[0080] H C = SHA-256(C);

[0081] Blockchain record: Hash value H C Recorded on the blockchain;

[0082] Real-time verification: compare the current hash value H regularly and in real time C The hash value H recorded in the blockchain C ', if any inconsistency is found, an alarm is issued and the abnormality is recorded.

[0083] Furthermore, the data decryption and signature verification in S6 include:

[0084] S61, data retrieval: when it is necessary to read the stored data, the corresponding encrypted data block C and its corresponding digital signature information S are retrieved through the unique index identifier Index;

[0085] S62, digital signature verification: use the public key PK of the national secret algorithm SM2 to perform digital signature verification on the extracted encrypted data block C;

[0086] S63, data decryption: If the signature verification is passed, the encrypted data block C is decrypted using the national secret algorithm SM4 and the preset decryption key K to obtain the original data D'.

[0087] A data storage system based on national secrets, used to implement the above-mentioned data storage method based on national secrets, includes the following modules:

[0088] Data segmentation module: divides the data to be stored into a preset size to obtain multiple data blocks;

[0089] Data perturbation processing module: Perform differential privacy processing on each data block, protect data privacy by adding random noise, and form a perturbed data block;

[0090] Data encryption and digital signature module: Use the national secret algorithm SM4 to encrypt each disturbed data block to obtain an encrypted data block, and use the national secret algorithm SM2 to generate the corresponding digital signature information for the encrypted data block;

[0091] Data storage and index generation module: stores the encrypted data block and its corresponding digital signature information in the database, generates a unique index identifier for each encrypted data block, and stores the index identifier in association with the encrypted data block and the digital signature information;

[0092] Data verification and dynamic authentication module: After data storage is completed, the stored encrypted data blocks and their corresponding digital signature information are regularly verified;

[0093] Data decryption and signature verification module: When the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, and the national secret algorithm SM4 is used to decrypt it to obtain the original data.

[0094] Beneficial effects of the present invention:

[0095] The present invention ensures that the data has high security before encryption by performing differential privacy processing on the data blocks. Even if the data blocks are intercepted before encryption, the attacker cannot restore the original data. The smooth sensitivity mechanism and Gaussian noise generation are combined to dynamically adjust the noise standard deviation and sensitivity. The adjustment factor is flexibly introduced according to the privacy protection level of the data to generate an appropriate noise amplitude, thereby ensuring the effectiveness and accuracy of differential privacy processing, thereby protecting data privacy while improving the security and reliability of data processing.

[0096] The present invention encrypts the disturbance data block by using the national secret algorithm SM4, and generates a digital signature for the encrypted data block by using the national secret algorithm SM2, thereby ensuring the confidentiality and integrity of the data during storage and transmission. The generation and storage of the encrypted data block and its digital signature information ensure the data is tamper-proof and has source reliability. Combined with the generation and associated storage of unique index identifiers, the retrieval efficiency and management convenience of the data block are improved, thereby achieving efficient retrieval and secure management of the data.

[0097] The present invention verifies the integrity and reliability of the stored encrypted data blocks and their corresponding digital signature information through regular verification and dynamic validation, and combines blockchain technology and dynamic hash algorithm to ensure the non-tamperability and traceability of data during the entire storage and transmission process, ensure the accuracy and security of data processing, and improve the overall security and credibility of the data storage system. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0099] Figure 1 A schematic diagram of a storage method flow chart of an embodiment of the present invention;

[0100] Figure 2 Schematic diagram of system function modules according to an embodiment of the present invention. DETAILED DESCRIPTION

[0101] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.

[0102] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0103] like Figure 1 As shown, a data storage method based on national encryption includes the following steps:

[0104] S1, data segmentation: segment the data to be stored according to a preset size to obtain multiple data blocks;

[0105] S2, data perturbation processing based on differential privacy: Perform differential privacy processing on each data block, protect data privacy by adding random noise, and form a perturbed data block, including:

[0106] S21, data block initialization: mark each data block as an original data block, initialize its privacy parameters, and set different privacy protection levels according to the sensitivity of the data;

[0107] S22, random noise generation: using the differential privacy algorithm to generate corresponding random noise for each original data block;

[0108] S23, noise addition: adding the generated random noise to the corresponding original data block to form a perturbed data block, ensuring that even if the data block is intercepted before encryption, the attacker cannot restore the original data;

[0109] S24, verification of disturbed data block: verify the disturbed data block after adding noise to ensure that it meets the set privacy protection requirements. If the verification fails, regenerate noise and add it again until the requirements are met;

[0110] S25, disturbed data block output: output the disturbed data block after noise addition and verification, to facilitate subsequent encryption processing;

[0111] S3, data encryption and digital signature: Use the national secret algorithm SM4 to encrypt each disturbed data block to obtain an encrypted data block, and generate a corresponding digital signature for each encrypted data block, and use the national secret algorithm SM2 to sign the encrypted data block to generate digital signature information;

[0112] S4, data storage and index generation: the encrypted data block and its corresponding digital signature information are stored in the database, a unique index identifier is generated for each encrypted data block, and the index identifier is associated with the encrypted data block and the digital signature information for storage, so as to facilitate subsequent data retrieval and verification;

[0113] S5, data verification and dynamic verification: After the data is stored, the stored encrypted data blocks and their corresponding digital signature information are regularly verified to ensure the integrity and reliability of the data by verifying the digital signature;

[0114] S6, data decryption and signature verification: when the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, and the national secret algorithm SM4 is used to decrypt it to obtain the original data;

[0115] Through the above steps, multi-level protection of data is achieved, ensuring the privacy and security of data during storage and transmission, enhancing data integrity and reliability, and improving the efficiency of data retrieval and decryption. It is suitable for data storage application scenarios that require high security and privacy protection.

[0116] The data segmentation in S1 includes:

[0117] S11, data preprocessing: preprocess the data to be stored, remove redundant and invalid information in the data to be stored, and ensure the validity and consistency of the data;

[0118] S12, segmentation rule setting: determining the size of the data block according to the preset segmentation rule and the actual situation of the data to be stored, the segmentation rule includes data type, data structure and storage requirements;

[0119] S13, data segmentation execution: according to the set segmentation rule, the data to be stored is segmented into multiple data blocks of uniform size, and the amount of data contained in each data block is consistent with the preset segmentation size;

[0120] Data segmentation execution specifically includes:

[0121] Determine the data block size: set the data block size BS in bytes;

[0122] Calculate the number of data blocks: Calculate the number of data blocks based on the total size TDS of the data to be stored. The calculation formula is:

[0123]

[0124] in, Indicates rounding up operation;

[0125] Data segmentation: The data to be stored is divided into N data blocks in sequence. The size of each data block is BS. If the remaining data in the last data block is less than BS, it contains all the remaining data.

[0126] S14, data block numbering: numbering each data block obtained by segmentation to ensure that each data block can be uniquely identified and traced in the subsequent processing process;

[0127] Through the above content, the effectiveness and consistency of data segmentation are ensured, and the specific calculation formula is used to accurately determine and segment the data block size, which ensures the uniformity of the data block and the convenience of management. The traceability and efficient retrieval of the data block are achieved through unique numbering, which improves the efficiency and reliability of data storage and processing.

[0128] The data block initialization in S21 includes:

[0129] S211, data block marking: mark each data block as an original data block and record its unique identifier (Block_ID) for subsequent processing and tracing;

[0130] S212, privacy parameter initialization: Initialize the privacy parameters for each original data block, and set different privacy protection levels according to the sensitivity and classification of the data, including:

[0131] S2121, Sensitivity Assessment: Each raw data block is assessed for sensitivity and classified into different levels, including high sensitivity, medium sensitivity and low sensitivity, according to the sensitivity and importance of the data content;

[0132] S2122, privacy protection level setting: assign each original data block to a corresponding privacy protection level according to its sensitivity, expressed as:

[0133]

[0134] S2123, privacy parameter configuration: configure corresponding privacy parameters for each original data block, including noise amplitude and disturbance intensity, to ensure the effectiveness of differential privacy processing.

[0135] Through the above steps, the data blocks are marked and privacy parameters are configured, different privacy protection levels are set according to the sensitivity of the data, and the appropriate noise amplitude is generated using a specific calculation formula to ensure the effectiveness and accuracy of differential privacy processing, thereby protecting data privacy while improving the security and reliability of data processing.

[0136] The differential privacy algorithm in S22 adopts a smooth sensitivity mechanism, which includes:

[0137] S221, data block initialization: marking the data block as an original data block and initializing its privacy parameters;

[0138] S222, calculate smoothed sensitivity: calculate smoothed sensitivity according to the sensitivity of the data block, the privacy budget parameter and the dynamic adjustment factor, and the calculation formula is:

[0139] S(x)=max x '∈B(x,r)(Δf·e -d(x,x') )×AF;

[0140] Among them, S(x) is the smoothed sensitivity, Δf is the sensitivity of the data block, is the privacy budget parameter, B(x,r) is the neighborhood with radius r, d(x,x') is the distance between data, and AF is the dynamic adjustment factor, which is dynamically adjusted according to the privacy protection level of the data block;

[0141] The calculation formula of the dynamic adjustment factor AF is:

[0142]

[0143] S223, calculate the noise standard deviation: use the smoothing sensitivity to calculate the noise standard deviation, the calculation formula is:

[0144]

[0145] Where, σ is the noise standard deviation;

[0146] S224, generate Gaussian noise:

[0147] Generate two uniformly distributed random numbers u1 and u2: u1, u2 ~ U(0,1);

[0148] Generate a random number z0 from a standard normal distribution using the Box-Muller transformation:

[0149] Generate random noise of target Gaussian distribution: Noise(x) = σ·z0;

[0150] S225, adding noise: adding the generated Gaussian noise to the original data block to form a disturbed data block. The calculation formula is:

[0151] D′=D+Noise(x);

[0152] Where D is the original data block, and D' is the perturbed data block after adding noise;

[0153] Through the above content, the noise standard deviation and sensitivity are dynamically adjusted, the adjustment factor is flexibly introduced according to the privacy protection level of the data, Gaussian noise is generated and added to the data block, ensuring the privacy protection effect of the data during storage and processing, improving the security and reliability of data processing, while maintaining the accuracy and availability of the data.

[0154] The disturbance data block check in S24 includes:

[0155] S241, verification standard setting: setting verification standards according to the preset privacy protection level and data integrity requirements, the verification standards including statistical characteristics of the data and the range of noise amplitude;

[0156] S242, disturbed data block verification: verify the disturbed data block after adding noise to check whether the disturbed data block meets the preset verification standard. The calculation formula is:

[0157]

[0158] Where D' is the disturbed data block after adding noise, the verification threshold is set according to the privacy protection level of the data block, and D is the original data block;

[0159] S243, regenerate noise: if the verification result is not passed, regenerate noise and add it to the original data block, and verify again until the verification result is passed;

[0160] Through the above steps, it is ensured that the perturbed data block still meets the preset privacy protection and data integrity requirements after adding noise, thereby improving the reliability and security of data processing.

[0161] Data encryption and digital signatures in S3 include:

[0162] S31, data encryption: Use the national secret algorithm SM4 to encrypt each disturbance data block to obtain an encrypted data block, specifically including:

[0163] Key generation: Generate or obtain the key K used for SM4 encryption;

[0164] Encryption processing: Use the SM4 algorithm and key K to encrypt the disturbance data block D' to generate the encrypted data block C. The calculation formula is:

[0165] C = SM4_Encrypt (K, D');

[0166] Among them, SM4_Encrypt represents the process of encryption using the SM4 algorithm;

[0167] The encryption process of SM4_Encrypt specifically includes:

[0168] Key expansion: SM4 uses a 128-bit (16-byte) key K to generate 32 round keys K i , the calculation formula is:

[0169] K0=K⊕FK0;

[0170] K1=K⊕FK1;

[0171] K2=K⊕FK2;

[0172] K3=K⊕FK3;

[0173] Where FK is a fixed parameter, i = 0, 1, 2, ..., 3;

[0174] Round function: SM4 uses 32 rounds of encryption, and the encryption function of each round is:

[0175] X i+4 =X i ⊕F(X i+1 ,X i+2 ,X i+3 ,K i );

[0176] Among them, F is a nonlinear transformation function, including S-box transformation and linear transformation;

[0177] Encrypted output: The final output is the encrypted data block C, and the calculation formula is:

[0178] C=(X 35 ,X 34 ,X 33 ,X 32 );

[0179] Among them, X i represents the median value of the i-th round;

[0180] S32, digital signature generation: Generate a corresponding digital signature for each encrypted data block, use the national secret algorithm SM2 to sign the encrypted data block, and generate digital signature information, specifically including:

[0181] Key pair generation: Generate or obtain the private key SK and public key PK for SM2 signature;

[0182] Signature generation: Use the SM2 algorithm and private key SK to sign the encrypted data block C and generate a digital signature S. The calculation formula is:

[0183] S = SM2_Sign (SK, C);

[0184] Among them, SM2_Sign represents the process of digital signature using SM2 algorithm;

[0185] The signing process of SM2_Sign specifically includes:

[0186] Key pair generation: Generate the private key SK and public key PK on the elliptic curve. The calculation formula is:

[0187] PK = SK·G;

[0188] Where G is the base point on the elliptic curve;

[0189] Calculate the message digest: Use the SM3 hash algorithm to perform a hash operation on the message M to obtain the message digest e. The calculation formula is:

[0190] e = SM3_Hash (M);

[0191] Generate a signature value:

[0192] Select a random number k: k∈[1,n-1];

[0193] Where n is the order of the elliptic curve;

[0194] Calculate the curve point (x1, y1): (x1, y1) = k·G;

[0195] Calculate the signature values ​​r and s:

[0196] r = (e + x1) mod n;

[0197] s=(k -1 ·(r·SK+e))mod n;

[0198] Among them, k -1 represents the modular inverse of k;

[0199] Signature output: The final signature result is (r, s), expressed as:

[0200] S = (r, s);

[0201] Through the above content, the disturbed data block is encrypted using the national secret algorithm SM4 to ensure the confidentiality of the data during storage and transmission. The encrypted data block is then digitally signed using the national secret algorithm SM2 to provide data integrity verification and source authentication. The combination of these two algorithms can prevent unauthorized access and detect data tampering, ensuring data security, reliability and non-repudiation.

[0202] Data storage and index generation in S4 include:

[0203] S41, data storage: storing the encrypted data block C and its corresponding digital signature information S in the database to ensure the integrity and security of the data;

[0204] S42, generating a unique index identifier: generating a unique index identifier Index for each encrypted data block, specifically including:

[0205] S421, use a hash function to perform hash calculation on the encrypted data block to generate a unique identification ID C , the calculation formula is:

[0206] ID C =Hash(C);

[0207] S422, using a hash function to perform hash calculation on the digital signature information to generate a unique identification ID S , the calculation formula is:

[0208] ID S =Hash(S);

[0209] S423, Merge ID C and ID S Generate the final unique index identifier Index, the calculation formula is:

[0210]

[0211] in, Represents the XOR operation, which is used to merge two hash values;

[0212] S43, associated storage: the generated unique index identifier Index is associated with the encrypted data block C and its corresponding digital signature information S and stored in the database;

[0213] Through the above steps, the encrypted data blocks and their corresponding digital signature information are securely stored in the database, and a unique index identifier is generated for each data block to ensure efficient retrieval and secure management of data.

[0214] Data verification and dynamic validation in S5 include:

[0215] S51, verification plan setting: formulate a regular verification plan, including setting the verification frequency and time interval, to ensure that the integrity of the stored data is verified regularly;

[0216] S52, data verification: at a predetermined verification time, the stored encrypted data block C and its corresponding digital signature information S are verified, specifically including:

[0217] Extract stored data: extract the encrypted data block C and its corresponding digital signature information S from the database;

[0218] Digital signature verification: Use the public key PK of the national secret algorithm SM2 to perform digital signature verification on the extracted encrypted data block C to ensure the integrity and source reliability of the data. The calculation formula is:

[0219] Verification result = SM2_Verify (PK, C, S);

[0220] Among them, SM2_Verify represents the process of signature verification using SM2 algorithm;

[0221] S53, Dynamic Verification: Combine blockchain technology and dynamic hashing algorithm to monitor and verify the storage and transmission process of each encrypted data block in real time, including:

[0222] Hash value calculation: Calculate the current hash value H for each encrypted data block C C , the calculation formula is:

[0223] H C = SHA-256(C);

[0224] Blockchain record: Hash value H C Recorded on the blockchain to ensure that the data cannot be tampered with and is traceable;

[0225] Real-time verification: compare the current hash value H regularly and in real time C The hash value H recorded in the blockchain C ', if any inconsistency is found, an alarm is issued and the abnormality is recorded;

[0226] Through the above steps, after the data storage is completed, the integrity and reliability of the stored encrypted data blocks and their corresponding digital signature information are ensured through regular verification and dynamic verification, thereby improving the security and credibility of the data storage system.

[0227] Data decryption and signature verification in S6 include:

[0228] S61, data retrieval: when it is necessary to read the stored data, the corresponding encrypted data block C and its corresponding digital signature information S are retrieved through the unique index identifier Index;

[0229] S62, digital signature verification: use the public key PK of the national secret algorithm SM2 to perform digital signature verification on the extracted encrypted data block C;

[0230] S63, data decryption: if the signature verification is passed, the encrypted data block C is decrypted using the national secret algorithm SM4 and the preset decryption key K to obtain the original data D';

[0231] Through the above steps, when the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, decrypted using the national secret algorithm SM4, and signature verification is performed using the national secret algorithm SM2 to ensure the integrity, security and reliability of the data.

[0232] like Figure 2 As shown, a data storage system based on national secrets is used to implement the above-mentioned data storage method based on national secrets, including the following modules:

[0233] Data segmentation module: divides the data to be stored into a preset size to obtain multiple data blocks;

[0234] Data perturbation processing module: Perform differential privacy processing on each data block, protect data privacy by adding random noise, and form a perturbed data block;

[0235] Data encryption and digital signature module: Use the national secret algorithm SM4 to encrypt each disturbed data block to obtain an encrypted data block, and use the national secret algorithm SM2 to generate the corresponding digital signature information for the encrypted data block;

[0236] Data storage and index generation module: stores the encrypted data block and its corresponding digital signature information in the database, generates a unique index identifier for each encrypted data block, and stores the index identifier in association with the encrypted data block and the digital signature information;

[0237] Data verification and dynamic authentication module: After data storage is completed, the stored encrypted data blocks and their corresponding digital signature information are regularly verified;

[0238] Data decryption and signature verification module: When the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, and the national secret algorithm SM4 is used to decrypt it to obtain the original data.

[0239] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present invention is limited to these examples. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity.

Claims

1. A data storage method based on national secrets, characterized in that: The following steps are involved: S1, data segmentation: segment the data to be stored according to a preset size to obtain multiple data blocks; S2, data perturbation processing based on differential privacy: Perform differential privacy processing on each data block, protect data privacy by adding random noise, and form a perturbed data block, including: S21, data block initialization: mark each data block as an original data block, initialize its privacy parameters, and set different privacy protection levels according to the sensitivity of the data; S22, random noise generation: using the differential privacy algorithm to generate corresponding random noise for each original data block; S23, noise addition: adding the generated random noise to the corresponding original data block to form a disturbed data block; S24, disturbed data block verification: verify the disturbed data block after adding noise. If the verification fails, regenerate noise and add it again until the requirements are met; S25, disturbed data block output: output the disturbed data block after noise addition and verification; S3, data encryption and digital signature: Use the national secret algorithm SM4 to encrypt each disturbed data block to obtain an encrypted data block, and generate a corresponding digital signature for each encrypted data block, and use the national secret algorithm SM2 to sign the encrypted data block to generate digital signature information; S4, data storage and index generation: storing the encrypted data block and its corresponding digital signature information in a database, generating a unique index identifier for each encrypted data block, and storing the index identifier in association with the encrypted data block and the digital signature information; S5, data verification and dynamic validation: after the data storage is completed, the stored encrypted data blocks and their corresponding digital signature information are regularly verified; S6, data decryption and signature verification: When the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, and the national secret algorithm SM4 is used to decrypt it to obtain the original data.

2. According to the national secret data storage method of claim 1, it is characterized in that: The data segmentation in S1 includes: S11, data preprocessing: preprocessing the data to be stored to remove redundant and invalid information in the data to be stored; S12, segmentation rule setting: determining the size of the data block according to the preset segmentation rule and the actual situation of the data to be stored, the segmentation rule includes data type, data structure and storage requirements; S13, data segmentation execution: according to the set segmentation rule, the data to be stored is segmented into multiple data blocks of uniform size, and the amount of data contained in each data block is consistent with the preset segmentation size; S14, data block numbering: numbering each data block obtained by segmentation.

3. A method for storing data based on national secrets according to claim 1, characterized in that: The data block initialization in S21 includes: S211, data block marking: marking each data block as an original data block and recording its unique identifier; S212, privacy parameter initialization: Initialize the privacy parameters for each original data block, and set different privacy protection levels according to the sensitivity and classification of the data, including: S2121, Sensitivity Assessment: Each raw data block is assessed for sensitivity and classified into different levels, including high sensitivity, medium sensitivity and low sensitivity, according to the sensitivity and importance of the data content; S2122, privacy protection level setting: assign each original data block to a corresponding privacy protection level according to its sensitivity, expressed as: S2123, privacy parameter configuration: configure corresponding privacy parameters for each original data block, including noise amplitude and disturbance intensity.

4. A method for storing data based on national secrets according to claim 3, characterized in that: The differential privacy algorithm in S22 adopts a smoothing sensitivity mechanism, and the smoothing sensitivity mechanism includes: S221, data block initialization: marking the data block as an original data block and initializing its privacy parameters; S222, calculate smoothed sensitivity: calculate smoothed sensitivity according to the sensitivity of the data block, the privacy budget parameter and the dynamic adjustment factor, and the calculation formula is: S(x)=max x'∈B(x,r) (Δf·e - d(x,x'))×AF; Where S(x) is the smoothed sensitivity, Δf is the sensitivity of the data block, is the privacy budget parameter, B(x,r) is the neighborhood with radius r, d(x,x') is the distance between data, and AF is the dynamic adjustment factor; S223, calculate the noise standard deviation: use the smoothing sensitivity to calculate the noise standard deviation, the calculation formula is: Where σ is the noise standard deviation; S224, generate Gaussian noise: Generate two uniformly distributed random numbers u1 and u2: u1, u2 ~ U(0,1); Generate a random number z0 from a standard normal distribution using the Box-Muller transformation: Generate random noise of target Gaussian distribution: Noise(x) = σ·z0; S225, adding noise: adding the generated Gaussian noise to the original data block to form a disturbed data block. The calculation formula is: D′=D+Noise(x); Among them, D is the original data block data, and D' is the perturbed data block after adding noise.

5. A method for storing data based on national secrets according to claim 4, characterized in that: The disturbance data block check in S24 includes: S241, verification standard setting: setting verification standards according to the preset privacy protection level and data integrity requirements, the verification standards including statistical characteristics of the data and the range of noise amplitude; S242, disturbed data block verification: verify the disturbed data block after adding noise to check whether the disturbed data block meets the preset verification standard. The calculation formula is: Where D' is the perturbed data block after adding noise, and D is the original data block; S243, regenerate noise: if the verification result is not passed, regenerate noise and add it to the original data block, and verify again until the verification result is passed.

6. A method for storing data based on national secrets according to claim 1, characterized in that: The data encryption and digital signature in S3 include: S31, data encryption: Use the national secret algorithm SM4 to encrypt each disturbance data block to obtain an encrypted data block, specifically including: Key generation: Generate or obtain the key K used for SM4 encryption; Encryption processing: Use the SM4 algorithm and key K to encrypt the disturbance data block D' to generate the encrypted data block C. The calculation formula is: C = SM4_Encrypt (K, D'); Among them, SM4_Encrypt represents the process of encryption using the SM4 algorithm; S32, digital signature generation: Generate a corresponding digital signature for each encrypted data block, use the national secret algorithm SM2 to sign the encrypted data block, and generate digital signature information, specifically including: Key pair generation: Generate or obtain the private key SK and public key PK for SM2 signature; Signature generation: Use the SM2 algorithm and private key SK to sign the encrypted data block C and generate a digital signature S. The calculation formula is: S = SM2_Sign (SK, C); Among them, SM2_Sign represents the process of digital signature using SM2 algorithm.

7. A method for storing data based on national secrets according to claim 1, characterized in that: The data storage and index generation in S4 include: S41, data storage: storing the encrypted data block C and its corresponding digital signature information S in a database; S42, generating a unique index identifier: generating a unique index identifier Index for each encrypted data block, specifically including: S421, use a hash function to perform hash calculation on the encrypted data block to generate a unique identification ID C , the calculation formula is: ID C =Hash(C); S422, using a hash function to perform hash calculation on the digital signature information to generate a unique identification ID S , the calculation formula is: ID S =Hash(S); S423, Merge ID C and ID S Generate the final unique index identifier Index, the calculation formula is: in, Represents the XOR operation, which is used to merge two hash values; S43, associated storage: the generated unique index identifier Index is associated with the encrypted data block C and its corresponding digital signature information S and stored in the database.

8. The method for storing data based on national secrets according to claim 1, characterized in that: The data verification and dynamic validation in S5 include: S51, calibration plan setting: formulate a regular calibration plan, including setting the calibration frequency and time interval; S52, data verification: at a predetermined verification time, the stored encrypted data block C and its corresponding digital signature information S are verified, specifically including: Extract stored data: extract the encrypted data block C and its corresponding digital signature information S from the database; Digital signature verification: Use the public key PK of the national secret algorithm SM2 to verify the digital signature of the extracted encrypted data block C; S53, Dynamic Verification: Combine blockchain technology and dynamic hashing algorithm to monitor and verify the storage and transmission process of each encrypted data block in real time, including: Hash value calculation: Calculate the current hash value H for each encrypted data block C C , the calculation formula is: H C =SHA-256(C); Blockchain record: Hash value H C Recorded on the blockchain; Real-time verification: compare the current hash value H regularly and in real time C The hash value H recorded in the blockchain C ', if any inconsistency is found, an alarm is issued and the abnormality is recorded.

9. The method for storing data based on national secrets according to claim 1, characterized in that: The data decryption and signature verification in S6 include: S61, data retrieval: when it is necessary to read the stored data, the corresponding encrypted data block C and its corresponding digital signature information S are retrieved through the unique index identifier Index; S62, digital signature verification: use the public key PK of the national secret algorithm SM2 to perform digital signature verification on the extracted encrypted data block C; S63, data decryption: If the signature verification is passed, the encrypted data block C is decrypted using the national secret algorithm SM4 and the preset decryption key K to obtain the original data D'.

10. A data storage system based on national secrets, used to implement a data storage method based on national secrets as claimed in any one of claims 1 to 9, characterized in that: Includes the following modules: Data segmentation module: divides the data to be stored into a preset size to obtain multiple data blocks; Data perturbation processing module: Perform differential privacy processing on each data block, protect data privacy by adding random noise, and form a perturbed data block; Data encryption and digital signature module: Use the national secret algorithm SM4 to encrypt each disturbed data block to obtain an encrypted data block, and use the national secret algorithm SM2 to generate the corresponding digital signature information for the encrypted data block; Data storage and index generation module: stores the encrypted data block and its corresponding digital signature information in the database, generates a unique index identifier for each encrypted data block, and associates the index identifier with the encrypted data block and the digital signature information for storage; Data verification and dynamic authentication module: After data storage is completed, the stored encrypted data blocks and their corresponding digital signature information are regularly verified; Data decryption and signature verification module: When the stored data needs to be read, the corresponding encrypted data block is retrieved through the index identifier, and the national secret algorithm SM4 is used to decrypt it to obtain the original data.

Citation Information

Patent Citations

  • Safe storage method based on a plurality of cloud storage systems and system thereof

    CN103118089A

  • Privacy protection system and method for big data release

    CN111914271A

  • Structured information encryption system, method and device, medium and equipment

    CN114266062A

  • Differential privacy-based non-uniform noise adding method and system

    CN116090001A

  • Security application method in Internet system based on national cryptographic algorithm

    CN117335989A

Cited By

  • Data multi-dimensional linkage security encryption and decryption method based on privacy calculation

    CN119808165A

  • A multi-dimensional linkage security encryption and decryption method for data based on privacy computing

    CN119808165B