An encryption method for encrypted data comparison
By setting encryption methods in semi-encrypted and fully encrypted states, and using intermediate and advanced keys to convert data in different security environments, the problem that existing encryption technology cannot efficiently compare digital values is solved, and the security and flexibility of data comparison are achieved.
Patent Information
- Application Number
- CN202211704074.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-12-29
AI Technical Summary
Existing encryption technologies have relatively simple confidentiality measures and limited functions, and are unable to efficiently compare encrypted digital values.
It adopts two encryption methods, semi-encrypted state and fully encrypted state, which correspond to each other. It converts data in different security operating environments through intermediate and advanced keys to protect the data from leaking specific values during comparison.
It enables data comparison under encryption states of different security levels, protects data from being leaked, and enhances the flexibility and security of encryption.
Smart Images

Figure CN116248348B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of encryption methods for encrypted data comparison, and in particular to an encryption method for encrypted data comparison. Background Art
[0002] The basic process of data encryption is to process a plaintext file or data using a specific algorithm, transforming it into an unreadable code, commonly called "ciphertext." This code can only be displayed after the corresponding key is entered. This method protects data from being stolen or read by unauthorized parties. The reverse process is decryption, which converts the coded information into its original data.
[0003] Existing encryption technology mainly uses keys for encryption. The encryption algorithm is basically determined according to the format of the file. In summary, the confidentiality means of existing encryption technology are relatively simple, limited in function, and have great limitations in use. It is impossible to efficiently compare encrypted digital values. Summary of the Invention
[0004] The technical problem to be solved by the present invention is: to solve the problem that the existing encryption technology has a relatively simple confidentiality means, limited functions, large usage restrictions, and cannot efficiently compare encrypted digital values.
[0005] The present invention provides an encryption method for encrypted data comparison, which sets two one-to-one encryption modes for each digital data: a semi-encrypted state system and a fully encrypted state. The semi-encrypted state and the fully encrypted state of each data have a one-to-one correspondence. The semi-encrypted state data can be compared in size. The user can upgrade from the semi-encrypted state (comparison state) to the fully encrypted state through a key, and can also switch from the fully encrypted state to the semi-encrypted state through a key, which effectively solves the above-mentioned problem.
[0006] The technical solution adopted by the present invention to solve its technical problem is:
[0007] An encryption method for encrypted data comparison sets two one-to-one encryption modes for each digital data: a semi-encrypted state system and a fully encrypted state. The semi-encrypted state and the fully encrypted state of each data have a one-to-one correspondence. The semi-encrypted state data can be compared in size. The user can upgrade from the semi-encrypted state (comparison state) to the fully encrypted state through a key, and can also switch from the fully encrypted state to the semi-encrypted state through a key, that is, the fully encrypted state = semi-encrypted state + full encryption parameters.
[0008] Specifically, two security environments are set up based on the encryption level. When data is semi-encrypted, it runs in the intermediate security environment; when data requires encryption or decryption using a high-level key, it runs in the high-level security environment. Because data comparison is performed only in the intermediate security environment, even if a breach occurs, the data's specific values will not be leaked.
[0009] Specifically, a set of advanced keys is used to obfuscate digital data to obtain semi-encrypted data corresponding to the plaintext data. The semi-encrypted data can be compared in size, and the proportional relationship between the numbers is protected by three advanced keys β, X, and M.
[0010] Specifically, the semi-encrypted state algorithm uses a fixed advanced key M value to hide the relationship between semi-encrypted data, where the length of M is equal to the plaintext data a i The length of the product with X|a i ·X|=|M|.
[0011] Specifically, the semi-encrypted state algorithm uses a fixed advanced key X multiplied by the plaintext data a i To hide the actual value of the plaintext data, and generate a key s that corresponds to each plaintext data one by one by fixing the advanced key β value and the plaintext data identification id to blur the ratio between the plaintext data. Since s must be less than X after taking the modulus, it will not change the size of the semi-encrypted data. The semi-encrypted state data is: a i ·X+M+(s mod X).
[0012] Specifically, the semi-encrypted data is double-encrypted using a set of intermediate keys to form fully encrypted data. The fully encrypted data cannot be compared, and the proportional relationship between the data is also completely protected. At the same time, each fully encrypted data can be converted into the semi-encrypted data corresponding to the data using a set of intermediate keys corresponding to the data.
[0013] The beneficial effects of the present invention are: the present invention provides an encryption method for encrypted data comparison, the present invention converts encrypted data from a fully encrypted state to a semi-encrypted state by using an intermediate key, and the main purpose of the intermediate security operating environment is to protect the intermediate key, and it can also be used to protect semi-encrypted state data; the present invention decrypts fully encrypted data to a semi-encrypted state by using a high-level key, or upgrades semi-encrypted state data to a fully encrypted state by using a high-level key, and the main purpose of the high-level security operating environment is to protect the high-level key. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The present invention will be further described below with reference to the accompanying drawings and examples.
[0015] Figure 1It is a schematic diagram of the data encryption process of the present invention;
[0016] Figure 2 It is a schematic diagram of the data decryption process of the present invention;
[0017] Figure 3 It is a schematic diagram of the ciphertext size comparison process of the present invention. DETAILED DESCRIPTION
[0018] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.
[0019] An encryption method for encrypted data comparison sets two one-to-one encryption modes for each digital data: a semi-encrypted state system and a fully encrypted state. The semi-encrypted state and the fully encrypted state of each data have a one-to-one correspondence. The semi-encrypted state data can be compared in size. The user can upgrade from the semi-encrypted state (comparison state) to the fully encrypted state through a key, and can also switch from the fully encrypted state to the semi-encrypted state through a key, that is, the fully encrypted state = semi-encrypted state + full encryption parameters.
[0020] Two security operating environments are set up according to the encryption level. When the data is in a semi-encrypted state, the semi-encrypted data runs in the intermediate security operating environment; when the data is in a state that requires the use of a high-level key for encryption or decryption operations, it runs in the high-level security operating environment. Since data comparison only runs in the intermediate security operating environment, the specific data values will not be leaked even if it is hacked.
[0021] In a specific embodiment, digital data is obfuscated using a set of advanced keys to generate semi-encrypted data corresponding to the plaintext data. The semi-encrypted data can be compared in size, and the proportional relationship between the numbers is protected by three advanced keys β, X, and M.
[0022] The semi-encrypted state algorithm uses a fixed advanced key M value to hide the relationship between semi-encrypted data, where the length of M is equal to the plaintext data a i The length of the product with X|a i X| = |M|;
[0023] In the semi-encrypted state algorithm, a fixed advanced key X is multiplied by the plaintext data a i To hide the actual value of the plaintext data, and generate a key s that corresponds to each plaintext data one by one by fixing the advanced key β value and the plaintext data identification id to blur the ratio between the plaintext data. Since s must be less than X after taking the modulus, it will not change the size of the semi-encrypted data. The semi-encrypted state data is: a iX+M+(s mod X): Semi-encrypted data is re-encrypted using a set of intermediate keys to create fully encrypted data. Fully encrypted data cannot be compared, and the proportional relationship between data is completely protected. At the same time, each fully encrypted data point can be converted into the corresponding semi-encrypted data point using a set of advanced keys corresponding to that data point.
[0024] System operation architecture:
[0025] Intermediate security operating environment: By using the intermediate key to convert encrypted data from a fully encrypted state to a semi-encrypted state, the intermediate security operating environment is mainly used to protect the intermediate key, and can also be used to protect semi-encrypted data.
[0026] Advanced Security Operating Environment: By using advanced keys to decrypt fully encrypted data to a semi-encrypted state, or by upgrading plaintext data to a semi-encrypted state through advanced keys, the main purpose of the advanced security operating environment is to protect advanced keys.
[0027] Encrypted data architecture:
[0028] The present invention proposes a new staged encryption data structure.
[0029] Specifically, two encryption states, semi-encrypted and fully encrypted, are set for each digital data. The semi-encrypted and fully encrypted states of each data are one-to-one corresponding. The user can upgrade from semi-encrypted to fully encrypted state through the key, or switch from fully encrypted state to semi-encrypted state through the key. The specific architecture can be expressed as: Full encryption state = semi-encrypted state + full encryption parameters
[0030] Semi-encrypted data: A third party cannot obtain complete data information from semi-encrypted data, but can compare the data. Semi-encrypted data protects data from being leaked to the greatest extent possible.
[0031] a i X+M+(s mod X)
[0032] Where s represents a secret parameter, which is a key obtained by hash function h, advanced key β, and data id. s can be expressed as:
[0033] s=h(β+id)
[0034] a i : Plaintext data
[0035] id: the identifier of the encrypted data
[0036] β, X, M: three advanced keys
[0037] g: hash function
[0038] Where M and s are used to mask different plaintext data a i The relationship between i The length of the result of X is equal to the length of M
[0039] |a i ·X|=|M|
[0040] If |a i X|=n, |M|=n+z, the first z bits of M need to be cut off:
[0041] For example:
[0042] a i :200
[0043] id:001
[0044] β:7232572102534789456
[0045] X:2456790134
[0046] M:9210575283901903231
[0047] | a i·X|=12
[0048] |M|=19 (removing the first 7 digits: 9210575283901903231->283901903231)
[0049] s:h(7232572102534789456+001)=
[0050] 09C3705BD75FFC48AD4B31A906A0EFEB787847BE2EB7BB5CD2E354F0CC79DA80
[0051] Semi-encrypted data: 200·2456790134+283901903231+(s mod 2456790134)=775441410751
[0052] Fully encrypted state: A third party cannot obtain any information from the fully encrypted data. The system obtains the fully encrypted data of the corresponding data by combining the semi-encrypted data corresponding to the data ID and the fully encrypted parameters corresponding to the data ID.
[0053] a i X+M+s mod X+(h(α+id))mod P
[0054] The system can also subtract the full encryption parameter corresponding to the data from the fully encrypted state information to obtain the semi-encrypted state data of the corresponding data. The full encryption parameter part is:
[0055] (h(α+id))modp
[0056] id: Identifier corresponding to the encrypted data (public data)
[0057] p: a prime number (public data)
[0058] α: Intermediate key
[0059] h: hash function
[0060] For example:
[0061] p:18446744069414584321
[0062] α:56784568902340985234
[0063] id:001
[0064] Full encryption parameters: h(56784568902340985234+001)=
[0065] B1F5C9E26F69243797ECB5478C810AA9D77FA4A047065C69F1106344F52A5FD7
[0066] Fully encrypted state data:
[0067] (775441410751+h(56784568902340985234+001))mod18446744069414584321=14240041535694643979
[0068] Semi-encrypted data: 14240041535694643979-h(56784568902340985234+001mod18446744069414584321=775441410751
[0069] System operation process
[0070] Data encryption process: Figure 1 As shown, the plaintext data is first encrypted into semi-encrypted data using a high-level key in the high-level security operating environment. The semi-encrypted data is directly pushed to the intermediate security operating environment and then finally encrypted using the intermediate key to form fully encrypted data.
[0071] Data decryption process: Figure 2 As shown, the fully encrypted data is first decrypted into semi-encrypted data in the intermediate security operating environment using the intermediate key. The semi-encrypted data will be directly pushed to the advanced security operating environment and then the advanced key will complete the final decryption operation to obtain the plaintext data.
[0072] Ciphertext size comparison process: Figure 3 As shown, the main advantage of the present invention is that the size comparison between ciphertexts is performed in a semi-encrypted state. When performing the digital size comparison, all processes are completed in a medium-level security operating environment.
[0073] With the above-described preferred embodiments of the present invention as a guide, and with reference to the above description, relevant personnel are fully capable of making various changes and modifications without departing from the technical scope of this invention. The technical scope of this invention is not limited to the contents of the specification and must be determined according to the scope of the claims.
Claims
1. An encryption method for comparing encrypted data, characterized by: For each digital data, two encryption modes are set: semi-encrypted state system and fully encrypted state system. The semi-encrypted state and fully encrypted state of each data correspond one to one. The semi-encrypted state data can be compared in size. The user can upgrade from semi-encrypted state to fully encrypted state through the key, or switch from fully encrypted state to semi-encrypted state through the key. That is, fully encrypted state data = semi-encrypted state data + fully encrypted parameter. The semi-encrypted state data is obtained by the following formula: a i ·X+M+(s mod X) Where s represents a secret parameter, which is a key obtained by hash function h, advanced key β, and data id. s can be expressed as: s = h (β + id), a i : Plaintext data id: the identifier of the encrypted data. β,X,M: three advanced keys, h: hash function, Where M and s are used to mask different plaintext data a i The relationship between i The length of the result of X is equal to the length of M, |a i ·X|=|M|, If |a i X|=n, |M|=n+z, the first z bits of M need to be cut off.
2. The encryption method for comparing encrypted data according to claim 1, characterized in that: Two security operating environments are set according to the encryption level. When the data is in a semi-encrypted state, the semi-encrypted data runs in the intermediate security operating environment; when the data is in a state that requires the use of a high-level key for encryption or decryption operations, it runs in the high-level security operating environment.
3. The encryption method for comparing encrypted data according to claim 2, characterized in that: The semi-encrypted data is re-encrypted using a set of intermediate keys to form fully encrypted data. The fully encrypted data cannot be compared with each other, and the proportional relationship between the data is also completely protected. At the same time, each fully encrypted data can be converted into the corresponding semi-encrypted data using a set of advanced keys corresponding to the data.
Citation Information
Patent Citations
Lightweight-class homomorphic encryption method for implementing privacy protection in cloud computation
CN109327304A
High-performance data multi-level encryption and decryption method and system based on complete homomorphic encryption
CN113078992A