Identity card number anonymization system based on layered dynamic encryption and SM3 salt value enhancement

The ID number anonymization system, which combines layered dynamic encryption with SM3 salt enhancement, solves the problems of key management, anonymous identifier generation, and system performance optimization in existing anonymization schemes. It achieves efficient desensitization, anonymization, and verifiability of identity encoding, and constructs an end-to-end security closed loop.

CN121037085APending Publication Date: 2025-11-28THE FIRST RES INST OF MIN OF PUBLIC SECURITY +1

Patent Information

Application Number
CN202511286823.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-10
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Existing anonymization schemes have shortcomings in key management, anonymous identifier generation, and system performance optimization, making it difficult to build an end-to-end security loop and facing problems such as poor algorithm compatibility and complex verification processes.

Method used

An ID number anonymization system based on layered dynamic encryption and SM3 salt enhancement is adopted, including a security preprocessing and format normalization module, a salt enhancement hash module, a dynamic derived key module, a layered dynamic encryption module, and an anonymous identifier generation module. Through dynamic salt extension and layered protection architecture, the identity code achieves desensitization, anonymization, and verifiability.

Benefits of technology

It achieves synergistic enhancement of identity encoding in three dimensions: desensitization, anonymity, and verifiability, improving the system's anti-collision capability, key isolation, and anti-replay attack capability. It constructs a closed-loop solution of desensitization usability + verification traceability + plaintext irreversibility, which has high adaptability and industrial applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121037085A_ABST
    Figure CN121037085A_ABST
Patent Text Reader

Abstract

The invention discloses an identity card number anonymization system based on hierarchical dynamic encryption and SM3 salt value enhancement. The identity card number anonymization system comprises a security preprocessing and format normalizing module, a salt value enhancement hash module, a dynamic derived key module, a hierarchical dynamic encryption module, an anonymous identifier generation module and an anonymous identifier verification module. The invention provides a more comprehensive and efficient privacy protection scheme by introducing an anonymization technology based on dynamic salt value expansion and a layered protection architecture.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of network identity information security, and particularly relates to an identity card number anonymization system based on hierarchical dynamic encryption and SM3 salt value enhancement. BACKGROUND

[0002] With the rapid growth of medical health data sharing across institutions and the demand for real-name authentication on the Internet, traditional identity information desensitization technology is facing severe challenges. Based on single hash algorithm or static encryption, traditional solutions are difficult to cope with increasingly complex new attack methods, and data leakage incidents occur frequently, exposing the vulnerability of traditional methods in terms of collision resistance and key management. To avoid rainbow table attacks, batch decryption risks and compliance issues, a new anonymization technology based on dynamic salt value expansion and hierarchical protection architecture has emerged. This technology introduces format reconstruction rules in the preprocessing stage, injects dynamic random parameters in the hash layer, and implements key physical isolation in the encryption layer, thereby building a multi-dimensional security barrier. Although this technology can alleviate the risk of plaintext exposure to some extent, it still faces challenges such as poor algorithm compatibility, complex verification process, and other constraints in actual deployment, making it difficult to balance the contradiction between security strength and system performance. Therefore, a method that deeply integrates dynamic protection mechanisms and hierarchical control strategies is needed to solve these problems.

[0003] Existing anonymization schemes generally have technical fragmentation and defense layering, making it difficult to build an end-to-end secure closed loop. Chinese patent application CN117874789A proposes a dynamic privacy data encryption method and system, which is based on automatic identification and partitioning of sensitive data, combined with multi-party computing tasks, to achieve dynamic incremental encryption of data. This method uses dynamic permission keys and incremental encryption mechanisms to improve data security and processing efficiency. However, this scheme has some limitations in practical application. First, although dynamic permission keys are introduced, there may be complexity and security issues in key management and distribution, especially in a multi-party environment, where key synchronization and updating can become a bottleneck for the system. Second, this method mainly focuses on data encryption processing, and has limited support for generating anonymous identifiers that have high randomness in structure, stable uniqueness in identity mapping, and strong irreversibility, making it difficult to meet the requirements of certain application scenarios that require specific anonymous identifiers. In addition, although an incremental encryption mechanism is used to improve processing efficiency, the system may still face performance bottlenecks in the case of frequent data updates, affecting overall processing efficiency and response speed. Therefore, although this scheme provides an effective solution for dynamic data encryption, there is still room for improvement in key management, anonymous identifier generation, and system performance optimization. SUMMARY

[0004] In view of the deficiencies of the prior art, the present application aims to provide an identity card number anonymization system based on hierarchical dynamic encryption and SM3 salt value enhancement, which introduces an anonymization technology based on dynamic salt value expansion and hierarchical protection architecture, and provides a more comprehensive and efficient privacy protection scheme.

[0005] In order to achieve the above-mentioned purpose, the present application adopts the following technical solutions:

[0006] The identity card number anonymization system based on hierarchical dynamic encryption and SM3 salt value enhancement comprises a security preprocessing and format normalization module, a salt value enhancement hash module, a dynamic derived key module, a hierarchical dynamic encryption module, an anonymous identifier generation module and an anonymous identifier verification module.

[0007] The security preprocessing and format normalization module comprises a legality verification submodule, a format normalization submodule and a dynamic grouping submodule.

[0008] The legality verification submodule is used for performing legality verification on the input original identity card number.

[0009] The format normalization submodule is used for uniformly mapping the last character in the original identity card number, and then representing each character of the mapped identity card number with a corresponding hexadecimal value, to construct a standardized 16-bit input sequence.

[0010] The dynamic grouping submodule is used for generating a grouping area number GID for the input original identity card number according to part of the fields of the original identity card number.

[0011] The salt value enhancement hash module comprises a salt value generation submodule and a salt value injection and hash processing submodule.

[0012] The salt value generation submodule is used for generating a salt value S according to the following formula:

[0013] S = SM3(GID || T || R)

[0014] Wherein, "||" represents a splicing operation, GID is the grouping area number of the user, T is a session timestamp or version mark, and R is a generated random number sequence; the hash operation is performed on GID, T and R after splicing to obtain a salt value string with fixed length and high unpredictability;

[0015] The salt value injection and hash processing submodule is used for splicing the salt value S generated by the salt value generation submodule and the 16-bit input sequence ID_std obtained by the format normalization submodule to form a hash input D = ID std || S, and calculating the hash value of D by using the hash function SM3 to obtain a hash result H.

[0016] The dynamic derivation key module is used for generating an independent dispersion factor for the identity card number data through a national-level cryptographic security random source, and the dispersion factor combines the features of the hash result H to form a derived context, which is input into a hash message authentication code (HMAC)-based key derivation function-SM3 (HMAC-SM3) algorithm together with a master key hosted in a hardware security module (HSM) to generate a sub-key SK;

[0017] The hierarchical dynamic encryption module is used for performing SM4-CBC mode encryption on the hash result H to be encrypted using the sub-key SK derived by the dynamic derivation key module, and completing multi-layer dynamic encryption in combination with a random initialization vector IV with high randomness; after the encryption is completed, the sub-key SK is immediately cleared, and the random initialization vector IV is sent or stored together with the ciphertext data obtained by the encryption as an encryption output;

[0018] The anonymous identifier generation module is used for extracting the final ciphertext result obtained by the hierarchical dynamic encryption module, and combining the hash digest of the corresponding salt value index and the hash digest of the dispersion factor index to form an identifier structure; the identifier structure is structured and encoded using a Base64URL encoding algorithm to generate an anonymous identifier with a controllable length and a limited character set on the basis of preserving data integrity;

