A reserved format encryption and decryption method based on a national secret ZUC algorithm and a distinguishable mechanism

By employing a format-preserving encryption method based on the ZUC algorithm and a verifiable mechanism, the problem that existing technologies cannot protect privacy and cannot restore data to its original form through data anonymization is solved. This method improves encryption efficiency and data format consistency, ensuring data security and decryptability.

CN120856470BActive Publication Date: 2026-01-23SHANDONG XINCHAO INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511334136.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-18
Publication Date
2026-01-23
Estimated Expiration
2045-09-18

AI Technical Summary

Technical Problem

Existing data anonymization methods cannot effectively protect privacy information and cannot restore the data to its original form, resulting in significant limitations in application scenarios.

Method used

The method employs a format-preserving encryption approach based on the ZUC algorithm and a distinguishable mechanism. By splitting the original data into independent fields, a mapping table and an inverse mapping table are generated. The ZUC algorithm is used to generate a key stream for symmetric encryption, and a symmetric ciphertext is generated through a bitwise XOR operation. The 128-EIA3 algorithm is then used to generate a message authentication code, ultimately generating an FPE ciphertext that meets the format requirements.

Benefits of technology

It ensures that the encrypted format is completely consistent with the original text, guaranteeing data security and format consistency, supporting the database's requirements for data format, and can decrypt back to the original data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120856470B_ABST
    Figure CN120856470B_ABST
Patent Text Reader

Abstract

The application discloses a reserved format encryption and decryption method based on a national secret ZUC algorithm and a distinguishable mechanism, relates to the field of mixed English and Chinese reserved format encryption, and achieves complete consistency between a ciphertext format and an original text through the following steps: performing multi-field structured analysis on an original message space, generating a high-randomness key stream by using the national secret ZUC algorithm to perform symmetric encryption, and finally mapping the ciphertext into the original message space, thereby achieving complete consistency between a ciphertext format and an original text. The method has high security guarantee, is designed based on the correlation of fields in a format space, and designs a general reserved format encryption method and system. The method can effectively guarantee the safety of personal sensitive information and simultaneously supports the requirement of various databases on data format consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mixed Chinese and English format encryption, specifically to an encryption and decryption method based on the Chinese national cryptographic ZUC algorithm and a distinguishable mechanism for format encryption. Background Technology

[0002] Currently, commonly used data anonymization techniques include replacement, truncation, offsetting, encryption, masking, and rounding. These methods de-identify sensitive data from different dimensions, protecting privacy information to a certain extent. However, traditional data anonymization methods, on the one hand, are still based on real data, which can still leak some privacy information; on the other hand, they cannot be restored to real data, which greatly limits their application scenarios. Summary of the Invention

[0003] In order to overcome the shortcomings of the above technologies, this invention provides a method that can reduce the resource consumption of the format-preserving encryption and decryption process and improve encryption efficiency.

[0004] The technical solution adopted by this invention to overcome its technical problems is:

[0005] A method for encryption and decryption based on the ZUC algorithm (Chinese national cryptographic standard) and a distinguishable mechanism, characterized in that it includes:

[0006] A1. Obtaining raw data , the original data Split into An explicit text , For the first An explicit text, ;

[0007] A2. Obtain the mapping table based on the fields. and inverse mapping table ;

[0008] A3. According to the mapping table Get the first An explicit text Serial number ;

[0009] A4. Using the ZUC algorithm, generate a keystream of the same length as the plaintext data based on the Key and IV in the ZUC algorithm. Through formula The symmetric ciphertext was calculated. In the formula This is a bitwise XOR operation;

[0010] A5. Based on symmetric ciphertext Obtain message authentication code Passing the exam An explicit text FPE ciphertext ;

[0011] A6. Will Concatenate the plaintext FPE ciphertext to obtain the FPE ciphertext. .

[0012] Furthermore, step A1 includes the following steps:

[0013] A1-1. Transfer the original data Data format Split into Independent fields , For the first One field, ;

[0014] A1-2. Original data Split according to the corresponding fields to obtain An explicit text .

[0015] Furthermore, step A2 includes the following steps:

[0016] A2-1. [The following is a partial translation and can be left as is:] fields The corresponding message space name is defined as , No. fields The message space size is , , As a variable;

