Authentication encryption method, verification decryption method and communication method
By generating a reusable initial vector IV and a pseudo-random number generator to generate a message authentication code and key stream, the communication data is encrypted and decrypted, which solves the problem of insufficient robustness of data confidentiality and integrity protection in the existing technology. , realizing efficient and secure communication in the 5G mobile communication system.
Patent Information
- Application Number
- CN202011026219.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-09-25
AI Technical Summary
The existing technology lacks a robust authentication and encryption method based on a pseudo-random number generator in communications. It cannot provide confidentiality and integrity protection of data at the same time, and the initial vector reusability is insufficient to meet the requirements of the 5G mobile communication system. need.
Provide an authentication encryption method to generate a reusable initial vector IV, combine the key and pseudo-random number generator to generate message authentication code and key stream, encrypt the plain text, and perform decryption verification at the receiving end to ensure the integrity of the data Confidentiality and integrity protection.
A universal authentication encryption method with ancillary data is implemented, which is resistant to initial vector reuse, improves communication security and efficiency, and can effectively provide confidentiality and integrity protection in 5G mobile communication systems.
Smart Images

Figure CN112187446B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to an authentication encryption method, a decryption method and a communication method. Background Art
[0002] Confidentiality protection and integrity protection are two important goals of information security. With the development of Internet technology, message authentication in insecure channels has become increasingly important. Encryption can be used to prevent illegal users from stealing data during transmission and protect the confidentiality of data. Message authentication codes can be used to detect whether data has been tampered with during transmission, protect the integrity of data, and authenticate the data source.
[0003] Existing authenticated encryption methods are generally based on block cipher construction, with low efficiency and security. In addition, during application, it must be ensured that the initial vector is not reused, which does not meet the requirements of strong robustness applications, such as the AES-GCM method.
[0004] Although the existing encryption and decryption algorithms based on pseudo-random number generators such as serial ciphers are highly robust, they can only provide confidentiality protection for data. Integrity protection requires a separate algorithm. Moreover, this method only performs XOR encryption on plaintext, and it must ensure that the initial vector corresponding to each message is not repeated, otherwise the confidentiality of the data cannot be protected. At present, there is a lack of a general strong and robust authentication encryption method and communication method based on a pseudo-random number generator. Summary of the invention
[0005] In view of the above analysis, an embodiment of the present invention aims to provide an encryption and decryption method based on communication authentication, so as to solve the problem that the existing technology has poor robustness and cannot provide confidentiality protection and integrity protection for data at the same time.
[0006] On the one hand, an embodiment of the present invention provides an authentication encryption method, which is applied to a sending end and includes the following steps:
[0007] Generate a reusable initialization vector IV;
[0008] Generate a message authentication code Tag1 according to the plaintext P1 to be sent and the attached data A, combined with the key K1 and H shared with the receiving end and the initial vector IV;
[0009] Generate a key stream Z1 according to the message authentication code Tag1 and the initial vector IV in combination with the key K2 shared with the receiving end;
[0010] The plaintext P1 is encrypted according to the key stream Z1, and the obtained ciphertext C is sent together with the message authentication code Tag1, the ancillary data A, and the initial vector IV to the receiving end, so that the receiving end decrypts and obtains the plaintext.
[0011] The beneficial effects of the above technical solution are as follows: a general authenticated encryption with attached data (AEAD) method is provided to provide confidentiality and integrity protection for communication data, and the method is resistant to IV (initial vector) reuse. In the 5G mobile communication system, this method can be used to authenticate and encrypt the data to be transmitted at the sender, and verify and decrypt the received ciphertext at the receiving end. It is a provably secure and efficient strong robust AEAD method that can effectively improve communication security and communication efficiency.
[0012] Based on the further improvement of the above method, the message authentication code Tag1 is generated according to the plaintext P1 to be sent and the ancillary data A, in combination with the key K1 and H shared with the receiving end and the initial vector IV, further comprising the following steps:
[0013] Convert the plaintext P1 and the ancillary data A into N-bit grouping forms respectively, encode the conversion results, and obtain the encoding result Encode(A, P1);
[0014] According to the Encode(A, P1) obtained above, combined with the key H shared with the receiving end, the pan-hash value X is obtained by the following formula:
[0015] X=GHASH H (Encode(A,P1))
[0016] Where H represents the shared key, GHASH H () represents a universal hash function;
[0017] Based on the X and initial vector IV obtained above, combined with the key K1 shared with the receiving end, the message authentication code Tag1 is obtained by the following formula
[0018]
[0019] Where PRG τ () represents the pseudo-random number generator, τ represents the bit length of the output result of the pseudo-random number generator, τ is equal to the bit length of the message authentication code Tag1, Conv v () represents the conversion function, v represents the bit length of the converted data string, Represents the exclusive-or operation.
[0020] The beneficial effects of the above-mentioned further improvement scheme are: based on a pseudo-random generator, a general authenticated encryption method with attached data is provided, which is used to provide confidentiality and integrity protection for plaintext data, and integrity protection for attached data. It has anti-IV reuse security (strong robustness), flexibility, and versatility, and can support any secure pseudo-random number generator structure. It can not only provide confidentiality and integrity protection functions for plaintext P1 of any length, but also provide integrity protection functions for attached data A of any length.
[0021] Further, the encoding result Encode(A, P1) is obtained by the following formula
[0022] Encode(A,P1)=Partition(A)||Partition(P1)||L A ||L P1
[0023] Where, L P1 The 64-bit form representing the bit length of the plaintext P1, L A The 64-bit format represents the bit length of the ancillary data A, and || represents a concatenation operation.
[0024] The beneficial effects of the above further improved scheme are: the encoding scheme is simple and universal, can generate a unique encoding result of the plaintext P1 and the attached data A, supports plaintext P1 and attached data A of any length, and lays the foundation for generating a valid message authentication code Tag1.
[0025] Furthermore, the generating of the key stream Z1 according to the message authentication code Tag1 and the initial vector IV in combination with the key K2 shared with the receiving end further comprises the following steps:
[0026] Use the following formula to convert Tag1 into a data string of v bits in length: v (Tag1)
[0027]
[0028] In the formula, MSB v (Tag1) represents the first v bits of data on the left side of Tag1, and |Tag1| represents the bit length of Tag1.
[0029] According to the Conv obtained above v (Tag1), combined with the initial vector IV and the key K2 shared with the receiving end, the key stream Z1 is obtained by the following formula
[0030]
[0031] Where |P1| represents the bit length of plaintext P1.
[0032] The beneficial effect of the above further improved scheme is: a key stream 1 is constructed based on a pseudo-random number generator, and then the plaintext P1 is XOR-encrypted by the key stream 1. The method is simple, universal, and efficient, and can support plaintext P1 and ancillary data A of any length, and has high security and reliability.
[0033] Further, the ciphertext C is obtained by the following formula
[0034]
[0035] The beneficial effects of the above further improved scheme are: the scheme for generating the ciphertext C is simple, universal, has high security, and can support the generation of ciphertext C of any length.
[0036] On the other hand, an embodiment of the present invention provides a verification and decryption method, which is applied to a receiving end. The verification and decryption method includes the following steps:
[0037] Receive the ciphertext C and message authentication code Tag1, initial vector IV, and attached data A sent by the sender;
[0038] Generate a key stream Z2 based on the Tag1 and IV and the key K2 shared with the sender;
[0039] Parse the ciphertext C according to Z2 to generate plaintext P2;
[0040] Generate authentication code Tag2 based on P2 and IV, combined with the key K1 and H shared with the sender;
[0041] Determine whether the Tag1 and Tag2 are consistent. If they are consistent, output the plaintext P2. Otherwise, output an invalid flag and delete the decrypted plaintext P2.
[0042] When the Tag1 and the Tag2 are consistent, the key stream Z2 is the same as the key stream used by the sender to encrypt the plaintext P1 to obtain the ciphertext C.
[0043] The beneficial effects of the above technical solution are as follows: a general verification and decryption method with attached data is provided to provide confidentiality and integrity protection for communication data. If the received message (ciphertext C and message authentication code Tag1, initial vector IV, attached data A) has not been tampered with, the key stream Z2 is the same as the key stream used by the sender to encrypt the plaintext P1 to obtain the ciphertext C. If it is tampered with, the key stream is different. For example, in a 5G mobile communication system, this method can be used to verify and decrypt the received ciphertext at the receiving end. It is a provably secure and efficient AEAD method that can effectively improve communication security and communication efficiency.
[0044] Based on the further improvement of the above method, the key stream Z2 is generated according to Tag1, IV and the key K2 shared with the sending end, including the following steps:
[0045] By using the following formula, Tag1 is converted into a data string Y of length v bits.
[0046]
[0047] Where |Tag1| represents the bit length of Tag1, MSB v (Tag1) represents the first v bits of data on the left side of Tag1;
[0048] According to the above-obtained Y, combined with the initial vector IV and the key K2 shared with the sender, the key stream Z2 is obtained by the following formula
[0049]
[0050] Wherein, |C| represents the bit length of the output result of the pseudo-random number generator PRG, which is also the bit length of the ciphertext C.
[0051] The beneficial effects of the above-mentioned further improvement scheme are: based on the pseudo-random generator, a universal verification and decryption method with attached data is provided, which is used to provide confidentiality and integrity protection for plaintext data, and integrity protection for attached data. It has anti-IV reuse security (strong robustness), flexibility, and versatility, and can support any secure pseudo-random number generator structure. It can not only provide confidentiality and integrity protection functions for plaintext P1 of any length, but also provide integrity protection functions for attached data A of any length.
[0052] Further, the plaintext P2 is obtained by the following formula
[0053]
[0054] The method of generating the authentication code Tag2 according to P2, IV and the key K1 and H shared with the sending end further includes the following steps:
[0055] Convert the plaintext P2 and the ancillary data A into N-bit grouping forms respectively, encode the conversion results, and obtain the encoding result Encode(A, P2);
[0056] According to the Encode(A, P2) obtained above, combined with the key H shared with the sender, the pan-hash value Y is obtained by the following formula:
[0057] Y=GHASH H (Encode(A,P2))
[0058] Where H represents the key shared with the sender, GHASH H () represents a universal hash function;
[0059] According to the above-obtained Y combined with the initial vector IV and the key K1 shared with the sender, the authentication code Tag2 is obtained by the following formula
[0060]
[0061] The beneficial effect of the above further improved scheme is that the authentication code Tag2 is constructed based on the pseudo-random number generator, which has high security and reliability. The method is simple and universal.
[0062] Furthermore, the receiving end and the sending end obtain the shared keys H, K1, and K2 through the following steps:
[0063] According to the preset IV0 and K0, the 128-bit key H and two k-bit keys K1 and K2 are obtained by the following formula:
[0064] H||K1||K2=PRG |H|+|K1|+|K2| (IV0, K0)
[0065] Wherein, |H|, |K1|, |K2| represent the bit lengths of keys H, K1 and K2 respectively, PRG() represents a pseudo-random number generator, and the bit length of its output result is |H|+|K1|+|K2|.
[0066] The beneficial effect of the above further improvement scheme is: by automatically generating shared keys H and K according to the pre-set IV0 and K0, the shared keys can be protected to a certain extent to prevent being directly stolen by others, and the key storage amount can be reduced.
[0067] In addition, an embodiment of the present invention provides a communication method including the above-mentioned authentication encryption and verification decryption, comprising the following steps:
[0068] The sending end generates a reusable initial vector IV, generates a message authentication code Tag1 according to the plaintext P1 and the attached data A to be sent, combined with the shared key K1, H and the initial vector IV, generates a key stream Z1 according to the Tag1, the initial vector IV and the shared key K2, encrypts the plaintext P1 according to the key stream Z1, and sends the obtained ciphertext C together with the message authentication code Tag1, the attached data A and the initial vector IV to the receiving end;
[0069] After the receiving end receives the C and Tag1, IV, and A, it generates a key stream Z2 based on the Tag1 and IV combined with the shared key K2, generates plaintext P2 based on the Z2 and ciphertext C, and further generates a message authentication code Tag2 based on the P2, IV combined with the shared key K1 and H, and determines whether the Tag1 and Tag2 are consistent. If they are consistent, the plaintext P2 is output, otherwise, an invalid flag is output and the decrypted plaintext P2 is deleted.
[0070] The beneficial effects of the above technical solution are as follows: a general encryption communication method is provided for providing confidentiality and integrity protection for communication data. The initial vector IV allows for repeated use. For example, in a 5G mobile communication system, this solution can be used to authenticate and encrypt the data to be transmitted at the sender, and to verify and decrypt the received ciphertext at the receiver. It is a provably secure and efficient strong robust AEAD method that can effectively improve the security, robustness and communication efficiency of the communication system.
[0071] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The drawings are only for the purpose of illustrating specific embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like components throughout the drawings.
[0073] Figure 1 This is a schematic diagram of the steps of the authentication and encryption method of Example 1 of the present invention;
[0074] Figure 2 This is a schematic diagram of the steps of the verification and decryption method according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0075] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0076] Example 1
[0077] A specific embodiment of the present invention discloses an authentication encryption method applied to a sending end, such as Figure 1 As shown, the following steps are included:
[0078] S1. Generate a reusable initial vector IV;
[0079] S2. Generate a message authentication code Tag1 based on the plaintext P1 and the attached data A to be sent, combined with the key K1, H and the initial vector IV shared with the receiving end;
[0080] S3. Generate a key stream Z1 based on the message authentication code Tag1 and the initial vector IV, combined with the key K2 shared with the receiving end;
[0081] S4. Encrypt the plaintext P1 according to the key stream Z1, and send the obtained ciphertext C together with the message authentication code Tag1, the ancillary data A, and the initial vector IV to the receiving end, so that the receiving end decrypts and obtains the plaintext.
[0082] During implementation, when the sender and the receiver communicate confidentially, it is first assumed that both parties have shared keys K1 and K2. The sender wants to send a plaintext message P1 to the receiver. In order to ensure the confidentiality and integrity of the plaintext message P1 during the communication process, it is necessary to first calculate the authentication code Tag1 for the plaintext message P1 and the attached data A and the initial vector IV, and then encrypt P1 according to Tag1 and IV to obtain the ciphertext C, and then send (IV, A, C, Tag1) to the receiver. It is worth noting that A is the attached data that does not need to be encrypted and only needs to provide integrity protection.
[0083] Compared with the prior art, this embodiment provides a general authenticated encryption with attached data (AEAD) method for providing confidentiality and integrity protection for communication data, and the method is resistant to IV (initial vector) reuse. In the 5G mobile communication system, this method can be used to authenticate and encrypt the data to be transmitted at the sender, and verify and decrypt the received ciphertext at the receiver. It is a provably secure and efficient strong robust AEAD method that can effectively improve communication security and communication efficiency.
[0084] Example 2
[0085] Based on the optimization of Example 1, step S2 further includes:
[0086] S21. Convert the plaintext P1 and the ancillary data A into N-bit grouping forms respectively, encode the conversion results, and obtain the encoding result Encode(A, P1). Preferably, Encode(A, P1) is obtained by the following formula:
[0087] Encode(A,P1)=Partition(A)||Partition(P1)||L A ||L P1 (1)
[0088] Where, L P1The 64-bit form representing the bit length of the plaintext P1, L A The 64-bit format represents the bit length of the ancillary data A, and || represents a concatenation operation.
[0089] Exemplarily, N=128.
[0090] Assume that data string A = 1010101010, then the bit length of A is the integer 10, and the 64-bit form of the bit length of A is 0 60 ||1010,L P1 The meaning is similar.
[0091] If the last block of the plaintext P1 and the ancillary data A block is less than 128 bits, use 0 to fill it to 128 bits. For example: if |A| = 256, then Partition(A) = A0||A1; if |A| = 192, then Partition(A) = A0||(A1||0 64 ). || indicates concatenation operation, 0 64 It represents the concatenation of 64 zeros, and |A| represents the bit length of A.
[0092] S22. Based on the Encode(A, P1) obtained above, combined with the key H shared with the receiving end, the pan-hash value X is obtained by the following formula:
[0093] X=GHASH H (Encode(A,P1)) (2)
[0094] Where H represents the shared key, GHASH H () represents a universal hash function.
[0095] S23. Based on the X and initial vector IV obtained above, combined with the key K1 shared with the receiving end, the message authentication code Tag1 is obtained by the following formula
[0096]
[0097] Where PRG τ () represents a pseudo-random number generator; τ represents the bit length of the output result of the pseudo-random number generator, which is equal to the bit length of the message authentication code Tag1, and is generally 32 to 128. The specific value is determined by the communication system; Conv v () represents the conversion function; v represents the bit length of the converted data string, which is equal to the bit length of the initial vector IV. For example, when using my country's commercial secret sequence cipher algorithm ZUC-256, v = 184 bits can be selected; Represents the exclusive-or operation.
[0098] It is worth noting that, according to application requirements, the pseudo-random number generator PRG can use any secure sequence encryption algorithm, such as my country's commercial secret sequence encryption standard algorithm ZUC or ZUC-256, or it can be constructed by a hash algorithm or a block cipher, such as using SM3 or SM4 through existing methods, which can be understood by those skilled in the art.
[0099] The above GHASH H (M) The calculation process is as follows:
[0100] 1.Partition(M)=M0||M1||…||Mn-1;
[0101] 2. Let Y = 0;
[0102] 3. For 1≤j≤n, calculate in, and They are finite fields GF(2 128 )=GF(2)[x] / (x 128 +x 7 +x 2 +x+1).
[0103] The specific definition is as follows: The set {0,1} consisting of a bit string of length 128 can be 128 Considered as containing 2 128 The finite field GF(2 128 ), GF(2 128 ) is a polynomial of degree less than 128 over GF(2), then {0,1} 128 The bit string a in 127 a 126 ...a1a0 and GF(2 128 ) in the polynomial a(x)=a 127 x 127 +a 126 x 126 +…+a1x+a0, then GF(2 128 ) adds the two polynomials a(x) and b(x) in It is defined as the addition of polynomials over GF(2), i.e., XOR of corresponding bits.
[0104] The specific definition is as follows: The finite field GF(2 128 ) is to multiply the two polynomials a(x) and b(x) in GF(2) by first multiplying the polynomials modulo f(x) as The result is, where f(x) = x 128 +x7 +x 2 +x+1 is an irreducible polynomial.
[0105] Preferably, step S3 further comprises:
[0106] S31. Use the following formula to convert Tag1 into a data string of v bits in length: Conv v (Tag1)
[0107]
[0108] In the formula, MSB v (Tag1) represents the first v bits of data on the left side of Tag1, that is, v bits of data are taken starting from the left end of Tag1, and |Tag1| represents the bit length of Tag1.
[0109] S32. According to the Conv obtained above v (Tag1), combined with the initial vector IV and the key K2 shared with the receiving end, the key stream Z1 is obtained by the following formula
[0110]
[0111] Wherein, |P1| represents the bit length of the plaintext P1, which is specifically determined by the communication system and is also the bit length of the output result of the pseudo-random number generator.
[0112] Preferably, the ciphertext C in step S4 is obtained by the following formula:
[0113]
[0114] During implementation, when the sender and the receiver communicate confidentially, it is first assumed that both parties have shared keys H, K1, and K2. The sender wants to send a plaintext message P1 to the receiver. In order to ensure the confidentiality and integrity of the plaintext message P1 during the communication process, it is necessary to first calculate the plaintext message P1 and the attached data A, as well as the randomly generated initial vector IV, to obtain the message authentication code Tag1, and then calculate Tag1, IV, and P1, encrypt the ciphertext C, and obtain the message authentication code Tag1, and then send (IV, A, C, Tag1) to the receiver. IV is a reusable initial vector.
[0115] Compared with Example 1, the method provided in this embodiment has anti-IV reuse security, flexibility, and versatility, supports any secure pseudo-random number generator construction, and can not only provide confidentiality and integrity protection functions for plaintext of any length, but also provide integrity protection functions for ancillary data of any length.
[0116] Example 3
[0117] A specific embodiment of the present invention discloses a verification and decryption method corresponding to embodiment 1 applied to a receiving end, such as Figure 2 As shown, the following steps are included:
[0118] S5. Receive the ciphertext C and message authentication code Tag1, initial vector IV, and attached data A sent by the sender;
[0119] S6. Generate a key stream Z2 based on the Tag1, IV, and the key K2 shared with the sender;
[0120] S7. Parse the ciphertext C according to Z2 to generate plaintext P2;
[0121] S8. Generate the authentication code Tag2 based on the P2, IV, combined with the key K1 and H shared with the sender;
[0122] S9. Determine whether the Tag1 and Tag2 are consistent. If they are consistent, output the plaintext P2 (P2=P1). Otherwise, output an invalid flag and delete the decrypted plaintext P2.
[0123] It is worth noting that if the received message has not been tampered with, the Tag1 and the Tag2 are consistent, and the key stream Z2 is the same as the key stream Z1 used by the sender to encrypt the plaintext P1 to obtain the ciphertext C.
[0124] During implementation, after the receiving end receives the message (IV, A, C, Tag1) from the sending end, it first calculates the plaintext P2, and further needs to verify whether the decrypted plaintext P2 is correct, that is, by comparing the message authentication code Tag1 and Tag2 to verify the correctness of P2. If the comparison fails, an error identifier is returned, and the plaintext P2 is output only after the comparison and verification is successful. The entire method plays a role in protecting the confidentiality and integrity of the plaintext message P1.
[0125] Example 4
[0126] Based on the optimization of Example 3, step S6 further includes:
[0127] S61. Convert Tag1 into a data string Y of length v bits using the following formula:
[0128]
[0129] Where |Tag1| represents the bit length of Tag1, MSB v (Tag1) represents the left-side first v bits of data of Tag1.
[0130] S62. Based on the above-obtained Y, combined with the initial vector IV and the key K2 shared with the sender, the key stream Z2 is obtained by the following formula
[0131]
[0132] In the formula, |C| represents the bit length of the output result of the pseudo-random number generator, which is also the bit length of the ciphertext C.
[0133] Preferably, the plain text P2 in step S7 is obtained by the following formula:
[0134]
[0135] Preferably, step S8 further comprises:
[0136] S81. Convert the plain text P2 and the ancillary data A into N-bit grouping forms respectively, encode the conversion results, and obtain the encoding result Encode(A, P2).
[0137] S82. Based on the Encode(A, P2) obtained above, combined with the key H shared with the sender, the pan-hash value Y is obtained by the following formula:
[0138] Y=GHASH H (Encode(A,P2)) (10)
[0139] Where H represents the key shared with the sender, GHASH H () represents a universal hash function.
[0140] S83. Based on the Y obtained above, combined with the initial vector IV and the key K1 shared with the sender, the authentication code Tag2 is obtained by the following formula
[0141]
[0142] Preferably, if the amount of key storage needs to be reduced, H, K1, and K2 can be calculated by a key derivation algorithm. The input of the key derivation algorithm is (IV0, K0), IV0 represents a v-bit initial vector (determined by the system), K0 represents a k-bit key, and PRG (IV0, K0) is run to generate a 128-bit key H and two k-bit keys K1 and K2.
[0143] H||K1||K2=PRG |H|+|K1|+|K2| (IV0,K0) (12)
[0144] Wherein, |H|, |K1|, |K2| represent the bit lengths of keys H, K1 and K2 respectively, PRG() represents a pseudo-random number generator, and the bit length of its output result is |H|+|K1|+|K2.
[0145] During implementation, after the receiving end receives the message (IV, A, C, Tag1) from the sending end, it first calculates the plaintext P2, and further needs to verify whether the decrypted plaintext P2 is correct, that is, the correctness of P2 is verified by comparing the message authentication code Tag1 and Tag1. If the comparison fails, an error identifier is returned. Only after the comparison and verification is successful, the plaintext P2 is output.
[0146] Compared with Example 3, the method provided in this embodiment provides a universal verification and decryption method with attached data for pseudo-random generators such as serial ciphers, which is resistant to IV reuse, and is used for confidentiality and integrity protection of data, and the mode is highly robust in use, which can avoid security issues caused by IV reuse due to improper use by operators. For example, in a 5G mobile communication system, this method is used to provide confidentiality and integrity protection for transmitted data based on a secure serial cipher (such as ZUC-256), thereby improving the security, robustness and communication efficiency of the communication system. At the same time, the mode can also be used in application scenarios where IV is not convenient to update with messages, while still ensuring the confidentiality and integrity of the system.
[0147] Example 5
[0148] A specific embodiment of the present invention discloses a communication method including the authentication encryption described in Example 2 and the verification decryption described in Example 4, characterized in that it includes the following steps:
[0149] SS1. The sending end generates a reusable initial vector IV, generates a message authentication code Tag1 according to the plaintext P1 and the attached data A to be sent, combined with the shared key K1, H and the initial vector IV, generates a key stream Z1 according to the Tag1, the initial vector IV and the shared key K2, encrypts the plaintext P1 according to the key stream Z1, and sends the obtained ciphertext C together with the message authentication code Tag1, the attached data A and the initial vector IV to the receiving end; optionally, the sending end can send the ciphertext C and the Tag1, A to the receiving end in the form of (IV, A, C, Tag1).
[0150] SS2. After the receiving end receives the C and Tag1, IV, and A, it generates a key stream Z2 based on the Tag1 and IV combined with the shared key K2, generates a plaintext P2 based on the Z2 and the ciphertext C, and further generates a message authentication code Tag2 based on the P2 and IV combined with the shared key K1 and H, and determines whether the Tag1 and Tag2 are consistent. If they are consistent, output the plaintext P2 (P2=P1), otherwise, output an invalid flag and delete the decrypted plaintext P2 (P2≠P1).
[0151] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0152] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. An authentication encryption method, applied to a sending end, characterized in that: The authentication encryption method comprises the following steps: Generate a reusable initialization vector IV; Generate a message authentication code Tag1 according to the plaintext P1 to be sent and the attached data A, combined with the key K1 and H shared with the receiving end and the initial vector IV; Generate a key stream Z1 according to the message authentication code Tag1 and the initial vector IV in combination with the key K2 shared with the receiving end; The plaintext P1 is encrypted according to the key stream Z1, and the obtained ciphertext C and the message authentication code Tag1, the ancillary data A, and the initial vector IV are sent to the receiving end, so that the receiving end decrypts and obtains the plaintext.
2. The authentication encryption method according to claim 1, characterized in that: The method of generating a message authentication code Tag1 according to the plaintext P1 to be sent and the ancillary data A, in combination with the key K1 and H shared with the receiving end and the initial vector IV, further includes the following steps: Convert the plaintext P1 and the ancillary data A into N-bit grouping forms respectively, encode the conversion results, and obtain the encoding result Encode(A, P1); According to the Encode(A, P1) obtained above, combined with the key H shared with the receiving end, the pan-hash value X is obtained by the following formula: X=GHASH H (Encode(A,P1)) Where H represents the shared key, GHASH H () represents a universal hash function; Based on the X and initial vector IV obtained above, combined with the key K1 shared with the receiving end, the message authentication code Tag1 is obtained by the following formula Tag1=PRG τ (Conv v (X)⊕IV,K1) Where PRG τ () represents the pseudo-random number generator, τ represents the bit length of the output result of the pseudo-random number generator, τ is equal to the bit length of the message authentication code Tag1, Conv v () represents the conversion function, v represents the bit length of the converted data string, Represents the exclusive-or operation.
3. The authenticated encryption method according to claim 2, characterized in that: The encoding result Encode(A, P1) is obtained by the following formula Encode(A,P1)=Partition(A)||Partition(P1)||L A ||L P1 Where, L P1 The 64-bit form representing the bit length of the plaintext P1, L A The 64-bit format represents the bit length of the ancillary data A, and || represents a concatenation operation.
4. The authentication encryption method according to any one of claims 1 to 3, characterized in that: The method of generating a key stream Z1 according to the message authentication code Tag1 and the initial vector IV in combination with the key K2 shared with the receiving end further includes the following steps: Use the following formula to convert Tag1 into a data string of v bits in length: v (Tag1) In the formula, MSB v (Tag1) represents the first v bits of data on the left side of Tag1, and Tag1 represents the bit length of Tag1; According to the Conv obtained above v (Tag1), combined with the initial vector IV and the key K2 shared with the receiving end, the key stream Z1 is obtained by the following formula Where |P1| represents the bit length of plaintext P1.
5. The authenticated encryption method according to claim 4, characterized in that: The ciphertext C is obtained by the following formula 6. A verification and decryption method, applied to a receiving end, characterized in that: The verification and decryption method comprises the following steps: Receive the ciphertext C and message authentication code Tag1, initial vector IV, and attached data A sent by the sender; Generate a key stream Z2 according to the message authentication code Tag1, the initial vector IV, and the key K2 shared with the sender; Parse the ciphertext C according to the key stream Z2 to generate the plaintext P2; Generate a message authentication code Tag2 based on the plaintext P2 and the initial vector IV, combined with the keys K1 and H shared with the sender; Determine whether the Tag1 and Tag2 are consistent. If they are consistent, output the plaintext P2. Otherwise, output an invalid flag and delete the decrypted plaintext P2. When the Tag1 and the Tag2 are consistent, the key stream Z2 is the same as the key stream used by the sender to encrypt the plaintext P1 to obtain the ciphertext C.
7. The verification and decryption method according to claim 6, characterized in that: The method of generating a key stream Z2 according to the message authentication code Tag1, the initial vector IV and the key K2 shared with the sending end further includes the following steps: By using the following formula, Tag1 is converted into a data string Y of length v bits. Where |Tag1| represents the bit length of Tag1, MSB v (Tag1) represents the first v bits of data on the left side of Tag1; According to the above-obtained Y, combined with the initial vector IV and the key K2 shared with the sender, the key stream Z2 is obtained by the following formula In the formula, |C| represents the bit length of the output result of the pseudo-random number generator, which is also the bit length of the ciphertext C.
8. The verification and decryption method according to claim 7, characterized in that: The plaintext P2 is obtained by the following formula The method of generating the authentication code Tag2 according to the plaintext P2 and the initial vector IV in combination with the keys K1 and H shared with the sending end further includes the following steps: Convert the plaintext P2 and the ancillary data A into N-bit grouping forms respectively, encode the conversion results, and obtain the encoding result Encode(A, P2); According to the Encode(A, P2) obtained above, combined with the key H shared with the sender, the pan-hash value Y' is obtained by the following formula: Y'=GHASH H (Encode(A,P2)) Where H represents the key shared with the sender, GHASH H () represents a universal hash function; According to the above-obtained Y' combined with the initial vector IV and the key K1 shared with the sender, the authentication code Tag2 is obtained by the following formula 9. The verification and decryption method according to claim 8, characterized in that: The receiver and sender obtain the shared keys H, K1, and K2 through the following steps: According to the preset IV0 and K0, the 128-bit key H and two k-bit keys K1 and K2 are obtained by the following formula: H||K1||K2=PRG |H|+|K1|+|K2| (IV0,K0) Wherein, IV0 represents a v-bit initial vector, K0 represents a k-bit key, |H|, |K1|, |K2| represent the bit lengths of keys H, K1, and K2 respectively, and PRG() represents a pseudo-random number generator, whose output result has a bit length of |H|+|K1|+|K2|.
10. A communication method including authentication encryption and verification decryption, characterized in that: The steps include: The sending end generates a reusable initial vector IV, generates a message authentication code Tag1 according to the plaintext P1 and the attached data A to be sent, combined with the shared key K1, H and the initial vector IV, generates a key stream Z1 according to the Tag1, the initial vector IV and the shared key K2, encrypts the plaintext P1 according to the key stream Z1, and sends the obtained ciphertext C together with the message authentication code Tag1, the attached data A and the initial vector IV to the receiving end; After the receiving end receives the C and Tag1, IV, and A, it generates a key stream Z2 based on the Tag1 and IV combined with the shared key K2, generates plaintext P2 based on the Z2 and ciphertext C, and further generates a message authentication code Tag2 based on the P2, IV combined with the shared key K1 and H, and determines whether the Tag1 and Tag2 are consistent. If they are consistent, the plaintext P2 is output, otherwise, an invalid flag is output and the decrypted plaintext P2 is deleted.
Citation Information
Patent Citations
Completeness certification method
CN101753308A
Block cryptographic method for encrypting / decrypting messages and cryptographic devices for implementing this method
CN107005415A
Variable-length authentication label generation method suitable for ZUC-256 stream cryptographic algorithm and communication method and system
CN110034919A
Authentication encryption method, authentication decryption method, and information-processing device
US20170272239A1