[0019] The anonymous identifier verification module is used for verifying the identity card number data input by a user in an actual business application: first, the anonymous identifier is received and subjected to Base64URL decoding, disturbance character position restoration, and structure field disassembly operations to parse and obtain the ciphertext, the hash digest of the salt value index, and the hash digest of the dispersion factor index; the anonymous identifier verification module locates the associated dispersion factor and its context Context through the hash digest of the dispersion factor index, combines the master key hosted by the HSM, and re-executes the HMAC-SM3 function to derive the same sub-key SK and random initialization vector IV as in the encryption stage; then, the SM4-CBC algorithm is called to decrypt and parse the obtained ciphertext to restore the hash result H generated by the salt value enhanced hash module;

[0020] Meanwhile, the identity card number data input by the user is processed by the secure preprocessing and format normalization module and the salt value enhanced hash module to generate a new hash result H”; if the decrypted and restored hash result H is completely consistent with the generated new hash result H”, it is determined that the identity verification is successful.

[0021] Further, the salt value generated by the salt value enhanced hash module is transferred to an independent storage through a secure channel in a trusted execution environment, and is stored and accessed in a physically isolated manner, and is marked as invalid immediately after a single use; the audit module records the generation and consumption process logs for subsequent consistency checking and compliance auditing.

[0022] Further, the salt value adopts any one of the following management modes:

[0023] Independent salt value per user: a unique salt value is dynamically generated for each user for identity hash desensitization, ensuring "one person one identifier" and preventing batch collision;

[0024] Periodic rotation salt value: the global salt value version is replaced according to a set period, and periodic desensitization rotation is implemented at the system level, effectively preventing long-term data leakage accumulation effect.

[0025] Further, the salt value injection and hash processing submodule encapsulates the calculated hash result H in a recognizable format or uses base64 encoding for output.

[0026] Further, the derivation process of the dynamic derived key module is completed in a trusted execution environment, the master key is always protected by the HSM and does not go out of the boundary, the dispersion factor is immediately destroyed after the derivation of the sub-key is completed, the generated sub-key only exists temporarily in the memory and is used for data encryption, and is immediately cleared after the data encryption is completed.

[0027] Further, the dynamic derived key module includes a dispersion factor generation submodule and a sub-key derivation submodule;

[0028] The dispersion factor generation submodule is used to generate an independent dispersion factor DF for the hash result H to be encrypted by a national-level cryptographic security random source in a trusted execution environment, and record the corresponding context information Context, including the features of the hash result H, the session timestamp and the business label;

[0029] The sub-key derivation submodule is used to call the protected global master key MK in the HSM, input the dispersion factor DF and the context information Context into the HMAC-SM3 function to generate a pseudo-random key PRK; and then input the PRK and the context information Context into an extension function to generate a sub-key SK.

[0030] Further, the audit module is used to automatically or manually rotate the master key and the derived parameters according to a time strategy or an event trigger, including periodically updating the master key in the HSM or reinitializing the salt value generation strategy of the derivation function; at the same time, the generation of the dispersion factor DF, the calling of the derivation function, the generation and memory clearing of the sub-key SK, and the process of the encryption operation are logged.

[0031] Further, the hierarchical dynamic encryption module includes an initialization submodule and a multi-layer encryption submodule;

[0032] The initialization submodule is used to obtain the hash result H as the initial input, and call a national cryptographic security random source to generate an independent random initialization vector IV in a trusted execution environment;

[0033] The multi-layer encryption sub-module is used for performing a three-layer nested encryption process; in the first layer encryption, the multi-layer encryption sub-module generates a working key K1 required for the first layer encryption from a sub-key SK by combining a current random initialization vector IV, context information context and a session time stamp through an HMAC-SM3 algorithm; the multi-layer encryption sub-module performs an encryption operation on the hash result H to be encrypted in an SM4-CBC mode using the working key K1 and the random initialization vector IV, to generate first layer ciphertext C1;

[0034] In the second layer encryption, the multi-layer encryption sub-module splices the first layer ciphertext C1 and the random initialization vector IV used by the multi-layer encryption sub-module into a structured data block M1=IV‖C1 as an input of the second layer encryption; then a time key K2 is derived dynamically through an HMAC-SM3 algorithm, and the current system time stamp, the dispersion factor index value and the business session identification are introduced into the derivation parameter; the multi-layer encryption sub-module performs a second round of SM4-CBC encryption on the structured data block M1 using the time key K2 and a new random vector IV2, to obtain second layer ciphertext C2;

[0035] In the third layer encryption, a hash value H(DF) of the dispersion factor is extracted as a check item of data integrity, and is spliced with the second layer ciphertext C2 to form M2=C2‖H(DF); meanwhile, a third layer encryption key K3 is derived, and then the SM4-CBC algorithm is used again to encrypt M2, to obtain third layer ciphertext C3;

[0036] The final ciphertext obtained after the multi-layer encryption sub-module performs single-layer, double-layer or three-layer encryption on the hash result H to be encrypted is output after Base64 encoding, and is stored in a secure database together with a salt value, a dispersion factor index and a version number used in the current session.

[0037] Further, the third layer encryption key K3 is derived through an HMAC-SM3 algorithm, a master key is used as input key material, a data processing ID, an SM3 digest SM3(C1‖C2) of the ciphertext obtained through the previous two rounds of encryption and an operation time stamp are spliced as derivation context parameters, and a key extraction-expansion process is performed in a trusted execution environment to generate the third layer encryption key K3.

[0038] The application has the following beneficial effects:

[0039] 1. The present application realizes the synergistic enhancement of identity coding in the three dimensions of desensitization, anonymity and verifiability through fusion preprocessing, salt value enhanced hashing, dynamic key derivation, hierarchical encryption and anonymous verification, making up for the deficiencies of existing anonymization schemes in collision resistance, key isolation, replay attack prevention and verifiability. By introducing a dynamically generated high-entropy salt value to expand the hash input space, the hash result is highly unpredictable each time, and by combining the HMAC-SM3 key derivation mechanism with one data and one key, the encryption operation is strongly bound to the context environment, cutting off the batch cracking path.

[0040] 2. The present application applies multi-round SM4-CBC dynamic encryption to the hash result, and cooperates with independent IV, dispersion factor and version mark encapsulation processing, so that the same data under different times or sessions shows high randomness, thereby improving the system's collision resistance and analysis resistance.

[0041] 3. In the present application, the verification process completes identity confirmation by securely deriving a reverse key and comparing the hash value, without the participation of plaintext information, and builds a complete closed-loop scheme of desensitization availability + verification traceability + plaintext irreversibility.

[0042] 4. The system of the present application supports modular deployment, adjustable configuration parameters, and supports container environment operation, and the deployment process has very low invasiveness to existing systems, with high adaptability and industrial applicability.

[0043] In summary, the present application realizes the unification of data desensitization and trusted verification on the basis of ensuring irreversible identity privacy, and has significant security, flexibility and scalability advantages. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1 The figure is a schematic diagram of the architecture of the system of the embodiment of the present application.

[0045] Figure 2 The figure is a general implementation flowchart of the system of the embodiment of the present application.

[0046] Figure 3 The figure is an implementation flowchart of the salt value enhanced hashing module in the embodiment of the present application.

[0047] Figure 4 The figure is an implementation flowchart of the dynamic key derivation module in the embodiment of the present application.

[0048] Figure 5 The figure is an implementation flowchart of the hierarchical dynamic encryption module in the embodiment of the present application. DETAILED DESCRIPTION

[0049] The application will be further described below with reference to the drawings. It should be noted that the embodiments are based on the technical solutions and give detailed implementation manners and specific operation processes, but the protection scope of the application is not limited to the embodiments.