[0017] A2-2. Use binary sort to sort the... An explicit text Elements from 1 to The sorting yields the first... Mapping table of plaintext and inverse mapping table .

[0018] Furthermore, step A3 includes the following steps:

[0019] A3-1. The first An explicit text According to the mapping table Perform data mapping to obtain the first An explicit text In the mapping table Index number in ;

[0020] A3-2. Using the formula Calculation yields the first An explicit text Serial number .

[0021] Furthermore, step A5 includes the following steps:

[0022] A5-1. Through the formula The symmetric ciphertext was calculated. The index number corresponding to the original message space In the formula Modulo operation;

[0023] A5-2. [The following appears to be a separate, unrelated sentence:] The first... An explicit text Serial number With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ,variable The length is ;

[0024] A5-3. Index number According to the inverse mapping table Perform mapping to obtain the first An explicit text In the reverse mapping table Index number in ;

[0025] A5-4. Using the formula Calculation yields the first An explicit text FPE ciphertext .

[0026] A method for decrypting ciphertext, characterized by comprising:

[0027] B1. Contain the FPE ciphertext Split into FPE ciphertext ;

[0028] B2. Obtain the mapping table based on the fields. and inverse mapping table ;

[0029] B3. According to the mapping table Obtain FPE ciphertext Corresponding serial number ;

[0030] B4. According to the serial number Get the first An explicit text Serial number ;

[0031] B5. Based on the inverse mapping table Get the first An explicit text ;

[0032] B6. Will The plaintext is concatenated to obtain the original data. .

[0033] Furthermore, step B2 includes the following steps:

[0034] B2-1. The first fields The corresponding message space name is defined as , No. fields The message space size is , , As a variable;

[0035] B2-2. Use binary sort to sort the... An explicit text Elements from 1 to The sorting yields the first... Mapping table of plaintext and inverse mapping table .

[0036] Furthermore, step B3 includes the following steps:

[0037] B3-1. The first An explicit text FPE ciphertext According to the mapping table Perform data mapping to obtain FPE ciphertext. In the mapping table Index number in ;

[0038] B3-2. Through formula The FPE ciphertext was calculated. Corresponding serial number .

[0039] Furthermore, step B4 includes the following steps:

[0040] B4-1. Using the ZUC algorithm, generate a keystream of the same length as the plaintext data based on the Key and IV in the ZUC algorithm. ;

[0041] B4-2. Through formula Calculate the plaintext value In the formula For bitwise XOR operation, use the formula Calculate the plaintext value ;

[0042] B4-3. Plaintext value With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ;

[0043] B4-4. Plaintext value With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ;

[0044] B4-5. When the message authentication code With message authentication code If they are equal, then the first... An explicit text Serial number When message authentication code With message authentication code If they are equal, then the first... An explicit text Serial number When message authentication code With message authentication code Not equal to and the message authentication code If they are not equal, then FPE ciphertext The message authentication code is deemed invalid. With message authentication code Equal to and the message authentication code If they are equal, then the FPE ciphertext is correct. It has been determined to be invalid.

[0045] Furthermore, step B5 includes the following steps:

[0046] B5-1. Serial Number According to the inverse mapping table Perform a mapping to obtain its inverse mapping table. Index number in ;

[0047] B5-2. Through formula Calculation yields the first An explicit text .

[0048] The beneficial effects of this invention are: by performing multi-field structured parsing on the original message space, generating a highly random key stream using the national cryptographic ZUC algorithm for symmetric encryption, and finally mapping the ciphertext back to the original message space, the ciphertext format is completely consistent with the original text. It offers high security, and is designed based on the correlation of fields in the format space, resulting in a general format-preserving encryption method and system. It can effectively guarantee the security of sensitive personal information while supporting the data format consistency requirements of various databases. Attached Figure Description

[0049] Figure 1 A schematic diagram illustrating the changes in the message space before and after symmetric encryption;

[0050] Figure 2 This is a block diagram of the FPE system of the present invention;

[0051] Figure 3 This is a flowchart of the FPE (Fragmented Execution Environment) encryption process of the present invention. Detailed Implementation

[0052] The following is in conjunction with the appendix Figure 1 Appendix Figure 2 Appendix Figure 3 The present invention will be further described below.

