System, method and equipment for preventing quantum security symmetric encryption from counterfeiting ciphertext and medium
By pre-arrangement of the target hash algorithm and anti-counterfeiting true and random numbers in quantum secure symmetric encryption communication, and generating and integrating anti-counterfeiting hash values, the problem that traditional hash algorithms are easily cracked is solved, and effective anti-counterfeiting for quantum secure communication is achieved. , ensure the integrity and authenticity of the data.
Patent Information
- Application Number
- CN202411524605.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-01-10
AI Technical Summary
When facing forged message attacks, the existing quantum security symmetric encryption communication methods are easily cracked by quantum computers, resulting in security threats and cannot effectively resist ciphertext forgery attacks.
In quantum secure symmetric encryption communication, target hashing algorithms and anti-counterfeiting true random numbers are pre-arranged, and anti-counterfeiting hash values are generated through these algorithms and random numbers, and anti-counterfeiting true random numbers are incorporated during the encryption and decryption process to ensure the hash value Randomness makes it difficult for forgers to generate valid hash values, thereby preventing forgers from forging ciphertexts.
It effectively improves the difficulty of ciphertext forgery, ensures the integrity and authenticity of data, promptly discovers and prevents attackers from tampering with data, and enhances the security of communication.
Smart Images

Figure CN119299093A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security and quantum encryption technology, and in particular to a system, method, device and medium for preventing ciphertext forgery during quantum secure symmetric encryption. Background Art
[0002] In recent years, the rapid development of information technology has promoted the widespread popularization of global network communications, and the resulting security issues have become increasingly prominent, especially in the field of quantum secure communications. In order to provide more flexible and diverse quantum secure communications, existing quantum secure communication methods include direct symmetric key encryption communication methods, also known as quantum secure symmetric encryption communication methods. The core of this communication method is that the two communicating parties share a symmetric quantum secure key in advance, and use the key to perform quantum secure level encryption and decryption operations on data, thereby ensuring the confidentiality of information during transmission.
[0003] However, despite the many advantages of direct symmetric key encryption communication, such as high encryption strength and relatively simple implementation, it still faces some severe challenges in practical applications. In particular, its security is seriously threatened by network attacks, such as forged message attacks. Forged message attacks are attempts by attackers to construct and send seemingly legitimate data packets to undermine the integrity of the system and the authenticity of the data.
[0004] To address these challenges, the traditional approach to preventing ciphertext forgery is: the sender calculates the hash value of the plaintext data to be transmitted, and attaches the hash value to the data packet and sends it to the receiver. After receiving the data packet, the receiver recalculates the hash value of the plaintext data and compares the recalculated hash value with the hash value attached to the data packet to verify the integrity and authenticity of the plaintext data. However, with the rapid development of quantum computing technology, the powerful computing power of quantum computers can launch quantum attacks on some traditional hash algorithms. Once the traditional hash algorithm is cracked, the attacker can forge a legitimate hash value, thereby bypassing this anti-ciphertext forgery mechanism and attacking the device.
[0005] Therefore, there is an urgent need for a secure communication solution that can resist ciphertext forgery attacks in direct symmetric key encryption communication. Summary of the invention
[0006] The present application provides a system, method, device and medium for preventing ciphertext forgery during quantum secure symmetric encryption, so as to solve the problem that the existing traditional methods for preventing ciphertext forgery cannot resist quantum attacks and have poor security.
[0007] In a first aspect, the present application provides a system for preventing ciphertext from being forged during quantum secure symmetric encryption, the system comprising: a sender and a receiver; wherein the sender and the receiver pre-agree on a target hash algorithm and an anti-counterfeiting true random number, and the sender and the receiver both store a symmetric key for direct symmetric communication;
[0008] The sender is used to obtain the target data Data, and obtain the encryption key from the symmetric key; determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through the target hash algorithm; perform quantum encryption on the Data and h based on the encryption key to obtain ciphertext data; send the ciphertext data assembled with the encryption header to the receiver; wherein the encryption header carries the key information of the encryption key;
[0009] The receiver is used to receive the ciphertext data sent by the sender; obtain the decryption key based on the key information carried in the ciphertext data; decrypt the ciphertext data based on the decryption key to obtain the Data and h carried in the ciphertext data; determine the anti-counterfeiting hash value through the target hash algorithm, combined with the anti-counterfeiting true random number and the Data; if the Data is consistent with the h, the Data is determined to be legal; if the Data is inconsistent with the h, the ciphertext data is determined to be forged ciphertext.
[0010] In a second aspect, the present application provides a method for preventing ciphertext from being forged during quantum secure symmetric encryption, the method being applied to a sender, and the method comprising:
[0011] Obtain target data Data, and obtain an encryption key from a symmetric key pre-negotiated with a recipient;
[0012] Determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through a target hash algorithm; wherein the sender and the receiver pre-agree on the target hash algorithm and the anti-counterfeiting true random number;
[0013] Encrypt the Data and h based on the encryption key to obtain ciphertext data;
[0014] The ciphertext data assembled with the encryption header is sent to the receiving party; wherein the encryption header carries the key information of the encryption key.
[0015] In a third aspect, the present application further provides a method for preventing ciphertext from being forged during quantum secure symmetric encryption, the method being applied to a receiving party, the method comprising:
[0016] Receive the ciphertext data sent by the sender;
[0017] Based on the key information carried in the ciphertext data, obtaining a decryption key from a symmetric key pre-negotiated with the sender;
[0018] Decrypt the ciphertext data based on the decryption key to obtain the target data Data and the anti-counterfeiting hash value h carried in the ciphertext data;
[0019] Determine the anti-counterfeiting hash value by combining the anti-counterfeiting true random number and the Data through the target hash algorithm; wherein the sender and the receiver pre-agree on the target hash algorithm and the anti-counterfeiting true random number;
[0020] If the data is consistent with h, then the data is determined to be legal;
[0021] If the h is inconsistent with the h, it is determined that the ciphertext data is a forged ciphertext.
[0022] In a fourth aspect, the present application also provides a quantum security device, including: a processor and a memory;
[0023] The processor is used to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the sender as described above, or to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the receiver as described above, by calling the program or instruction stored in the memory.
[0024] In a fifth aspect, the present application also provides a computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the sender as described above, or to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the receiver as described above.
[0025] In a sixth aspect, the present application also provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the sender as described above, or to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the receiver as described above.
[0026] The beneficial effects of this application are as follows:
[0027] 1. Since the two parties of quantum secure symmetric encryption communication have agreed in advance on the target hash algorithm and the anti-counterfeiting true random number, the anti-counterfeiting hash value of the target data Data can be generated through the target hash algorithm and the anti-counterfeiting true random number. The anti-counterfeiting hash value not only contains the characteristic information of the target data Data, but also incorporates the randomness of the anti-counterfeiting true random number, making it difficult for counterfeiters to generate valid hash values only through simple algorithm attacks. Even if counterfeiters can partially crack or forge the hash algorithm, they still cannot generate forged hash values that can deceive the recipient because they cannot accurately predict or copy the anti-counterfeiting true random number.
[0028] 2. While encrypting the target data Data, the sender will also generate an anti-counterfeiting hash value h based on the target hash algorithm and the anti-counterfeiting true random number, and encrypt h together with the Data. After decrypting the received ciphertext data, the receiver will recalculate the anti-counterfeiting hash value based on the decrypted Data and compare it with h. This mechanism can promptly detect and prevent attackers from tampering with data. Because any tampering with the Data will lead to inconsistency in the anti-counterfeiting hash value, the receiver can quickly identify forged or tampered ciphertext data during the comparison process, thereby ensuring the integrity and authenticity of the Data.
[0029] 3. In the process of quantum secure symmetric encryption communication, the target hash algorithm and the anti-counterfeiting true random number do not need to be transmitted between the communicating parties. This feature greatly increases the difficulty for counterfeiters to steal this key information, thereby increasing the difficulty of ciphertext forgery. Since counterfeiters cannot obtain this key information, they cannot accurately predict or copy the anti-counterfeiting true random number and target hash algorithm, and thus cannot generate valid forged ciphertext. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0031] Figure 1 A schematic diagram of the structure of a system for preventing ciphertext from being forged during quantum secure symmetric encryption provided in an embodiment of the present application;
[0032] Figure 2 A schematic diagram of a specific process for preventing ciphertext from being forged during quantum secure symmetric encryption provided in an embodiment of the present application;
[0033] Figure 3 A schematic diagram of a process for preventing ciphertext from being forged during quantum secure symmetric encryption provided by this application;
[0034] Figure 4 A schematic diagram of a process for preventing ciphertext from being forged during quantum secure symmetric encryption provided by this application;
[0035] Figure 5 A schematic diagram of the structure of a quantum security device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0037] In order to ensure the confidentiality of quantum secure symmetric encryption communications while effectively responding to ciphertext forgery attacks, the present application provides a system, method, device and medium for preventing ciphertext forgery during quantum secure symmetric encryption.
[0038] Embodiment 1:
[0039] Figure 1 A schematic diagram of the structure of a system for preventing forgery of ciphertext during quantum secure symmetric encryption provided in an embodiment of the present application, the system comprising: a sender 11 and a receiver 12; wherein the sender 11 and the receiver 12 pre-agree on a target hash algorithm and an anti-counterfeiting true random number, and the sender 11 and the receiver 12 both store a symmetric key for direct symmetric communication;
[0040] The sender 11 is used to obtain the target data Data, and obtain the encryption key from the symmetric key; determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through the target hash algorithm; perform quantum encryption on the Data and h based on the encryption key to obtain ciphertext data; send the ciphertext data assembled with the encryption header to the receiver 12; wherein the encryption header carries the key information of the encryption key;
[0041] The receiver 12 is used to receive the ciphertext data sent by the sender 11; obtain a decryption key based on the key information carried in the ciphertext data; decrypt the ciphertext data based on the decryption key to obtain the Data and h carried in the ciphertext data; determine the anti-counterfeiting hash value h by combining the target hash algorithm with the anti-counterfeiting true random number and the Data ′ ; If the h ′ is consistent with h, then the Data is determined to be legal; if h ′ If it is inconsistent with the h, it is determined that the ciphertext data is forged ciphertext.
[0042] In the field of quantum secure symmetric encryption communication, it is crucial to ensure the security of communication and the integrity of data. In order to achieve this goal, the two communicating parties (including the sender 11 and the receiver 12) need to carry out a series of preparations and negotiations before officially conducting encrypted communication. Among them, negotiating and sharing a symmetric key for subsequent encrypted communication is a basic and critical step. This symmetric key can ensure that only the two parties holding the same key can understand and decrypt the transmitted information, thereby ensuring the confidentiality of quantum secure symmetric encryption communication.
[0043] It should be noted that the sender 11 and the receiver 12 in the following embodiments specifically refer to the communicating parties who have the need for quantum secure symmetric encryption communication.
[0044] However, relying solely on symmetric keys is not enough to completely resist all possible attack methods. Especially with the growing development of quantum computing technology today, forged ciphertext attacks have become a potential threat. This attack method may attempt to deceive the recipient 12 by forging or tampering with the ciphertext, thereby affecting the security of quantum secure symmetric encryption communication and the authenticity of the transmitted data. Based on this, in this application, the sender 11 and the receiver 12 will also agree on the target hash algorithm and the anti-counterfeiting true random number before the formal quantum secure symmetric encryption communication, so that with the help of the target hash algorithm and the anti-counterfeiting true random number, the anti-counterfeiting mark of the plaintext data to be transmitted (recorded as the target data, which can be represented by Data) can be generated-the anti-counterfeiting hash value, which not only contains the characteristic information of the target data, but also incorporates the randomness of the anti-counterfeiting true random number, making it difficult for the counterfeiter to generate a valid hash value only by a simple algorithm attack. Even if the counterfeiter can partially crack or forge the hash algorithm, since they cannot accurately predict or copy the anti-counterfeiting true random number, they still cannot generate a forged hash value that can deceive the recipient 12.
[0045] It should be noted that the negotiation process of the symmetric key belongs to the prior art and will not be described in detail here.
[0046] As for the method of agreeing on the target hash algorithm and the anti-counterfeiting true random number, the agreed method is flexible and can be selected according to the specific needs and scenarios of the communicating parties, and is not specifically limited here. Exemplarily, the staff can adopt the method of manually injecting the target hash algorithm and the anti-counterfeiting true random number into the communicating parties to achieve the agreed target hash algorithm and the anti-counterfeiting true random number by the communicating parties. In another exemplary embodiment, the communicating parties can agree on the target hash algorithm and the anti-counterfeiting true random number at the same time when negotiating the symmetric key. For example, the party initiating the symmetric key negotiation carries the target hash algorithm and the anti-counterfeiting true random number in any request sent.
[0047] Based on the above embodiment, after the communicating parties have determined the symmetric key, target hash algorithm and anti-counterfeiting true random number, they can carry out formal quantum secure symmetric encryption communication.
[0048] In order to facilitate the role of the target hash algorithm and anti-counterfeiting true random number in preventing ciphertext forgery attacks in quantum secure symmetric encryption, the following is an explanation through the specific quantum secure symmetric encryption communication process:
[0049] When the sender 11 has data to be sent to the receiver 12, the sender 11 can obtain the data. And obtain the encryption key from the symmetric key pre-negotiated with the receiver 12. For example, the encryption key is determined from the saved symmetric key according to the data length of the data and the pre-configured encryption ratio. The encryption ratio is used to indicate the ratio between the length of the quantum key per bit and the length of the data that can be encrypted by the quantum key per bit.
[0050] Next, the sender 11 determines the anti-counterfeiting hash value h based on the Data and the stored anti-counterfeiting true random number through a pre-agreed target hash algorithm.
[0051] In one example, after obtaining the encryption key, the sender 11 can determine the encryption header according to the key information of the encryption key. The key information is used to instruct the receiver 12 to obtain the decryption key from the symmetric key, and the key information may include but is not limited to: encryption ratio, key offset value of the decryption key in the symmetric key. Then, the anti-counterfeiting hash value h is determined based on the encryption header, Data and the saved anti-counterfeiting true random number through the pre-agreed target hash algorithm. By determining the anti-counterfeiting hash value h for the encryption header and Data, it is possible to effectively deal with the situation where the decryption end uses the wrong decryption key to decrypt the data, which is conducive to ensuring the stability of quantum secure symmetric encryption communication and the accuracy of data transmission.
[0052] Based on the above embodiment, the sender 11 may obtain the anti-counterfeiting hash value h in the following two ways:
[0053] Method 1: Use anti-counterfeiting true random numbers as confusion factors.
[0054] The sender 11 can use the saved anti-counterfeiting true random number as a confusion factor. Then, the Data is obfuscated by the confusion factor. The obfuscation process can be a simple data concatenation, XOR operation, or a more complex encryption algorithm. For example, the sender 11 can use the anti-counterfeiting true random number as a prefix, suffix, or insert it into a specific position of Data to form the obfuscated data Data_mixed. The sender 11 performs a hash calculation on the obfuscated data through a target hash algorithm. The target hash algorithm can be a traditional hash algorithm such as MD5, CRC, sha, etc. For example, the sender 11 performs a hash calculation on the obfuscated data and the encryption header through the target hash algorithm to determine h. For another example, the sender 11 only performs a hash calculation on the obfuscated data through the target hash algorithm to determine h.
[0055] It should be noted that the anti-counterfeiting true random number can be one or more, and the specific number can be flexibly set according to demand. If a higher anti-counterfeiting strength is desired, the number of the anti-counterfeiting true random numbers can be more. If the resources required for calculation are desired to be reduced, the number of the anti-counterfeiting true random numbers can be less. No specific limitation is made here.
[0056] Assuming that two anti-counterfeiting true random numbers are used, represented by t and s respectively, the anti-counterfeiting hash value is expressed by the following formula:
[0057] h=hash(Data||t||s)
[0058] Among them, Data can be the target data assembled with the encryption header or the target data not assembled with the encryption header, hash() represents the target hash algorithm, h represents the anti-counterfeiting hash value, and t and s are anti-counterfeiting true random numbers.
[0059] Due to the addition of the anti-counterfeiting true random number, even if a counterfeiter attempts to perform hash calculation on the forged data, it is difficult to obtain a hash value that matches the real anti-counterfeiting hash value h without knowing the anti-counterfeiting true random number.
[0060] Method 2: Use anti-counterfeiting true random numbers for quantum secure hash calculations.
[0061] The pre-agreed anti-counterfeiting true random number may include a first anti-counterfeiting true random number and a second anti-counterfeiting true random number. Among them, the first anti-counterfeiting true random number and the second anti-counterfeiting true random number are different. When determining the anti-counterfeiting hash value h, the irreducible polynomial p can be determined based on the first anti-counterfeiting true random number. For example, based on the first anti-counterfeiting true random number t, an irreducible polynomial p of order n based on the GF(2) field is generated. Then, according to the second anti-counterfeiting true random number and the irreducible polynomial p, a Toplitz matrix is constructed. The Data is hashed by the Toplitz matrix to determine the anti-counterfeiting hash value h. For example, the sender 11 performs a hash calculation on the Data and the encryption header by using the Toplitz matrix to determine h. For another example, the sender 11 only performs a hash calculation on the Data by using the Toplitz matrix to determine h.
[0062] For example, the irreducible polynomial p and the second anti-counterfeiting true random number s are used as parameters to generate a Toplitz matrix, including:
[0063] 1) The number of rows and columns of the Toplitz matrix is related to the degree of the irreducible polynomial p: Assume that the highest degree of p is n;
[0064] 2) The elements of the first row are equal to the elements of the second anti-counterfeiting true random number s;
[0065] 3) Starting from the second row, the elements of each row are equal to the elements of the previous row shifted right by one position and multiplied by the coefficient of the irreducible polynomial p;
[0066] 4) For the second anti-counterfeiting true random number s=[s0, s1, ..., s n-1 ] and the irreducible polynomial p = a0*x^0+a1*x^1+…+a n-1 *x^(n-1), the i-th row of the Toplitz matrix T will be [s i ,s i-1 *a0,s i-2 *a1,…,s i-n+1 *a n-2 ,s i-n *a n-1 ].
[0067] 5) According to the dimension of the Toplitz matrix, the size of the data block is determined, and then Data is divided into several data blocks according to the size of the data block, such as: Data = [m0, m1, ...], where m represents the data block obtained by the division;
[0068] 6) Treat each data block as a column vector; for each data block, multiply it with the Toplitz matrix T and obtain the hash value of the first row of the multiplication result;
[0069] 7) Repeat the previous step 6), perform multiplication operation on each data block, and combine the first row of each result together to form the final hash value h(Data) = [h0, h1, ...].
[0070] After the sender 11 obtains the anti-counterfeiting hash value h based on the above embodiment, the Data and h can be quantum encrypted based on the encryption key to obtain the ciphertext data. Exemplarily, the sender 11 encrypts the Data and h using the encryption key according to the encryption ratio and the pre-configured quantum encryption algorithm to obtain the ciphertext data.
[0071] For example, the sender 11 performs quantum encryption on the Data and h to obtain the ciphertext data which can be expressed by the following formula:
[0072] De=Encipher(Data')
[0073] Data'=Data||h
[0074] Among them, De represents ciphertext data, and Encipher() represents quantum encryption operation.
[0075] After the sender 11 obtains the ciphertext data based on the above embodiment, it can assemble an encryption header in the ciphertext data so that the receiver 12 can decrypt based on the data carried in the encryption header. Then, the ciphertext data assembled with the encryption header is sent to the receiver 12.
[0076] For the receiver 12, after receiving the ciphertext data sent by the sender 11, the receiver 12 can parse the ciphertext data to obtain the key information carried in the encryption header of the ciphertext data. Then, based on the key information, the decryption key is obtained from the symmetric key pre-negotiated with the sender 11. For example, the decryption key is obtained from the symmetric key based on the encryption ratio and the key offset value in the key information.
[0077] In a possible implementation, the receiver 12 may perform a format check on the encryption header of the received ciphertext data, so as to identify forged ciphertext whose format does not meet the requirements before decrypting the ciphertext data. For example, the encryption ratio carried by the encryption header is a preset encryption ratio, the data length carried by the encryption header meets the preset data length range, the key offset value carried by the encryption header meets the preset key offset value range, etc. The receiver 12 performs subsequent steps only when it determines that the format of the encryption header of the ciphertext data passes the format check. If the receiver 12 determines that the format of the encryption header of the ciphertext data does not pass the format check, it means that the ciphertext data is forged, and then refuses to respond to the ciphertext data.
[0078] For example, when the device structure of the receiver 12 includes an encryption area, an isolation area, and a communication area, and the encryption area is connected to the isolation area, and the isolation area is connected to the communication area, the communication area of the receiver 12 can pass the ciphertext data to the isolation area of the receiver 12 after receiving the ciphertext data. The isolation area can perform a format check on the encryption header of the ciphertext data. If it is determined that the encryption header passes the format check, the isolation area will pass the ciphertext data to the encryption area for subsequent processing; if it is determined that the encryption header does not pass the format check, the isolation area can directly discard the forged ciphertext data, so that the forged ciphertext data will not enter the encryption area of the receiver 12, which is conducive to ensuring the security of the encryption area.
[0079] In some possible implementations, the ciphertext data obtained by the receiver 12 may also carry a checksum of the encryption header (for the sake of distinction, the checksum determined by the sender 11 in the following embodiments may be represented by k). By checking k, the receiver 12 can quickly identify potential encryption header forgery problems without decrypting the ciphertext data.
[0080] Exemplarily, in the process of constructing the encryption header of the ciphertext data, the sender 11 can obtain the quantum key of the preset bit from the encryption key. The preset bit should be less than the length of the encryption key, for example, 128 bits, 256 bits, etc. The preset bit can be flexibly set according to actual needs. If you want to improve the security strength, you can set the preset bit larger. If you want to reduce the amount of calculation, you can set the preset bit smaller. Then, according to the quantum key and the encryption header of the ciphertext data, the checksum k of the encryption header of the ciphertext data is determined. For example, k is determined by performing a hash calculation on the quantum key and the encryption header. Then, the sender 11 sends the ciphertext data assembled with the encryption header to the receiver 12; wherein, the ciphertext data carries k.
[0081] After receiving the ciphertext data, the receiver 12 can extract k from the ciphertext data. The receiver 12 obtains the decryption key according to the encryption header of the ciphertext data. Then, the quantum key of the preset bit position is obtained from the decryption key. The checksum is determined according to the quantum key and the encryption header (for the convenience of distinction, the checksum determined by the receiver 12 can be used as k ′ express).
[0082] Under normal circumstances, due to the legitimacy of the encryption header and the consistency of the quantum key of the pre-set bits extracted by both communicating parties, the checksum k' calculated by the receiving party 12 based on the same method should completely match the checksum k carried in the ciphertext data. ′ After that, the receiver 12 can determine k ′Is it consistent with the k carried in the ciphertext data? ′ If it is consistent with k, it means that the encryption header is not forged, and then the subsequent steps of decrypting the ciphertext data based on the decryption key are performed to obtain the Data and h carried in the ciphertext data. ′ If it is inconsistent with k, it means that the encryption header may be forged, and the ciphertext data will be rejected.
[0083] The receiver 12 decrypts the ciphertext data according to the decryption key to obtain Data and h carried in the ciphertext data. For example, the receiver 12 decrypts the ciphertext data according to the quantum encryption algorithm agreed upon in advance with the sender 11 based on the decryption key to obtain Data and h carried in the ciphertext data.
[0084] Similarly, under normal circumstances, if the ciphertext data is a legitimate ciphertext data, due to the consistency of the data extracted by the communicating parties, the anti-counterfeiting hash value calculated by the receiver 12 based on the same method (for the convenience of distinction, the anti-counterfeiting hash value determined by the receiver 12 can be used as h ′ The target hash algorithm can be used to determine h by combining the anti-counterfeiting true random number and Data. ′ For example, if the two parties in communication pre-agreed to use the anti-counterfeiting true random number as the confusion factor to obtain the anti-counterfeiting hash value, the receiver 12 can use the saved anti-counterfeiting true random number as the confusion factor. Then, the Data is obfuscated by the confusion factor. Then, the obfuscated data is hashed by the target hash algorithm to obtain h ′ . In another exemplary embodiment, if the communicating parties agree in advance to obtain the anti-counterfeiting hash value by performing quantum secure hash calculation on the anti-counterfeiting true random number, the receiver 12 can determine the irreducible polynomial p based on the first anti-counterfeiting true random number. For example, based on the first anti-counterfeiting true random number t, an irreducible polynomial p of order n based on the GF(2) field is generated. Then, a Toplitz matrix is constructed based on the second anti-counterfeiting true random number and the irreducible polynomial p. The Toplitz matrix is used to perform hash calculation on Data to determine h ′ .
[0085] If the sender 11 also uses the encryption header when determining h, the receiver 12 ′ When the sender 11 determines h, the encryption header also needs to be added; if the sender 11 does not use the encryption header when determining h, the receiver 12 ′ When h is determined directly based on the decrypted Data ′ .
[0086] The receiver 12 obtains h based on the above embodiment. ′ After that, you can use the h ′ Compare it with the decrypted h. If h ′ If it is consistent with h, it means that the ciphertext data is legal and the decrypted Data is complete, then the Data is confirmed to be legal; if h ′ If it is inconsistent with h, it means that the ciphertext data may be forged, or the decrypted Data is incomplete, then the ciphertext data will be rejected.
[0087] The beneficial effects of this application are as follows:
[0088] 1. Since the two parties of quantum secure symmetric encryption communication have agreed in advance on the target hash algorithm and the anti-counterfeiting true random number, the anti-counterfeiting hash value of the target data Data can be generated through the target hash algorithm and the anti-counterfeiting true random number. The anti-counterfeiting hash value not only contains the characteristic information of the target data Data, but also incorporates the randomness of the anti-counterfeiting true random number, making it difficult for counterfeiters to generate valid hash values only through simple algorithm attacks. Even if counterfeiters can partially crack or forge the hash algorithm, they still cannot generate a forged hash value that can deceive the recipient 12 because they cannot accurately predict or copy the anti-counterfeiting true random number.
[0089] 2. While encrypting the target data Data, the sender 11 will also generate an anti-counterfeiting hash value h based on the target hash algorithm and the anti-counterfeiting true random number, and encrypt h together with the Data. After decrypting the received ciphertext data, the receiver 12 will recalculate the anti-counterfeiting hash value based on the decrypted Data and compare it with h. This mechanism can promptly detect and prevent attackers from tampering with data. Because any tampering with the Data will lead to inconsistency in the anti-counterfeiting hash value, the receiver 12 can quickly identify forged or tampered ciphertext data during the comparison process, thereby ensuring the integrity and authenticity of the Data.
[0090] 3. In the process of quantum secure symmetric encryption communication, the target hash algorithm and the anti-counterfeiting true random number do not need to be transmitted between the communicating parties. This feature greatly increases the difficulty for counterfeiters to steal this key information, thereby increasing the difficulty of ciphertext forgery. Since counterfeiters cannot obtain this key information, they cannot accurately predict or copy the anti-counterfeiting true random number and target hash algorithm, and thus cannot generate valid forged ciphertext.
[0091] Embodiment 2:
[0092] In order to prevent ciphertext replay attacks, based on the above embodiments, in the present application, the receiver 12 may perform a preliminary legitimacy check on the ciphertext data based on the key information carried by the received ciphertext data before obtaining the decryption key, so as to prevent replay attacks by malicious third-party devices.
[0093] Exemplarily, the symmetric keys stored by both communicating parties are stored in order, and all quantum keys in the symmetric key are respectively corresponding to offset values, so that both communicating parties can quickly obtain the quantum key from the stored symmetric key according to the offset value of any quantum key. At the same time, in order to ensure that the "one-time one-key" encryption method can be strictly followed between the communicating parties, the communicating parties can also record the use of the quantum key in the symmetric key, so as to avoid the receiver 12 using the used quantum key to decrypt the legitimate ciphertext data repeatedly sent by the malicious third-party device, and pass the replayed message to the service, causing service distortion and failure. For example, the communicating parties can record the offset value (recorded as the starting offset value) corresponding to the starting quantum key in the quantum key fragment for each unused quantum key fragment in the symmetric key, and record the key capacity corresponding to the starting offset value according to the total length of the quantum key contained in the quantum key fragment. According to the storage order of each quantum key fragment, the starting offset value and key capacity corresponding to each quantum key fragment are stored in order. Subsequently, through each starting offset value and the key capacity corresponding to each starting offset value, it is possible to quickly determine whether the decryption key currently used to decrypt the ciphertext data is unused, and whether the length of the quantum key used to encrypt the current ciphertext data is standardized.
[0094] After the receiver 12 obtains the key information carried by the ciphertext data based on the above embodiment, it can determine the key offset value ranges corresponding to each starting offset value according to the saved starting offset values and the key capacities corresponding to each starting offset value. Then determine whether the key offset value in the key information matches any determined key offset value range. Among them, the match here means that the key offset value belongs to a certain key offset value range. For example, the receiver 12 can determine the key offset value ranges corresponding to all the starting offset values, and then determine whether the key offset value matches any determined key offset value range. It can also determine the key offset value range corresponding to a starting offset value in the order of each starting offset value, and then determine whether the key offset value matches the key offset value range.
[0095] Exemplarily, the receiver 12 determines whether the key offset value matches any stored key offset value range in the following cases:
[0096] Case 1: determine that the key offset value matches a key offset value range corresponding to a certain starting offset value, and the matching key offset value range is sorted in the last key offset value range.
[0097] It should be noted that the sorting order of each key offset value range is determined according to the sorting order of each starting offset value, that is, it is determined according to the storage order of the unused quantum key fragments corresponding to each starting offset value. The key offset value range corresponding to the quantum key fragment with an earlier storage order is ranked higher, and the key offset value range corresponding to the quantum key fragment with a later storage order is ranked lower.
[0098] For the last key offset value range, although the quantum keys within the key offset value range may be exhausted, in actual use, it is possible to continue to supplement quantum keys after the key offset value range, or to span quantum keys in another key file, etc., to deal with the situation where the keys are exhausted or more keys are needed, so that the decryption process will not be hindered. Therefore, in this application, there is no limit on the length of ciphertext data that can be decrypted by the quantum key with an offset value within the last key offset value range.
[0099] When it is determined that the key offset value matches a certain key offset value range, and the matching key offset value range is sorted in the last key offset value range, it means that the current ciphertext data is encrypted using a quantum key that has not been used yet. Therefore, the receiver 12 can determine the legitimacy of the ciphertext data and prepare to use the corresponding quantum key for decryption.
[0100] Case 2: It is determined that the key offset value matches a certain key offset value range, and the matching key offset value range is not sorted in the last key offset value range.
[0101] During direct symmetric encryption communication between the sender 11 and the receiver 12, the sender 11 must use the symmetric key in strict order. If the network transmission is normal, the receiver 12 will generally receive the ciphertext data in sequence and use the quantum key in the symmetric key to decrypt the received ciphertext data in sequence, so that the starting offset value saved by the receiver 12 under normal circumstances should be one.
[0102] However, during the network transmission process, there may be problems such as failures, congestion, and delays, which may cause the ciphertext data received by the receiver 12 to be out of order. For example, the receiver 12 may first receive the ciphertext data sent by the sender 11 later, and then receive the ciphertext data sent by the sender 11 first. As a result, when the receiver 12 decrypts the currently received ciphertext data, it will first decrypt the current ciphertext data based on the quantum key fragment with a later storage order, and the quantum key with a storage order before the quantum key fragment will be "skipped". Although these "skipped" quantum key fragments are not used temporarily, the receiver 12 may reselect these quantum key fragments to decrypt the received ciphertext data at some point in the future. Based on this, the receiver 12 needs to record and track all the quantum key fragments that were previously "skipped", that is, the receiver 12 will record the starting offset values and corresponding key capacities of these "skipped" quantum key fragments, which results in the receiver 12 saving multiple starting offset values and the key capacities corresponding to the multiple starting offset values. Because the sender 11 encrypts the data to be sent strictly in accordance with the pre-configured encryption ratio and the key length of this part of the "skipped" quantum key fragment when using this part of the "skipped" quantum key fragment, when the receiver 12 selects the quantum key in the "skipped" quantum key fragment to decrypt the ciphertext data, the length of the decryption key required for the ciphertext data must be less than the length of the "skipped" quantum key fragment.
[0103] On this basis, if the receiver 12 determines that the key offset value matches a certain key offset value range, and the matching key offset value range is not sorted in the last key offset value range, it means that the quantum key fragment currently used to encrypt the ciphertext data is likely to be the quantum key fragment that was "skipped" before, and it can be further determined whether the quantum key used to encrypt the ciphertext data is standardized.
[0104] Specifically, the receiver 12 can determine the key length required to decrypt the ciphertext data (recorded as the target key length) according to the encryption ratio and the ciphertext length of the ciphertext data. Obtain the starting offset value corresponding to the matching key offset value range (recorded as the target starting offset value) and the key capacity corresponding to the matching key offset value range (recorded as the target key capacity). Determine the offset difference between the key offset value and the target starting offset value. The difference between the target key capacity and the offset difference is determined as the available key length. Among them, the available key length represents the maximum length of the quantum key that can be used starting from the key offset value within the matching key offset value range. Then, the target key length is compared with the available key length. If it is determined that the target key length is not greater than the available key length, it means that the quantum key used to encrypt the ciphertext data meets the specification, and it can be determined that the ciphertext data can be decrypted. If it is determined that the target key length is greater than the available key length, it means that the quantum key used to encrypt the ciphertext data does not meet the specification, then it can be determined that the ciphertext data is illegal and refuse to respond to the ciphertext data.
[0105] Case three: determine that the key offset value does not match any key offset value range.
[0106] If the current ciphertext data is replayed and sent by a malicious third-party device by capturing legitimate ciphertext data, the key offset value carried in the ciphertext data must be the offset value corresponding to the quantum key that has been used, that is, the key offset value must not match the determined key offset value ranges. Based on this, if the receiver 12 determines that the key offset value does not match each key offset value range, it means that the quantum key used to encrypt the ciphertext data may have been used, then the ciphertext data is determined to be illegal and the ciphertext data is refused to be responded to.
[0107] After the receiver 12 determines that the ciphertext data can be decrypted based on the above embodiment, it can determine the decryption key from the stored symmetric key based on the key offset value and the target key length.
[0108] In one example, when the receiver 12 determines that the decrypted data is legal based on the above embodiment, the receiver 12 can update the usage status of the current symmetric key according to the key offset value and the target key length. This update process involves adjusting the starting offset value and the key capacity corresponding to the starting offset value, aiming to improve the efficiency and security of key use. Exemplarily, the target starting offset value and the target key capacity can be updated according to the key offset value and the target key length, so as to remove the quantum key fragment corresponding to the key offset value and the target key length from the unused quantum key fragments.
[0109] In a possible implementation, when the target starting offset value and the target key capacity are updated according to the key offset value and the target key length, the following two situations may be included:
[0110] Case 1: The key offset value is equal to the target start offset value.
[0111] In this case, the required quantum key fragment is intercepted from the target starting offset value, and the intercepted length is the target key length. On this basis, when the target starting offset value is updated, the target key length can be added to the original target starting offset value to obtain a new starting offset value. At the same time, when the target key capacity is updated, since the receiver 12 has used a part of the quantum key fragment (i.e., the part corresponding to the key offset value and the target key length), it is necessary to subtract this part of the used capacity from the original target key capacity.
[0112] Case 2: The key offset value is greater than the target start offset value.
[0113] In this case, the required quantum key fragment is intercepted from the specific position corresponding to the key offset value within the matching key offset value range, and the intercepted length is still equal to the target key length. Different from the first case, since the key offset value is not the starting offset value of the key offset value range, after using the quantum key fragment corresponding to the key offset value and the target key length, the key fragment originally located before the key offset value (i.e., the part between the target starting offset value and the key offset value) is "skipped", resulting in a discontinuous area in the matching key offset value range, that is, within the matching key offset value range, a "gap" is formed between the unused quantum key fragment after the quantum key fragment corresponding to the key offset value and the target key length and the "skipped" quantum key fragment. Therefore, in order to more effectively manage the "skipped" key fragment and the remaining key resources, the receiver 12 can divide the matching key offset value range into two new key offset value ranges by the key offset value. The two new ranges are the first key offset value range and the second key offset value range. The first key offset value range starts from the minimum offset value of the matched key offset value range and extends to the key offset value (but does not include the key offset value itself). The key fragment within the first key offset value range is the key fragment that is "skipped" as mentioned above. The second key offset value range starts from the sum of the key offset value and the target key length and extends to the maximum offset value of the matched key offset value range. At the same time, the receiver 12 also needs to determine the key capacity corresponding to the first key offset value range and the second key offset value range respectively. Specifically, the receiver 12 can determine the key offset value as the new starting offset value. Then determine the offset sum value of the key offset value and the target key length. According to the difference between the target key capacity and the offset sum value, determine the key capacity corresponding to the new starting offset value. Subsequently, according to the new starting offset value and the key capacity corresponding to the new starting offset value, the second key offset value range can be accurately determined. Then, according to the difference between the key offset value and the target starting offset value, the receiver 12 can update the target key capacity corresponding to the target starting offset value. Subsequently, according to the target starting offset value and the updated target key capacity, the first key offset value range can be accurately determined.
[0114] Embodiment 3:
[0115] The following is a description of a method for preventing ciphertext forgery during quantum secure symmetric encryption provided by the present application through a specific embodiment. Figure 2 A schematic diagram of a specific process for preventing ciphertext from being forged during quantum secure symmetric encryption provided in an embodiment of the present application, the process comprising:
[0116] S201: The sender obtains Data, and obtains an encryption key from a stored symmetric key.
[0117] The sender and the receiver pre-agree on a target hash algorithm, a first anti-counterfeiting true random number, a second anti-counterfeiting true random number, and a symmetric key for direct symmetric communication.
[0118] S202: The sender determines an irreducible polynomial p based on the first anti-counterfeiting true random number, and determines a Toplitz matrix according to the irreducible polynomial p and the second anti-counterfeiting true random number.
[0119] S203: The sender performs hash calculation on Data through the Toplitz matrix to determine the anti-counterfeiting hash value h.
[0120] S204: The sender performs quantum encryption on Data and h based on the encryption key to obtain ciphertext data.
[0121] S205: The sender obtains the quantum key of the previously preset bits from the encryption key, and determines the checksum k of the encryption header of the ciphertext data according to the encryption header and the quantum key.
[0122] S206: The sender sends the ciphertext data assembled with the encryption header to the receiver; wherein the ciphertext data carries k.
[0123] S207: The receiver receives the ciphertext data sent by the sender.
[0124] S208: The receiver obtains the decryption key based on the key information carried in the ciphertext data.
[0125] S209: The receiver obtains the quantum key of the preset bit from the decryption key, and determines the checksum k according to the quantum key and the encryption header of the ciphertext data. ′ .
[0126] S210: The receiver determines k ′ Check whether it is consistent with k carried in the ciphertext data. If it is consistent, execute S211; if it is inconsistent, execute S216.
[0127] S211: The receiver decrypts the ciphertext data based on the decryption key to obtain Data and h carried in the ciphertext data.
[0128] S212: The receiver determines an irreducible polynomial p based on the first anti-counterfeiting true random number, and determines a Toplitz matrix according to the irreducible polynomial p and the second anti-counterfeiting true random number.
[0129] S213: The receiver performs hash calculation on the decrypted Data using the Toplitz matrix to determine the anti-counterfeiting hash value h ′ .
[0130] S214: The receiver determines h ′ Is it consistent with the decrypted h? If it is consistent, execute S215; if it is inconsistent, execute S216.
[0131] S215: The receiver determines that the decrypted Data is legal.
[0132] S216: The receiving party determines that the ciphertext data is forged ciphertext.
[0133] Embodiment 4:
[0134] Based on the same inventive concept, the present application also provides a method for preventing ciphertext from being forged during quantum secure symmetric encryption, which is applied to the sender. Figure 3 A schematic diagram of a process for preventing ciphertext from being forged during quantum secure symmetric encryption provided by this application, the process comprising:
[0135] S301: Obtain target data Data, and obtain an encryption key from the symmetric key pre-negotiated with the recipient.
[0136] S302: Determine an anti-counterfeiting hash value h based on an anti-counterfeiting true random number and the Data through a target hash algorithm; wherein the sender and the receiver agree in advance on a target hash algorithm and an anti-counterfeiting true random number.
[0137] S303: Encrypt the Data and h based on the encryption key to obtain ciphertext data.
[0138] S304: Send the ciphertext data assembled with the encryption header to the recipient; wherein the encryption header carries key information of the encryption key.
[0139] In the present application, the method for preventing ciphertext forgery during quantum secure symmetric encryption is applied to the sender, which can be a quantum secure device, such as a quantum secure terminal, a quantum secure privacy computer, a quantum secure base station, etc.
[0140] In some possible implementations, determining the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data by using a target hash algorithm includes:
[0141] The target hash algorithm is used to determine h based on the anti-counterfeiting true random number, the encryption header and the Data.
[0142] In some possible implementations, determining the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data by using a target hash algorithm includes:
[0143] Using the anti-counterfeiting true random number as a confusion factor to perform obfuscation processing on the Data;
[0144] The obfuscated data is hashed using the target hash algorithm to determine h.
[0145] In some possible implementations, determining the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data by using a target hash algorithm includes:
[0146] When the anti-counterfeiting true random number includes a first anti-counterfeiting true random number and a second anti-counterfeiting true random number, and the first anti-counterfeiting true random number is different from the second anti-counterfeiting true random number, determining an irreducible polynomial p based on the first anti-counterfeiting true random number;
[0147] Determine a Toplitz matrix according to the irreducible polynomial p and the second anti-counterfeiting true random number;
[0148] The Data is hashed using the Toplitz matrix to determine h.
[0149] In some possible implementations, sending the ciphertext data assembled with the encryption header to the recipient includes:
[0150] Obtaining a quantum key of a previously preset bit position from the encryption key;
[0151] Determine a checksum k of the encryption header of the ciphertext data according to the encryption header and the quantum key;
[0152] The ciphertext data assembled with the encryption header is sent to the recipient; wherein the ciphertext data carries the k.
[0153] It should be noted that the principle of solving the technical problem of the method for preventing ciphertext forgery during quantum secure symmetric encryption provided in this embodiment is the same as the principle of solving the technical problem in the above-mentioned system embodiment, and the repeated parts will not be repeated.
[0154] Embodiment 5:
[0155] Similarly, the present application also provides a method for preventing ciphertext from being forged during quantum secure symmetric encryption, which is applied to the receiving party. Figure 4 A schematic diagram of a process for preventing ciphertext from being forged during quantum secure symmetric encryption provided by this application, the process comprising:
[0156] S401: Receive ciphertext data sent by the sender.
[0157] S402: Based on the key information carried in the ciphertext data, a decryption key is obtained from the symmetric key pre-negotiated with the sender.
[0158] S403: Decrypt the ciphertext data based on the decryption key to obtain the target data Data and the anti-counterfeiting hash value h carried in the ciphertext data.
[0159] S404: Determine the anti-counterfeiting hash value h by combining the anti-counterfeiting true random number and the data through the target hash algorithm ′ ; Wherein, the sender and the receiver pre-agree on a target hash algorithm and an anti-counterfeiting true random number.
[0160] S405: If the h ′ If it is consistent with h, the Data is determined to be legal;
[0161] S406: If the h ′ If it is inconsistent with the h, it is determined that the ciphertext data is forged ciphertext.
[0162] In the present application, the method for preventing ciphertext forgery during quantum secure symmetric encryption is applied to the receiver, and the receiver can be a quantum secure device, such as a quantum secure terminal, a quantum secure privacy computer, a quantum secure base station, etc.
[0163] In some possible implementations, the target hash algorithm is used to combine the anti-counterfeiting true random number and the data to determine the anti-counterfeiting hash value h ′ ,include:
[0164] Determine the hash value based on the target hash algorithm, the anti-counterfeiting true random number, the encryption header and the data. ′ ; Wherein, the encryption header carries the key information.
[0165] In some possible implementations, the target hash algorithm is used to combine the anti-counterfeiting true random number and the data to determine the anti-counterfeiting hash value h ′ ,include:
[0166] Using the anti-counterfeiting true random number as a confusion factor to perform obfuscation processing on the Data;
[0167] The target hash algorithm is used to perform hash calculation on the obfuscated data to determine the h ′ .
[0168] In some possible implementations, the target hash algorithm is used to combine the anti-counterfeiting true random number and the data to determine the anti-counterfeiting hash value h ′ ,include:
[0169] When the anti-counterfeiting true random number includes a first anti-counterfeiting true random number and a second anti-counterfeiting true random number, and the first anti-counterfeiting true random number is different from the second anti-counterfeiting true random number, determining an irreducible polynomial p based on the first anti-counterfeiting true random number;
[0170] Determine a Toplitz matrix according to the irreducible polynomial p and the second anti-counterfeiting true random number;
[0171] The Data is hashed by the Toplitz matrix to determine the h ′ .
[0172] In some possible implementations, after obtaining a decryption key from a symmetric key pre-negotiated with the sender based on the key information carried in the ciphertext data, and before decrypting the ciphertext data based on the decryption key to obtain Data and h carried in the ciphertext data, the method further includes:
[0173] Obtaining the quantum key of the pre-set bit position from the decryption key;
[0174] Determine the checksum k according to the quantum key and the key information carried by the ciphertext data ′ ;
[0175] Determine the k ′ Is it consistent with k carried in the ciphertext data?
[0176] If the k ′ If it is consistent with k, the step of decrypting the ciphertext data based on the decryption key is performed to obtain Data and h carried in the ciphertext data;
[0177] If the k ′ If it is inconsistent with the k, it is determined that the ciphertext data is forged ciphertext.
[0178] It should be noted that the principle of solving the technical problem of the method for preventing ciphertext forgery during quantum secure symmetric encryption provided in this embodiment is the same as the principle of solving the technical problem in the above-mentioned system embodiment, and the repeated parts will not be repeated.
[0179] Embodiment 6:
[0180] Based on the above embodiments, the present application also provides a quantum security device. Figure 5 A schematic diagram of the structure of a quantum security device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, it includes: a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42, and the memory 43 communicate with each other through the communication bus 44;
[0181] The memory 43 stores a computer program. When the program is executed by the processor 41, the processor 41 can perform the following steps:
[0182] Obtain target data Data, and obtain an encryption key from a symmetric key pre-negotiated with a recipient;
[0183] Determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through a target hash algorithm; wherein the sender and the receiver pre-agree on the target hash algorithm and the anti-counterfeiting true random number;
[0184] Encrypt the Data and h based on the encryption key to obtain ciphertext data;
[0185] The ciphertext data assembled with the encryption header is sent to the receiving party; wherein the encryption header carries the key information of the encryption key.
[0186] Or, perform the following steps:
[0187] Receive the ciphertext data sent by the sender;
[0188] Based on the key information carried in the ciphertext data, obtaining a decryption key from a symmetric key pre-negotiated with the sender;
[0189] Decrypt the ciphertext data based on the decryption key to obtain the target data Data and the anti-counterfeiting hash value h carried in the ciphertext data;
[0190] The anti-counterfeiting hash value h is determined by combining the anti-counterfeiting true random number and the data through the target hash algorithm. ′ ; Wherein, the sender and the receiver pre-agree on a target hash algorithm and an anti-counterfeiting true random number;
[0191] If the h ′ If it is consistent with h, the Data is determined to be legal;
[0192] If the h ′ If it is inconsistent with the h, it is determined that the ciphertext data is forged ciphertext.
[0193] Since the principle of solving the problem by the above-mentioned quantum security device is similar to the method of preventing ciphertext from being forged during quantum security symmetric encryption, the implementation of the above-mentioned quantum security device can refer to the embodiment of the method, and the repeated parts will not be repeated.
[0194] Embodiment 7:
[0195] On the basis of the above embodiments, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program executable by a processor is stored. When the program runs on the processor, the processor implements the following steps when executing:
[0196] Obtain target data Data, and obtain an encryption key from a symmetric key pre-negotiated with a recipient;
[0197] Determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through a target hash algorithm; wherein the sender and the receiver pre-agree on the target hash algorithm and the anti-counterfeiting true random number;
[0198] Encrypt the Data and h based on the encryption key to obtain ciphertext data;
[0199] The ciphertext data assembled with the encryption header is sent to the receiving party; wherein the encryption header carries the key information of the encryption key.
[0200] Or, implement the following steps:
[0201] Receive the ciphertext data sent by the sender;
[0202] Based on the key information carried in the ciphertext data, obtaining a decryption key from a symmetric key pre-negotiated with the sender;
[0203] Decrypt the ciphertext data based on the decryption key to obtain the target data Data and the anti-counterfeiting hash value h carried in the ciphertext data;
[0204] The anti-counterfeiting hash value h is determined by combining the anti-counterfeiting true random number and the data through the target hash algorithm. ′ ; Wherein, the sender and the receiver pre-agree on a target hash algorithm and an anti-counterfeiting true random number;
[0205] If the h ′ If it is consistent with h, the Data is determined to be legal;
[0206] If the h ′ If it is inconsistent with the h, it is determined that the ciphertext data is forged ciphertext.
[0207] Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to the method of preventing ciphertext from being forged during quantum secure symmetric encryption, the implementation of the above-mentioned computer-readable storage medium can refer to the embodiment of the method, and the repeated parts will not be repeated.
Claims
1. A system for preventing ciphertext forgery in quantum secure symmetric encryption, characterized in that: The system comprises: a sender and a receiver; wherein the sender and the receiver pre-agree on a target hash algorithm and an anti-counterfeiting true random number, and both the sender and the receiver store a symmetric key for direct symmetric communication; The sender is used to obtain the target data Data, and obtain the encryption key from the symmetric key; determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through the target hash algorithm; perform quantum encryption on the Data and h based on the encryption key to obtain ciphertext data; send the ciphertext data assembled with the encryption header to the receiver; wherein the encryption header carries the key information of the encryption key; The receiving party is used to receive the ciphertext data sent by the sending party; obtain a decryption key based on the key information carried in the ciphertext data; decrypt the ciphertext data based on the decryption key to obtain the Data and h carried in the ciphertext data; determine the anti-counterfeiting hash value h by combining the anti-counterfeiting true random number and the Data through the target hash algorithm ′ ; If the h ′ is consistent with h, then the Data is determined to be legal; if h ′ If it is inconsistent with the h, it is determined that the ciphertext data is forged ciphertext.
2. The system according to claim 1, characterized in that The sender is specifically used to determine the h based on the anti-counterfeiting true random number, the encryption header and the Data through the target hash algorithm.
3. The system according to claim 1, characterized in that The sender is specifically used to use the anti-counterfeiting true random number as a confusion factor to perform obfuscation processing on the Data; and perform hash calculation on the obfuscated data through the target hash algorithm to determine the h.
4. The system according to claim 1, characterized in that The sender is specifically configured to determine an irreducible polynomial p based on the first anti-counterfeiting true random number when the anti-counterfeiting true random number includes a first anti-counterfeiting true random number and a second anti-counterfeiting true random number, and the first anti-counterfeiting true random number is different from the second anti-counterfeiting true random number; Determine a Toplitz matrix according to the irreducible polynomial p and the second anti-counterfeiting true random number; The Data is hashed using the Toplitz matrix to determine h.
5. The system according to claim 1 or 2, characterized in that: The sender is specifically configured to obtain a quantum key of a preset bit position from the encryption key; determine a checksum k of the encryption header of the ciphertext data according to the encryption header and the quantum key; and send the ciphertext data assembled with the encryption header to the receiver; wherein the ciphertext data carries the k; The receiving party is further configured to decrypt the ciphertext data based on the decryption key to obtain the Data and h carried in the ciphertext data, and obtain the quantum key of the pre-set bit from the decryption key; determine the checksum k according to the quantum key and the encryption header of the ciphertext data. ′ ; Determine the k ′ Is it consistent with the k carried in the ciphertext data? ′ is consistent with the k, then the step of decrypting the ciphertext data based on the decryption key is performed to obtain Data and h carried in the ciphertext data; if the k ′ If it is inconsistent with the k, it is determined that the ciphertext data is forged ciphertext.
6. A method for preventing ciphertext forgery in quantum secure symmetric encryption, characterized in that: The method is applied to a sender, and comprises: Obtain target data Data, and obtain an encryption key from a symmetric key pre-negotiated with a recipient; Determine the anti-counterfeiting hash value h based on the anti-counterfeiting true random number and the Data through a target hash algorithm; wherein the sender and the receiver pre-agree on the target hash algorithm and the anti-counterfeiting true random number; Encrypt the Data and h based on the encryption key to obtain ciphertext data; The ciphertext data assembled with the encryption header is sent to the receiving party; wherein the encryption header carries the key information of the encryption key.
7. A method for preventing ciphertext from being forged during quantum secure symmetric encryption, characterized in that: The method is applied to a receiving party, and the method comprises: Receive the ciphertext data sent by the sender; Based on the key information carried in the ciphertext data, obtaining a decryption key from a symmetric key pre-negotiated with the sender; Decrypt the ciphertext data based on the decryption key to obtain the target data Data and the anti-counterfeiting hash value h carried in the ciphertext data; The anti-counterfeiting hash value h is determined by combining the anti-counterfeiting true random number and the data through the target hash algorithm. ′ ; Wherein, the sender and the receiver pre-agree on a target hash algorithm and an anti-counterfeiting true random number; If the h ′ If it is consistent with h, the Data is determined to be legal; If the h ′ If it is inconsistent with the h, it is determined that the ciphertext data is forged ciphertext.
8. A quantum security device, characterized in that: include: Processor and memory; The processor is used to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the sender as claimed in claim 6, or to execute the method for preventing ciphertext from being forged during quantum secure symmetric encryption as applied to the receiver as claimed in claim 7, by calling the program or instruction stored in the memory.
9. A computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores a program or instruction, which enables a computer to execute the method for preventing ciphertext from being forged when quantum secure symmetric encryption is applied to a sender as claimed in claim 6, or to execute the method for preventing ciphertext from being forged when quantum secure symmetric encryption is applied to a receiver as claimed in claim 7.