[0050] The embodiment provides an identity card number anonymization system based on hierarchical dynamic encryption and SM3 salt value enhancement, and a multi-level encryption system is constructed by combining security preprocessing and format normalization, SM3 salt value enhanced hash desensitization and hierarchical dynamic key derivation. Under the premise of not exposing the plaintext identity card number, high uniqueness and cryptographically irreversible anonymous identifiers can be generated, and the identity can be safely verified in an authorized environment. At the same time, the scheme is simple to deploy, efficient, and has strong anti-attack ability.

[0051] As shown in Figure 1 , 2 The embodiment provides an identity card number anonymization system based on hierarchical dynamic encryption and SM3 salt value enhancement, and a multi-level encryption system is constructed by combining security preprocessing and format normalization, SM3 salt value enhanced hash desensitization and hierarchical dynamic key derivation. Under the premise of not exposing the plaintext identity card number, high uniqueness and cryptographically irreversible anonymous identifiers can be generated, and the identity can be safely verified in an authorized environment. At the same time, the scheme is simple to deploy, efficient, and has strong anti-attack ability.

[0052] The security preprocessing and format normalization module:

[0053] Security preprocessing and format normalization is the initial link of the anonymization process, and the core goal is to eliminate the structural traceability of the original identity card number and enhance the randomness of the data through standardized processing. The security preprocessing and format normalization module includes a legality verification submodule, a format normalization submodule and a dynamic grouping submodule.

[0054] The legality verification submodule is used to perform legality verification on the input original identity card number. According to the national standard, the compliance of the administrative division code, the date of birth and the check code of the original identity card number is verified, illegal characters or format error data are removed, and it is ensured that the length, structure, date of birth code and check code of the input original identity card number meet the specification requirements of the national standard.

[0055] Specifically, the identity card number is an 18-digit string, the first 17 digits are a numerical sequence, and the 18th digit is a check code, which can be a number or a character "X" (representing the replacement of Roman numeral 10). The legality verification submodule uses the check algorithm specified in the existing national standard GB11643 to verify the last check code of the input original identity card number, calculates the check digit based on the sum of the first 17 digits of the original identity card number multiplied by the corresponding coefficient and takes the modulus, and compares whether the 18th digit of the original identity card number is consistent, to determine whether the original identity card number is legal, and illegal input will be rejected.

[0056] Due to the differences in the support of the "X" character, the sensitivity of the case, and the specification requirements of the format in different systems, if not processed directly into the subsequent encryption process, it is easy to cause problems such as inconsistent identifiers and hash value conflicts, so format normalization is needed. The format normalization submodule normalizes the "X" last check symbol and variant format in the original ID number, and uniformly processes it through mapping replacement or fixed character recoding, etc. to avoid hash collision or algorithm recognition exception caused by character difference. The specific process is as follows:

[0057] First, the character at the end of the original ID number, a number (0-9) or a letter "X / x", is uniformly mapped as follows:

[0058]

[0059] That is, the number remains unchanged, and the letter "X" or "lowercase x" is uniformly mapped to the number 10.

[0060] Then, each character of the ID number after mapping is represented by the corresponding hexadecimal value, that is, a standardized 16-bit input sequence is constructed as the input of the subsequent step.

[0061] The core purpose of format normalization is to eliminate the system parsing differences and hash variation risks caused by the "X" character, so that the same ID number generated by different source systems forms a consistent data form after normalization processing, avoiding ambiguity of homologous data before hashing.

[0062] Considering the data distribution characteristics of different users, the dynamic grouping mechanism is adopted in this embodiment. The dynamic grouping submodule is used to partition and encode the input original ID number according to part of the fields of the ID number (such as birth year, regional code, etc.), so as to realize hierarchical management in the subsequent salt value introduction and hash desensitization process. According to the data bit length and distribution characteristics of the ID number, the structure is rearranged, the salt value is dynamically adjusted, the block number is adjusted, the random padding rule is embedded, and the padding rule based on the salt value is used for the grouping with insufficient fixed length, such as supplementing the grouping with the first N bits of the salt value, to further increase the input complexity. The salt value is generated by the subsequent module and stored separately.

[0063] For example, according to the administrative division code of the first 6 digits of the ID number, the first 6 digits of the administrative division code are used to generate the grouping region number GID, and the ID number of the user is divided into different grouping region numbers GID. The grouping region number GID will be input as a parameter in the subsequent salt processing and key derivation process to realize key domain isolation and access control.

[0064] Specifically, GID = (SM3(ProvinceCode || CityCode) mod N) + 1, that is, the province and city codes ProvinceCode and CityCode are hashed by SM3 and mapped to the group number 1…N to uniformly group and desensitize the input ID number.

[0065] After the processing of the above security preprocessing and format normalization module, the original ID number is gradually transformed from non-standardized, heterogeneous input into unified, structured, and controllable coded data, with good verifiability and input consistency, effectively reducing the abnormal risk in system deployment. At the same time, it also provides data support for the grouping information introduced by the subsequent hash processing, which helps to form a regional security policy and improve the overall system attack resistance and deployment flexibility.

[0066] The security preprocessing and format normalization module can be encapsulated as a standardized input module in software, facilitating embedding in business processes such as big data platforms, government systems, and medical systems, to ensure the security and stability of identity data before entering the encryption chain.

[0067] The salt value enhanced hash module is used to perform digest calculation on the 16-bit input sequence of the ID number processed by the format normalization sub-module using the national SM3 hash algorithm, and irreversibly map it to a fixed-length hash value.

[0068] After the security preprocessing and format normalization of the ID number data, to realize the anonymization and desensitization of the identity data, the embodiment further introduces a salt value enhanced hash mechanism to generate an irreversible and collision-resistant intermediate identifier. The core goal is to enhance the non-determinism and distribution balance of the hash processing by introducing a random disturbance factor "salt value (Salt)", thereby effectively resisting the vulnerability of traditional hash technology when facing large-scale correlation analysis and rainbow table attacks.

[0069] In traditional hash processing, the same input always maps to a fixed output. This determinism, on the one hand, ensures system performance, but on the other hand, also brings "predictability", i.e. an attacker only needs to collect a large number of known identity data and hash value corresponding samples to reversely construct a hash mapping table (such as a rainbow table) to quickly decrypt the anonymous identifier. To avoid such risks, the embodiment adopts an enhanced hash mechanism based on dynamic salt value injection and user grouping strategy to ensure that even the same identity information generates a hash result with randomness in different times and different context environments, thereby building a more robust anonymous identifier system.

[0070] Unlike traditional schemes that only use static salt values, this embodiment employs a one-time high-entropy salt value generation mechanism to strictly control the source, generation, and management of salt values. This includes hardware security modules (HSM) for isolated storage and a time-based automatic salt value rotation strategy. This expands the hash input space from the source, significantly enhancing collision resistance and reducing replay risk. Salt value injection follows specific concatenation rules.

[0071] Specifically, such as Figure 3 As shown, before each hash operation, a 16-byte or 32-byte high-entropy salt value is dynamically derived based on the user identifier, session timestamp, and random entropy source. This salt value is then merged with the hexadecimal input sequence to be hashed according to a set concatenation rule. The concatenation position can be flexibly set at the beginning, end, or middle offset segment to form multiple scrambling layers, ensuring no reuse between different hash operations. After the hash operation is completed, the salt value is transferred to an independent repository within a trusted execution environment via a secure channel, implementing physically isolated storage and access control. It is immediately marked as invalid after a single use, and the audit module records the entire generation and consumption process log for subsequent consistency verification and compliance auditing. This not only significantly improves the randomness and unpredictability of the hash results, ensuring that any two digests of the same input will be different, thus greatly reducing the probability of hash collisions, but also, combined with the anti-replay mechanism involving timestamp hash values ​​in salt value generation, further ensures the uniqueness and security of each processing step. Finally, by leveraging the inherent collision resistance of the SM3 algorithm and the synergistic effect of the dynamic salt value mechanism, an intermediate identifier with high entropy, collision resistance, irreversibility, and uniqueness can be output, providing a unified, standardized, and secure input foundation for subsequent layered encryption.