[0053] Format Preservation Encryption (FPE) is a special type of symmetric encryption technology. Its core characteristic is that it maintains complete consistency in the format (such as length, character type, and data structure) of the plaintext and ciphertext during the encryption process. The ciphertext and plaintext reside in the same message space, and the encryption process is reversible, allowing the original data to be recovered through decryption. FPE's various features make it particularly suitable for data anonymization, solving the problem that traditional data anonymization methods (such as masking, substitution, and hashing) may corrupt the data format, rendering the data unusable for direct testing and unable to be decrypted back to the original. Furthermore, FPE guarantees that encrypted data can be decrypted back to the original, making it highly suitable for scenarios requiring dynamic decryption.

[0054] The security goal of the FPE standard is PRP security, requiring attackers to be unable to distinguish the FPE scheme from random permutations within the message space. FPE technology is generally based on symmetric cryptographic algorithms, ensuring both algorithm confidentiality and relatively fast encryption speed. Traditional FPE technologies are typically based on block ciphers such as AES, SM4, or custom-designed Feistel ciphers. However, stream cipher algorithms like ZUC, with their lower computational complexity and simpler key management, are also suitable as the foundation for FPE.

[0055] The ZUC algorithm, also known as the Zu Chongzhi stream cipher algorithm, belongs to the synchronous stream cipher family and was the first Chinese cryptographic algorithm to be adopted as an international cryptographic standard. At the 3rd Generation Partnership Project (3GPP) meeting in September 2011, the Zu Chongzhi cryptographic algorithm (ZUC) designed in my country was approved as an international standard for the next-generation broadband wireless mobile communication system (LTE), i.e., the 4G international standard, and is widely used for secure data transmission in mobile communication networks.

[0056] Authenticable encryption is a cryptographic technique based on symmetric cryptography. It is used to achieve data confidentiality protection and provide data integrity and data source authentication. It includes two processes: encryption and decryption, and provides data confidentiality, data integrity and data source authentication.

[0057] Specifically, a method for encryption and decryption based on the ZUC algorithm (Chinese national cryptographic standard) and a verifiable mechanism, characterized by comprising:

[0058] A1. Obtaining raw data , the original data Split into An explicit text , For the first An explicit text, .

[0059] A2. Obtain the mapping table based on the fields. and inverse mapping table .

[0060] A3. According to the mapping table Get the first An explicit text Serial number .

[0061] A4. Using the ZUC algorithm, generate a keystream of the same length as the plaintext data based on the Key and IV in the ZUC algorithm. Through formula The symmetric ciphertext was calculated. In the formula This is a bitwise XOR operation.

[0062] A5. Based on symmetric ciphertext Obtain message authentication code Passing the exam An explicit text FPE ciphertext .

[0063] A6. Will The plaintext FPE ciphertext is concatenated to obtain a complete FPE ciphertext that meets the format preservation requirements. .

[0064] Since FPE technology, as a type of encryption technology, inherently requires eliminating the correlation between data between fields, this invention, to avoid the potential mismatch between the message space after symmetric encryption and the original message space, treats independent fields and the non-independent fields affected by them as a single independent field, and then performs FPE encryption on each independent field independently.

[0065] In one embodiment of the present invention, step A1 includes the following steps:

[0066] A1-1. Transfer the original data Data format Split into Independent fields , For the first One field, .

[0067] A1-2. Original data Split according to the corresponding fields to obtain An explicit text .

[0068] As attached Figure 1 As shown, in one embodiment of the present invention, step A2 includes the following steps:

[0069] A2-1. [The following is a partial translation and can be left as is:] fields The corresponding message space name is defined as , No. fields The message space size is , , For variables.

[0070] A2-2. Use binary sort to sort the... An explicit text Elements from 1 to The sorting yields the first... Mapping table of plaintext and inverse mapping table .

[0071] In one embodiment of the present invention, step A3 includes the following steps:

[0072] A3-1. The first An explicit text According to the mapping table Perform data mapping to obtain the first An explicit text In the mapping table Index number in .

[0073] A3-2. Using the formula Calculation yields the first An explicit text Serial number .

[0074] As attached Figure 3 As shown, in one embodiment of the present invention, step A5 includes the following steps:

[0075] A5-1. Symmetric ciphertext may not be in the original message space, therefore, the formula is used... The symmetric ciphertext was calculated. The index number corresponding to the original message space In the formula Modulo operation.

[0076] A5-2. Considering the limited length of plaintext, it is not suitable to use a hash function to generate it. Therefore, the present invention will... An explicit text Serial number With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ,variable The length is Integrity protection is achieved using the 128-EIA3 algorithm based on the ZUC algorithm.

[0077] A5-3. Index number According to the inverse mapping table Perform mapping to obtain the first An explicit text In the reverse mapping table Index number in .

[0078] A5-4. Using the formula Calculation yields the first An explicit text FPE ciphertext .

[0079] A method for decrypting ciphertext, characterized by comprising:

[0080] B1. Contain the FPE ciphertext Split into FPE ciphertext ;

[0081] B2. Obtain the mapping table based on the fields. and inverse mapping table .

[0082] B3. According to the mapping table Obtain FPE ciphertext Corresponding serial number .

[0083] B4. According to the serial number Get the first An explicit text Serial number .

[0084] B5. Based on the inverse mapping table Get the first An explicit text .

[0085] B6. Will The plaintext is concatenated to obtain the correct, complete, and format-preserving original data. .

[0086] In one embodiment of the present invention, step B2 includes the following steps:

[0087] B2-1. The first fields The corresponding message space name is defined as , No. fields The message space size is , , For variables.

[0088] B2-2. Use binary sort to sort the... An explicit text Elements from 1 to The sorting yields the first... Mapping table of plaintext and inverse mapping table .

[0089] In one embodiment of the present invention, step B3 includes the following steps:

[0090] B3-1. The first An explicit text FPE ciphertext According to the mapping table Perform data mapping to obtain FPE ciphertext. In the mapping table Index number in .

[0091] B3-2. Through formula The FPE ciphertext was calculated. Corresponding serial number .

[0092] Because modular arithmetic is used in the encryption process, symmetric ciphertext exists. Message space and sequence number position The message spaces are not equal. Specifically, the value may correspond to the values ​​of two symmetric ciphertexts, leading to potentially incorrect decryption results. Therefore, this invention decrypts both symmetric ciphertexts and then uses a discriminative mechanism to authenticate them; the one that passes the authentication is the true plaintext. Specifically, in one embodiment of this invention, step B4 includes the following steps:

[0093] B4-1. Using the ZUC algorithm, generate a keystream of the same length as the plaintext data based on the Key and IV in the ZUC algorithm. .

[0094] B4-2. Through formula Calculate the plaintext value In the formula For bitwise XOR operation, use the formula Calculate the plaintext value .

[0095] B4-3. Plaintext value With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. .

[0096] B4-4. Plaintext value With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. .

[0097] B4-5. When the message authentication code With message authentication code If they are equal, it means the plaintext value is equal to the plaintext value. If it is the correct plaintext, then the first... An explicit text Serial number When message authentication code With message authentication code If they are equal, it means the plaintext value is equal to the plaintext value. If it is the correct plaintext, then the first... An explicit text Serial number When message authentication code With message authentication code Not equal to and the message authentication code The inconsistency indicates that the FPE ciphertext is not equal. If tampered with, then the FPE ciphertext The message authentication code is deemed invalid. With message authentication code Equal to and the message authentication code If they are equal, it means the FPE ciphertext is correct. If it fails, the FPE ciphertext will be lost. It has been determined to be invalid.

[0098] In one embodiment of the present invention, step B5 includes the following steps:

[0099] B5-1. Serial Number According to the inverse mapping table Perform a mapping to obtain its inverse mapping table. Index number in .

[0100] B5-2. Through formula Calculation yields the first An explicit text .

[0101] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for encryption and decryption based on the ZUC algorithm (Chinese national cryptographic standard) and a distinguishable mechanism, characterized in that: include: A1. Obtaining raw data , the original data Split into An explicit text , For the first An explicit text, ; A2. Obtain the mapping table based on the fields. and inverse mapping table ; A3. According to the mapping table Get the first An explicit text Serial number ; A4. Using the ZUC algorithm, generate a keystream of the same length as the plaintext data based on the Key and IV in the ZUC algorithm. Through formula The symmetric ciphertext was calculated. In the formula This is a bitwise XOR operation; A5. Based on symmetric ciphertext Obtain message authentication code Passing the exam An explicit text FPE ciphertext ; A6. Will Concatenate the plaintext FPE ciphertext to obtain the FPE ciphertext. ; Step A5 includes the following steps: A5-1. Through the formula The symmetric ciphertext was calculated. The index number corresponding to the original message space In the formula Modulo operation; A5-2. [The following appears to be a separate, unrelated sentence:] The first... An explicit text Serial number With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ,variable The length is ; A5-3. Index number According to the inverse mapping table Perform mapping to obtain the first An explicit text In the reverse mapping table Index number in ; A5-4. Using the formula Calculation yields the first An explicit text FPE ciphertext .