[0072] It should be noted that the session refers to a one-time interactive context generated during user authentication or sensitive data processing. It arises in scenarios such as login, authorization requests, and cross-organizational access. The session content includes elements such as user identifier, timestamp, device fingerprint, and session token, which are used to provide a unique and unpredictable context input when dynamic salt value derivation is performed.

[0073] Specifically, the salt-enhanced hashing module includes a salt generation submodule and a salt injection and hash processing submodule.

[0074] A salt is essentially a sequence of random or semi-random bytes concatenated with the original data before hashing. In this embodiment, to balance security and verifiability, the salt generation combines the following three types of factors:

[0075] Group ID (GID): Generated in step S1.3, it is obtained from the first few digits of the original ID number, such as administrative division code, province code, etc., which can ensure that the hash input of different user groups has natural isolation when deployed on a large scale;

[0076] Timestamp or Version Code: used to introduce the perturbation of the time window dimension, facilitating the implementation of dynamic update or rotation hash strategy in the future;

[0077] System Random Seed: dynamically generated by a cryptography-level random number generator, ensuring unpredictability.

[0078] The salt value generation submodule is used to generate a salt value S according to the following formula:

[0079] S = SM3(GID || T || R)

[0080] wherein "||" represents the concatenation operation, GID is the group area number of the user, T is the session timestamp or version mark, and R is the generated random number sequence; by concatenating GID, T and R and performing a hash operation, a salt value string with a fixed length (such as 256 bits) and high unpredictability is obtained.

[0081] It should be noted that the session timestamp is used to identify the specific time point at which the session occurs, and the version mark refers to the iteration number generated by the system to distinguish the security period when the salt value or key is rotated.

[0082] The salt value injection and hash processing submodule is used to concatenate the salt value S generated by the salt value generation submodule and the 16-bit input sequence ID_std obtained by the format normalization submodule to form a hash input D = ID std || S, and then use the high-security strength hash function SM3 to calculate the hash value of D. The calculation formula is as follows:

[0083] H = SM3(ID std || S)

[0084] wherein SM3 is a national standard hash function, and its output is a 256-bit hash digest with good anti-collision and anti-coincidence attack capabilities. Since the salt value has randomness, even if the original ID number is the same, as long as the salt value is different, the final generated hash result H will also be completely different, forming a distribution disturbance between data and blocking the ability of attackers to construct a hash inverse mapping based on known plaintext.

[0085] Further, in this embodiment, in order to improve security, the salt value can adopt the following two management modes:

[0086] Independent salt value per user: a unique salt value is dynamically generated for each user to perform identity hash desensitization, ensuring that "one person has one identifier" and preventing batch collision;

[0087] Periodic rotation of salt value: change the global salt value version according to the day, week, month, etc. period, realize periodic desensitization rotation at the system level, and effectively prevent the cumulative effect of long-term data leakage.

[0088] The salt value should be strictly controlled and can only be restored or derived in an authorized environment and should not be exposed to clients or untrusted systems. At the same time, in order to ensure the consistency and verifiability of the hash, the salt value input needs to be calculated synchronously in the subsequent verification phase, and the reverse check is performed through the time window or version parameter reproduction.

[0089] Further, in the present embodiment, the salt value injection and hash processing submodule encapsulates the calculated hash result H in a recognizable format, such as outputting in hexadecimal encoding, for easy storage and identification, or using base64 encoding output to support cross-system transmission compatibility, or annotating the version number or salt value summary prefix in the output to support subsequent system evolution and compatibility management.

[0090] The introduction of the enhanced hash mechanism with dynamic salt value significantly improves the irreversibility and anti-reconstruction ability of anonymous identification, and the session-level salt value splicing mechanism guarantees the one-way mapping property of the hash digest. Even if the attacker masters a certain plaintext identity data, if he cannot obtain the current salt value at the same time, the hash value generated by him will be difficult to match with the target identification. At the same time, the balance between system attack resistance and processing performance can be dynamically adjusted by setting the salt value refresh strategy. Compared with traditional fixed salt value or no salt value mechanism, the present embodiment has significant anti-collision ability enhancement, rainbow table protection ability improvement and expandable deployment ability, and is suitable for high-strength privacy protection needs in government, medical, financial and other high-sensitive data scenarios.

[0091] In order to improve the isolation and attack resistance of the system in key management, the dynamic derivation key module is used for the dynamic derivation mechanism of the sub-key based on the master key and the dispersion factor, a hierarchical key management system is adopted, and the encryption sub-key of each identity card data is generated by combining the master key with the dispersion factor, realizing the isolation protection of one data one key, and eliminating the batch cracking risk caused by traditional key reuse.

[0092] As Figure 4As shown, the dynamic derivation key module first generates an independent dispersion factor for each identity card number data by a national level cryptographic security random source, and the dispersion factor combines the features of the hash result H (such as the hash value truncation bit, that is, a part of the bit segment selected from the hash result H, used to introduce a random feature associated with the original input but irreversible in the dispersion factor generation) to form a derivation context, which is input into the HMAC (Hash-based message authentication code)-based key derivation function-SM3 (HMAC-SM3) together with the master key hosted in the hardware security module (HSM), to generate a unique and irreversible sub-key. The entire derivation process is completed in a trusted execution environment, the master key is always protected by the HSM and does not go out of the boundary, the dispersion factor is immediately destroyed after the sub-key derivation is completed, and the generated sub-key only exists temporarily in the memory and is used for data encryption, and is immediately cleared after data encryption is completed, and is not stored.

[0093] The above-mentioned dynamic derivation mechanism of the sub-key based on the master key and the dispersion factor realizes the separate storage of the master key and the dispersion factor through physical isolation and permission control, supports dynamic rotation strategies based on time or events and life cycle audit, ensures minimum exposure and on-demand invalidation of the key, and greatly improves the overall security boundary of the system. Even if an attacker obtains a certain sub-key or cache data, it is difficult to reverse other key sequences or the content of the master key, thereby realizing dynamic isolation and secure closed loop of the whole process of key generation, use and storage at the system architecture level.

[0094] Specifically, the dynamic derivation key module includes a dispersion factor generation submodule and a sub-key derivation submodule.

[0095] The dispersion factor generation submodule is used to generate an independent dispersion factor (DF, Dispersion Factor) for the hash result H by a national level cryptographic security random source in a trusted execution environment, and the dispersion factor length is not less than 16 bytes to ensure sufficient entropy value. At the same time, the corresponding context information Context is recorded, including but not limited to the features of the hash result H (such as the hash value truncation bit), the session timestamp, the business label, etc., which are used for the Info input of the key derivation function, thereby realizing the bidirectional binding of the key and the specific hash result. The generated dispersion factor DF is temporarily stored in the memory of the trusted execution environment in plaintext form in the generation process, and is completely cleared after the key derivation is completed, and will not be stored persistently or output to the external system. The business label can include but is not limited to the business system number, the operation type identifier (such as query, update), the data belonging to the institution code and the security level mark, etc., which are used to distinguish the key derivation requirements in different business scenarios and realize fine security isolation.

[0096] The sub-key derivation sub-module is used to call a protected global master key MK (Master Key) in a hardware security module HSM, input a dispersion factor DF into an HMAC-SM3 function to generate a pseudo-random key PRK, and then input the PRK and context information Context into an expansion function to generate a sub-key SK (Secret Access Key). The process can be represented by the following formula:

[0097] PRK = HMAC-SM3 (Salt = DF, IKM = MK)

[0098] SK = HMAC-SM3 (PRK, Info = Context || 0x01, L = 128)

[0099] In the HMAC-SM3 function, IKM (Input Key Material) is the master key, Salt is the dispersion factor DF, Info is the context information, and L specifies that the output key length is 128 bits to meet the input requirements of the SM4 encryption algorithm. HMAC-SM3 realizes the uniform distribution and anti-deduction of the key through a two-stage extraction and expansion process, and realizes the close binding of the key and the context information.

[0100] Further, in order to ensure the security of the master key, the embodiment introduces physical isolation storage of the dispersion factor, and adopts a master key automatic rotation mechanism. Specifically:

[0101] After the sub-key derivation is completed, the sub-key SK is temporarily stored in the local memory and is only used for encryption operation corresponding to the hash result. The entire derivation and use process is completed in the TEE (Trusted execution environment, Trusted Execution Environment), and the master key MK always resides in the HSM and cannot be directly accessed by any component outside the calling process. The dispersion factor DF is marked as expired immediately after the sub-key SK is generated and is completely destroyed, and no trace is left in any form of persistent storage, so that the dispersion factor itself cannot be recovered or deduced offline.

[0102] To further enhance security and auditability, an audit module is also included for automatically or manually implementing key rotation of the master key and derived parameters according to a time strategy (e.g., daily, weekly, or custom period) or event trigger (e.g., system anomaly, manual initiation by an administrator), including periodic updating of the master key in the HSM or reinitializing the salt value generation strategy of the derived function; at the same time, the entire process of generation of the dispersion factor DF, invocation of the derived function, generation and memory clearing of the subkey SK, encryption operation, etc. is logged, including time stamp, operation user, function parameter digest, and execution result digest, etc. key information, ensuring complete traceability during security audit or compliance verification, and also enabling rapid positioning of abnormal or suspected attack behavior.

[0103] Further, the above process can be seamlessly extended in a multi-node or micro-service environment. Each encryption node schedules a local HSM or a remote key management service KMS (Key Management Service) for key derivation, and synchronizes the dispersion factor DF and audit logs to a centralized management platform through a secure channel during the invocation process, achieving unified audit and policy issuance across nodes, and achieving the effects of one data one key and dynamic isolation of the entire process.

[0104] The hierarchical dynamic encryption module is used to perform SM4-CBC mode encryption on the hash result H to be encrypted using the subkey SK derived by the dynamic derived key module, and complete multi-layer dynamic encryption in combination with a random initialization vector (IV, Initialization Vector) with high randomness. After encryption, the subkey SK is also immediately cleared, and the random initialization vector IV is sent or stored together with the encrypted ciphertext data as the encryption output, and the ciphertext data and context information are packaged and encapsulated in the subsequent anonymous identity generation link.

[0105] The entire encryption process is completed in a trusted execution environment, and the master key and subkey are stored in physically isolated secure areas, and the dispersion factor and random initialization vector IV are immediately destroyed after use without being saved to disk. The encryption delay in high-concurrency scenarios can also be reduced by introducing key hot loading and SM4 hardware acceleration modules.

[0106] The final output ciphertext structure is encoded in Base64 to adapt to storage and transmission requirements, and the block size can be dynamically adjusted within the encryption module according to data sensitivity, and redundant encryption is performed on high-sensitivity fields. Through the joint mechanism of dynamic keys, dynamic random initialization vectors IV, and multi-layer nested encryption, even if the same input is faced, the same ciphertext will never be generated, and each layer of encryption has independent security features, enabling the system to effectively resist various threat models such as man-in-the-middle attacks, chosen ciphertext attacks, and rainbow table attacks, providing a trusted and difficult-to-break security barrier for subsequent anonymous identity generation and verification.

[0107] As shown in Figure 5 The hierarchical dynamic encryption module includes an initialization submodule and a multi-layer encryption submodule;

[0108] The initialization submodule is configured to obtain a hash result H as an initial input, and to ensure high unpredictability of each encryption, call a national secret security random source in a trusted execution environment (TEE) to generate an independent random initialization vector IV. The length of the random initialization vector IV is the same as the packet length of the SM4 algorithm, and the content thereof is obtained by truncating and disturbing a high-entropy seed (such as a session timestamp, a session ID, and a device fingerprint) through an SM3 hash function, so that the IV repetition phenomenon does not occur even in a high-frequency calling environment.

[0109] The multi-layer encryption submodule is configured to perform single-layer encryption, double-layer encryption, or triple-layer encryption. In the first layer encryption, the multi-layer encryption submodule generates a working key K1 required for the first layer encryption from a sub-key SK, in combination with the current random initialization vector IV, context information context, and a session timestamp through an HMAC-SM3 algorithm. The working key K1 is valid only for the current data and context, and has security features such as one-time use, irreversibility, and non-reusability. The multi-layer encryption submodule performs an encryption operation on the hash result H to be encrypted in an SM4-CBC mode using the working key K1 and the random initialization vector IV, to generate first layer ciphertext C1. The process of the first layer encryption ensures that the hash value itself is converted into an unrecognizable data block through encryption while the key is being dynamized and contextualized.

[0110] In order to enhance the hierarchical security of the ciphertext, the multi-layer encryption submodule can further perform second layer encryption. In the second layer encryption, the multi-layer encryption submodule splices the first layer ciphertext C1 and the random initialization vector IV used thereby into a structured data block M1=IV‖C1, as an input for the second layer encryption; then dynamically derives a time key K2 through an HMAC-SM3 algorithm, and introduces the current system timestamp, a dispersion factor index value, and a business session identifier in the derivation parameter, so as to construct a temporary key system based on event triggering. The multi-layer encryption submodule performs a second round of SM4-CBC encryption on the structured data block M1 using the time key K2 and a new random vector IV2, to obtain second layer ciphertext C2. The second layer encryption introduces further binding to the context, and enhances the unpredictability of the ciphertext structure.

[0111] The multi-layer encryption sub-module can further perform third layer encryption. In the third layer encryption, the hash value H(DF) of the dispersion factor is extracted as a check item for data integrity, and is spliced with the second layer ciphertext C2 to form M2=C2‖H(DF). Meanwhile, the third layer encryption key K3 is derived, and the third layer encryption key K3 is obtained by combining the master key with the data processing ID, the ciphertext digest obtained by the first two rounds of encryption, and the operation timestamp. The third layer encryption key K3 is used to further couple the data content and the key, so that each ciphertext is uniquely bound with its context. Then, the SM4-CBC algorithm is used again to encrypt M2 to obtain the third layer ciphertext C3.

[0112] It should be noted that the data processing ID includes but is not limited to a business system number, an operation type identifier (such as query, update), a data belonging institution code, and a security level marker, etc., which are used to distinguish the key derivation requirements in different business scenarios and to realize fine security isolation.

[0113] Specifically, the third layer encryption key K3 is derived by the HMAC-SM3 algorithm, and the master key is used as the input key material (IKM). The data processing ID, the SM3 digest (SM3(C1‖C2)) of the ciphertext obtained by the first two rounds of encryption, and the operation timestamp are spliced as a derivation context parameter. The key extraction-expansion process is performed in the trusted execution environment (TEE) to generate a 128-bit third layer encryption key K3, which ensures that the key is strongly bound with the data content, the time dimension, and the encryption context, and realizes the security goal of “one data one key”.

[0114] The final ciphertext obtained by the multi-layer encryption sub-module after single-layer, double-layer, or triple-layer encryption of the hash result H to be encrypted is output after Base64 encoding, and is stored in a secure database together with the salt value, the dispersion factor index, and the version number used in the current session. Taking triple-layer encryption as an example, it can be packaged as FinalPackage=Version‖Salt‖Index‖C3 to support future decryption and identity verification. It should be noted that the intermediate keys (K1, K2, K3) and the IV parameters in the entire encryption process are loaded temporarily in memory, and are not left in the disk or the database, and are destroyed immediately after use by a secure cleaner, so as to eliminate the possibility of being restored by a replay attack or a memory scanning tool due to key residues.

[0115] It should be noted that the dispersion factor index is a unique identifier of the dispersion factor (DF), which is generated by hashing or encoding, and is used to quickly locate the corresponding dispersion factor in the secure database. The dispersion factor is a random parameter used for key derivation, and the dispersion factor index is its retrieval identifier, which is stored by physical isolation to ensure that the dispersion factor cannot be directly accessed.

[0116] The hierarchical encryption constructs a layer-by-layer security barrier through triple nesting, blocks the ciphertext restoration chain and key derivation path from the root, and ensures that the system cannot inversely deduce other ciphertext structures or master key contents even if part of the key or intermediate data is leaked, thereby completing the hierarchical dynamic security of keys and data at the architecture level.

[0117] It should be noted that in the dynamic derivation key module and the multi-layer encryption submodule, since the SK and the DF are destroyed in time after use, and the master key never leaves the HSM, even if the attacker can obtain the SK or the snapshot of the short-term memory in a certain encryption process, the attacker cannot use these keys to crack other data instances or derive the master key, thereby achieving true key isolation, dynamic management and secure loop at the system architecture level.

[0118] To effectively balance the security strength and running performance of the system, the embodiment further adopts a variety of performance optimization mechanisms to support stable operation in a high-concurrency environment and guarantee system response efficiency. First, a key hot loading mechanism is introduced in the encryption phase, the dynamic derivation key module caches the sub-key derived by HMAC-SM3 at the thread level, reuses the key context within the limited life cycle, avoids frequent repeated derivation operations in high-frequency calling scenarios, and significantly reduces CPU computing pressure. Second, the multi-layer encryption submodule supports calling domestic cryptographic hardware acceleration modules or external SM4 encryption cards, and uniformly completes the hierarchical SM4-CBC encryption task by hardware, which can reduce the processing delay by more than 40% compared with the pure software encryption process, effectively improving the throughput capacity.

[0119] In addition, the embodiment adopts a flexible configuration strategy of encryption layers and processing granularity, automatically enables three-layer encryption for highly sensitive data (such as biometric features, anonymous identity ID, etc.), and only enables single-layer or double-layer encryption for ordinary log data to improve performance, to achieve the dynamic balance of fine protection of sensitive data and fast processing of ordinary data.

[0120] Further, the embodiment adopts a field-level block encryption strategy, for structured or super-long field data, uses a ciphertext block logic to split and independently encrypt large data objects, and then verifies by integrity check code, thereby achieving a balance between security and flexibility. In actual deployment, large-scale data sets can be split into asynchronous queues and processed in parallel by data grouping under a multi-thread pool, relieving the response blocking of the server and ensuring the continuity of the front-end business.

[0121] To further improve the processing stability, the embodiment further concurrently executes the multiple calls of layered encryption and IV generation by parallelizing encryption, using hardware acceleration and key cache mechanism, significantly reducing the delay and improving the throughput. In the derivation key and IV generation logic, a time window cache mechanism is built in, which can retain the intermediate results of key derivation in a short time, avoid repeated operation in a short period under the premise of meeting the security window constraint. At the same time, all intermediate keys and parameters only exist temporarily in TEE or trusted memory, and are cleared immediately after use, which not only guarantees security, but also improves the efficiency of key life cycle management.

[0122] The embodiment not only theoretically realizes the irreversibility of anonymous identification and data decoupling, but also optimizes the design through engineering implementation, making it have high concurrent scalability and practical deployability in a big data environment. While maintaining high security strength, it avoids the system performance bottleneck problem caused by the increase of algorithm complexity, thereby achieving the best balance between privacy protection and engineering feasibility.

[0123] The anonymous identifier generation module is used to comprehensively integrate the preprocessing, hash desensitization and dynamic encryption results, and construct the final anonymous output format which has high randomness in structural representation and stable uniqueness in identity mapping, and has strong irreversibility and low correlation. The original identity card number data is mapped to an anonymous identifier with structured specification, content scrambling and no mathematical relationship with plaintext after the above multi-layer processing. In the embodiment, the anonymous identifier generation module supports user-defined length and coding style of anonymous identifier, can adapt to different database field and interface protocol requirements, and provides optional prefix mask or data segmentation function to adapt to privacy display strategy. The anonymous identifier can be used as a user identification credential or data desensitization output outside the system, and can be used for two-way verification with the authorization process inside the system. The whole generation process strictly follows the design principles of not storing plaintext, log desensitization and parameter isolation, controls the information exposure channel from the source, and maximizes the protection of user privacy while retaining the identity recognition function.

[0124] The anonymous identifier generation aims to integrate all the above intermediate results into a final anonymous output format which has high randomness in structural representation and stable uniqueness in identity mapping, and has strong irreversibility and low correlation, so as to realize the complete anonymization of the original identity information.

[0125] Specifically, the anonymous identifier generation module extracts the final ciphertext result obtained by the hierarchical dynamic encryption module, and combines the hash digest of the corresponding salt value index and the hash digest of the dispersion factor index to form an identifier structure. To ensure compatibility across platforms and transmission friendliness, the Base64URL encoding algorithm is used to structure the identifier structure for structured encoding. This generates an anonymous identifier with controllable length and limited character set while preserving data integrity, ensuring good adaptability in different database fields or API protocols.

[0126] In the anonymous identifier construction process, the security requirements of irreversible anonymization processing in GB / T 35273-2020 "Information Security Technology Personal Information Security Specification" are followed to avoid retaining any metadata that can recover the original identity information. To further enhance the anti-pattern analysis capability, a lightweight character disturbance mechanism is introduced in this embodiment. During the encoding process, some character positions are replaced and rearranged pseudo-randomly to make it difficult to find regularity even under large-scale analysis, thereby significantly increasing the complexity of the attacker's reconstruction path. In addition, users can customize the length output of the anonymous identifier and the prefix of the anonymous identifier. According to business needs, prefix masking, data segmentation, or logic identification bit insertion strategies can be enabled to facilitate the display of privacy information and provide multi-dimensional permission control according to the scene.

[0127] In this embodiment, the anonymous identifier generation module generates anonymous identifiers in one of the two ways: streaming generation and batch processing. In streaming mode, the anonymous identifier generation module generates a unique anonymous identifier for a single identity card number data in real time, suitable for real-time business scenarios; in batch mode, the anonymous identifier generation module processes a batch of original identity card number data in parallel and automatically associates to generate log records for subsequent audit, traceability and permission verification. The generation process of all anonymous identifiers is completed in a trusted execution environment (TEE), ensuring that sensitive parameters such as keys, salt values, and dispersion factors are not leaked, and that intermediate plaintext or intermediate results are not retained in any persistent storage, thereby isolating potential attack paths from the technical architecture.

[0128] To enhance the verifiability and traceability of anonymous identifiers in cross-system and cross-institution scenarios, in this embodiment, the anonymous identifier generation module can optionally enable a digital signature mechanism when generating identifiers, and store the signature separately from the anonymous identifier. The digital signature mechanism signs the identifier structure based on the institution's private key, adding trusted authentication information while ensuring data integrity, supporting verification and permission judgment by downstream systems.