2. The encryption and decryption method based on the ZUC algorithm and a distinguishable mechanism according to claim 1, characterized in that, Step A1 includes the following steps: A1-1. Transfer the original data Data format Split into Independent fields , For the first One field, ; A1-2. Original data Split according to the corresponding fields to obtain An explicit text .

3. The encryption and decryption method based on the ZUC algorithm and a distinguishable mechanism according to claim 2, characterized in that, Step A2 includes the following steps: A2-1. [The following is a partial translation and can be left as is:] fields The corresponding message space name is defined as , No. fields The message space size is , , As a variable; A2-2. Use binary sort to sort the... An explicit text Elements from 1 to The sorting yields the first... Mapping table of plaintext and inverse mapping table .

4. The encryption and decryption method based on the ZUC algorithm and a distinguishable mechanism according to claim 1, characterized in that, Step A3 includes the following steps: A3-1. The first An explicit text According to the mapping table Perform data mapping to obtain the first An explicit text In the mapping table Index number in ; A3-2. Using the formula Calculation yields the first An explicit text Serial number .

5. A method for decrypting ciphertext generated by the encryption method according to any one of claims 1 to 4, characterized in that, include: B1. Contain the FPE ciphertext Split into FPE ciphertext ; B2. Obtain the mapping table based on the fields. and inverse mapping table ; B3. According to the mapping table Obtain FPE ciphertext Corresponding serial number ; B4. According to the serial number Get the first An explicit text Serial number ; B5. Based on the inverse mapping table Get the first An explicit text ; B6. Will The plaintext is concatenated to obtain the original data. .

6. The decryption method according to claim 5, characterized in that, Step B2 includes the following steps: B2-1. The first fields The corresponding message space name is defined as , No. fields The message space size is , , As a variable; B2-2. Use binary sort to sort the... An explicit text Elements from 1 to The sorting yields the first... Mapping table of plaintext and inverse mapping table .

7. The decryption method according to claim 5, characterized in that, Step B3 includes the following steps: B3-1. The first An explicit text FPE ciphertext According to the mapping table Perform data mapping to obtain FPE ciphertext. In the mapping table Index number in ; B3-2. Through formula The FPE ciphertext was calculated. Corresponding serial number .

8. The decryption method according to claim 6, characterized in that, Step B4 includes the following steps: B4-1. Using the ZUC algorithm, generate a keystream of the same length as the plaintext data based on the Key and IV in the ZUC algorithm. ; B4-2. Through formula Calculate the plaintext value In the formula For bitwise XOR operation, use the formula Calculate the plaintext value ; B4-3. Plaintext value With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ; B4-4. Plaintext value With input variables After the concatenation operation, the concatenation result, the Key in the 128-EIA3 algorithm, and the IV in the 128-EIA3 algorithm are used to calculate the message authentication code using the 128-EIA3 algorithm. ; B4-5. When the message authentication code With message authentication code If they are equal, then the first... An explicit text Serial number When message authentication code With message authentication code If they are equal, then the first... An explicit text Serial number When message authentication code With message authentication code Not equal to and the message authentication code If they are not equal, then FPE ciphertext The message authentication code is deemed invalid. With message authentication code Equal to and the message authentication code If they are equal, then the FPE ciphertext is correct. It has been determined to be invalid.

9. The decryption method according to claim 5, characterized in that, Step B5 includes the following steps: B5-1. Serial Number According to the inverse mapping table Perform a mapping to obtain its inverse mapping table. Index number in ; B5-2. Through formula Calculation yields the first An explicit text .

Citation Information

Patent Citations

  • Wireless secret communication system based on STM32

    CN108377180A

  • Reserved format encryption method based on stream cipher

    CN110795762A