[0129] The identifier structure is a core data unit encapsulated in the anonymous identifier generation process, and contains structured fields such as the final ciphertext result (such as C3) obtained by the layered dynamic encryption module, the hash digest of the salt value index, the hash digest of the dispersion factor index, and the version number. The binary sequence of the identifier structure generates the final anonymous identifier through Base64URL encoding. The design of the identifier structure ensures data integrity and does not contain information that can restore the original identity, providing a standardized input for digital signatures.

[0130] In addition, in order to adapt to possible algorithm changes or security standard upgrades in the future, the embodiment adopts an anonymous identifier version control mechanism. Each generated anonymous identifier is attached with an encoded version number, so that the hash algorithm, encoding method or key length can be switched according to the version information on the business side, to ensure long-term security and backward compatibility.

[0131] The finally generated anonymous identifier has the properties of uniqueness, stability and high privacy protection capability, and can be used as a de-identified user ID outside the system, or can be used internally to complete identity mapping and two-way authentication in conjunction with the authorization process. The generation process of the anonymous identifier implements the principles of "not storing plaintext, not recording reversible path, and strictly isolating parameters", controls the risk of information leakage from the source, and ensures the maximum protection of user privacy while retaining the necessary identification capability. In medical, financial, government and other scenarios, the anonymous identifier can be used as a compliant substitute for plaintext identity information, meeting the mandatory requirements of laws and regulations for privacy protection, and ensuring the continuity and usability of data processing processes.

[0132] Taking three-layer encryption as an example, the generation process of the anonymous identifier AID can be expressed as:

[0133] AID = Base64URL (Confuse (Enc_K3 (C3‖H (Salt)‖

[0134] H (FactorIndex)))

[0135] Where AID represents the final anonymous identifier, Enc_K3 represents the encryption function using the final derived key K3, C3 is the final ciphertext after three-layer dynamic encryption processing, H(Salt) is the SM3 hash digest of the salt value index, H(FactorIndex) is the SM3 hash digest of the dispersion factor index, the confusion function Enc_K3 implements reversible character confusion processing based on a permutation table, and Base64URL encodes the output according to the RFC 4648 standard. The structure design realizes the multiple balance of security, compatibility and verifiability.

[0136] The anonymous identifier verification module is used in actual business applications to ensure the verifiability of anonymous identity while avoiding the leakage of plaintext information, and to realize anonymous identifier verification based on encrypted hash reverse verification.

[0137] The anonymous identifier verification module first receives the anonymous identifier and performs Base64URL decoding, character position disturbance restoration, and structure field disassembly, etc., to parse and obtain the ciphertext, the hash digest of the salt value index, and the hash digest of the dispersion factor index, etc. The anonymous identifier verification module locates the associated dispersion factor and its context Context through the hash digest of the dispersion factor index, combines the master key managed by the HSM, re-executes the HMAC-SM3 function, and derives the same sub-key SK and random initialization vector IV as in the encryption stage; then calls the SM4-CBC algorithm to decrypt and parse the obtained ciphertext, and restores the hash result H generated by the salt value enhanced hash module.

[0138] At the same time, the current input identity card number data of the user is processed by the secure preprocessing and format normalization module and the salt value enhanced hash module to generate a new hash result H". If the decrypted and restored hash result H is completely consistent with the generated new hash result H", it is determined that the identity verification is successful, and the subsequent authorization mechanism or permission distribution process can be triggered accordingly. The entire verification process runs in a trusted execution environment (such as TEE or HSM), the master key does not go out of the boundary, the user input does not fall on the disk, and the verification result also adopts the minimum data principle to write into the audit log, ensuring that the identity is verifiable while the information diffusion risk is maximally suppressed.

[0139] In this embodiment, the secure reverse derivation mechanism is used to realize plaintext-free verification, ensuring data authenticity while protecting privacy. During verification, the salt value, dispersion factor, and encryption parameters associated with the anonymous identifier are retrieved from an independent storage through a secure API, the original master key is used to re-derive the sub-key and decrypt the hash value layer by layer. Memory isolation protection is implemented during the decryption process, and the temporary key is only used in the encryption chip and is immediately cleared after decryption. The verifier uses the same SM3 algorithm to calculate the hash value of the user-submitted identity card number data (such as the identity card number associated with medical records), and compares the result with the decrypted hash value. If the consistency verification is passed, a positive result is returned. The entire verification process is optimized through a zero-knowledge proof mechanism, and the verifier can complete the verification without obtaining any sensitive parameters, and all operations are recorded to the blockchain audit log, realizing full traceability. This embodiment supports million-level concurrent verification requests, with an average response time of less than 50ms, meeting the needs of high real-time business scenarios, and ensuring the security of the verification process through anti-replay attack design and timestamp binding mechanism.

[0140] In the embodiment, to prevent man-in-the-middle attack and data replay, the verification process of the anonymous identity verification module is always performed in a trusted execution environment (such as TEE), all sensitive data processing is limited to short-term existence in memory and does not fall to disk, and the master key is always closed in the HSM, thereby constructing a verification path isolated throughout the process.

[0141] In the embodiment, the audit module is further used for performing verification behavior log audit, uniquely identifying and recording each verification behavior, and supporting post-tracing and permission change recording.

[0142] In addition, in the embodiment, the verification depth of the anonymous identity verification module can be adjusted on demand, cross-domain verification between heterogeneous systems can be performed, the salt value and the derivation strategy can be dynamically adjusted and updated, and replay prevention identification logic can be embedded to block multiple illegal invocations of the anonymous identity by an attacker. Without relying on plaintext storage, structured parsing, symmetric decryption restoration and hash value comparison verification of the anonymous identifier are realized, the balance between privacy protection and trusted verification of the anonymous identifier is ensured, and the real-name desensitization identification and data authorized use of the system in medical, financial, government and other scenarios are effectively supported.

[0143] As shown in the following formula:

[0144] h_input = SM3 (preprocess (ID) || salt)

[0145] ID is the current input identity card number data of the user, preprocess () is a uniform format normalization function, salt is a dynamic salt value bound to the identity card number data, and h_input is the hash result H" recalculated in the verification stage. The value is compared with the original hash result H restored by SM4 decryption bit by bit, as the final identity verification basis. The formula realizes irreversible mapping of the user's identity and non-plaintext verification capability, and is an important basis for realizing the anonymous verifiability of the application.

[0146] Further, the system of the embodiment can adopt a modular architecture design, each module can be encapsulated as an independent microservice or middleware component, and provide a unified API interface, a configuration parameter template and a desensitization strategy preset, support containerized deployment and on-demand integration on the business side, so as to quickly land without increasing the burden of the existing system. The system of the embodiment has low connection threshold, does not need to change the existing user identity data model, and can realize closed-loop processing only by gateway interception or desensitization intermediate layer, has the deployment ability of "plug and play", and is suitable for the original system upgrading and transformation needs in various business scenarios such as finance, government and medical treatment.

[0147] For those skilled in the art, various corresponding changes and modifications can be made to the above technical solutions and concepts, and all these changes and modifications should be included in the protection scope of the claims of the present application.

Claims

1. An ID card number anonymization system based on layered dynamic encryption and SM3 salt enhancement, characterized in that, It includes a secure preprocessing and format normalization module, a salt-enhanced hashing module, a dynamic derived key module, a layered dynamic encryption module, an anonymous identifier generation module, and an anonymous identifier verification module; The security preprocessing and formatting module includes a validity verification submodule, a formatting submodule, and a dynamic grouping submodule; The validity verification submodule is used to perform validity verification on the input original ID number; The format normalization submodule is used to uniformly map the last character of the original ID number, and then represent each character of the mapped ID number with the corresponding hexadecimal value to construct a standardized hexadecimal input sequence. The dynamic grouping submodule is used to generate a grouping region number (GID) for the input original ID number based on some fields of the original ID number; The salt-enhanced hashing module includes a salt generation submodule and a salt injection and hash processing submodule; The salt value generation submodule is used to generate the salt value S according to the following formula: S = SM3(GID||T||R) Where "||" represents the concatenation operation, GID is the user's group region number, T is the session timestamp or version marker, and R is the generated random number sequence; by concatenating GID, T, and R and performing a hash operation, a fixed-length salt value string is obtained; The salt injection and hash processing submodule is used to concatenate the salt value S generated by the salt generation submodule with the hexadecimal input sequence ID_std obtained by the format normalization submodule to form the hash input D = ID. std ||S, then use the hash function SM3 to calculate the hash value of D, and obtain the hash result H; The dynamic derivation key module is used to generate independent dispersion factors for ID card number data through a national-level cryptographic security random source. The dispersion factors, combined with the characteristics of the hash result H, form a derivation context Context, which, together with the master key hosted in the hardware security module HSM, is input into the key derivation function -SM3 based on Hash Message Authentication Code HMAC, i.e., the HMAC-SM3 algorithm, to generate the subkey SK. The layered dynamic encryption module is used to perform SM4-CBC mode encryption on the hash result H to be encrypted using the subkey SK derived by the dynamic derivation key module, and to complete the multi-layer dynamic encryption by combining it with the highly random random initialization vector IV. After encryption, the subkey SK is immediately cleared, and the random initialization vector IV and the encrypted ciphertext data are sent or stored as encrypted output. The anonymous identifier generation module is used to extract the final ciphertext result obtained by the hierarchical dynamic encryption module, and combine it with the hash digest of the corresponding salt index and the hash digest of the dispersion factor index to form an identifier structure; the Base64URL encoding algorithm is used to perform structured encoding on the identifier structure, generating anonymous identifiers with controllable length and limited character set while preserving data integrity. The anonymous identifier verification module is used in actual business applications to verify the ID card number data currently entered by the user. First, it receives the anonymous identifier and performs Base64URL decoding, perturbation character position restoration, and structural field decomposition to parse and obtain the ciphertext, the hash digest of the salt index, and the hash digest of the dispersion factor index. The anonymous identifier verification module locates the associated dispersion factor and its context using the hash digest of the dispersion factor index. Combined with the HSM-managed master key, it re-executes the HMAC-SM3 function to derive the same subkey SK and random initialization vector IV as in the encryption stage. Then, it calls the SM4-CBC algorithm to decrypt the parsed ciphertext and restore the hash result H generated by the salt-enhanced hash module. Meanwhile, the security preprocessing and format regularization module and the salt-enhanced hashing module process the user's currently input ID number data to generate a new hash result H”; if the hash result H obtained by decryption and restoration is completely consistent with the generated new hash result H”, the authentication is determined to be successful.

2. The system according to claim 1, characterized in that, The salt value generated by the salt-enhanced hash module is transferred to an independent repository within a trusted execution environment through a secure channel, implementing physical isolation storage and access control. It is immediately marked as invalid after a single use, and the audit module records the entire process of its generation and consumption for subsequent consistency verification and compliance auditing.

3. The system according to claim 1, characterized in that, The salinity can be managed using any of the following models: Unique salt value per user: A unique salt value is dynamically generated for each user, used for identity hashing and desensitization, ensuring "one person, one identifier" and preventing batch collisions; Salt value rotation per cycle: The global salt value version is changed according to the set cycle, realizing regular desensitization and rotation at the system level, effectively preventing the cumulative effect of long-term data leakage.

4. The system according to claim 1, characterized in that, The salt injection and hash processing submodule encapsulates the calculated hash result H in a recognizable format or outputs it using base64 encoding.

5. The system according to claim 1, characterized in that, The derivation process of the dynamic derivation key module is completed within a trusted execution environment. The master key is always protected by the HSM and does not go beyond the boundary. The dispersion factor is destroyed immediately after the subkey derivation is completed. The generated subkey only exists briefly in memory and is used for data encryption. It is cleared immediately after data encryption is completed and is not stored on disk.

6. The system according to claim 1, characterized in that, The dynamic key derivation module includes a dispersion factor generation submodule and a subkey derivation submodule; The dispersion factor generation submodule is used to generate an independent dispersion factor DF for the hash result H to be encrypted from a national-level cryptographically secure random source in a trusted execution environment, while recording the corresponding context information, including the characteristics of the hash result H, the session timestamp, and the business tag. The subkey derivation submodule is used to call the protected global master key MK in HSM and input it along with the dispersion factor DF into the HMAC-SM3 function to generate a pseudo-random key PRK; Then, input the PRK and context information Context into the extension function to generate the subkey SK.

7. The system according to claim 1, characterized in that, The audit module is used to automatically or manually rotate the master key and derived parameters according to time policies or event triggers, including periodically updating the master key or reinitializing the salt generation strategy of the derived function in the HSM; at the same time, it logs the process of generating the dispersion factor DF, calling the derived function, generating the subkey SK and clearing memory, and encryption operations.

8. The system according to claim 1, characterized in that, The layered dynamic encryption module includes an initialization submodule and a multi-layer encryption submodule; The initialization submodule is used to obtain the hash result H as the initial input, and to call the national cryptographic security random source to generate an independent random initialization vector IV within the trusted execution environment; The multi-layer encryption submodule is used to execute a three-layer nested encryption process. In the first layer encryption, the multi-layer encryption submodule generates the working key K1 required for the first layer encryption from the subkey SK by combining the current random initialization vector IV, context information, and session timestamp with the HMAC-SM3 algorithm. The multi-layer encryption submodule uses the working key K1 and the random initialization vector IV to perform encryption operation on the hash result H to be encrypted in SM4-CBC mode, generating the first layer ciphertext C1. In the second layer of encryption, the multi-layer encryption submodule concatenates the ciphertext C1 of the first layer with the random initialization vector IV used to form a structured data block M1 = IV‖C1, which serves as the input for the second layer of encryption. Then, the time key K2 is dynamically derived through the HMAC-SM3 algorithm, and the derivation parameters include the current system timestamp, the dispersion factor index value, and the business session identifier. The multi-layer encryption submodule uses the time key K2 and a new random vector IV2 to perform a second round of SM4-CBC encryption on the structured data block M1 to obtain the second layer of ciphertext C2. In the third layer of encryption, the hash value H(DF) of the dispersion factor is extracted as a data integrity check item and concatenated with the second layer ciphertext C2 to form M2 = C2‖H(DF); at the same time, the third layer encryption key K3 is derived, and then M2 is encrypted again using the SM4-CBC algorithm to obtain the third layer ciphertext C3. The multi-layer encryption submodule performs single-layer, double-layer, or triple-layer encryption on the hash result H to be encrypted. The resulting ciphertext is then Base64 encoded and output. Simultaneously, it is stored in the secure database along with the salt value, scatter factor index, and version number used in the current session.

9. The system according to claim 8, characterized in that, The third-layer encryption key K3 is derived using the HMAC-SM3 algorithm. The master key is used as the input key material. The data processing ID, the SM3 digests (C1||C2) of the ciphertext obtained from the first two rounds of encryption, and the operation timestamp are concatenated into the derivation context parameters. The key extraction-expansion process is executed in a trusted execution environment to generate the third-layer encryption key K3.

Citation Information

Patent Citations

  • Dynamic privacy data encryption method and system

    CN117874789A

Cited By

  • Database page integrity verification method and system based on national cryptographic algorithm and medium

    CN122333547A