Information interaction method and system, storage medium, electronic equipment and program product
By using the round key determined by the session key during information interaction for encryption and decryption, the problem that traditional encryption methods cannot cope with complex network attacks is solved, and efficient encryption and decryption process and powerful attack resistance are achieved.
Patent Information
- Application Number
- CN202411432604.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-03-04
AI Technical Summary
Traditional encryption methods cannot effectively deal with modern complex cyber attacks, such as man-in-the-middle attacks, replay attacks, and identity forgery.
By using the wheel key determined by the session key during the information interaction, the first client encrypts the target information according to the first arrangement order of the wheel key, and the second client decrypts the ciphertext data according to the reverse order of the wheel key.
The calculation amount during encryption and decryption process is reduced, the encryption and decryption time is shortened, and the key strength in the information interaction process is improved. Based on complex encryption mechanisms and high-strength keys, it makes it more difficult to crack cryptographic texts and improves the ability to resist attacks during information interaction.
Smart Images

Figure CN119561714A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of network communication security technology, and in particular, to an information interaction method, system, storage medium, electronic device and program product. Background Art
[0002] In the process of information exchange, traditional encryption methods cannot cope with modern complex network attacks, such as man-in-the-middle attacks, replay attacks, and identity forgery, which are becoming increasingly serious. A more secure information exchange method is needed. Summary of the invention
[0003] In order to solve the deficiencies of the prior art, the present disclosure provides an information interaction method, system, storage medium, electronic device and program product.
[0004] In order to achieve the above objectives, in a first aspect, the present disclosure provides an information interaction method, the method comprising:
[0005] The first client determines a first number of round keys according to the session key, encrypts the target information in sequence using the first number of round keys according to a first arrangement order of the round keys, obtains ciphertext data corresponding to the target information, and sends the ciphertext data to the second client, wherein the session key is a key shared by the first client and the second client in information exchange;
[0006] The second client determines the first number of round keys according to the session key, and decrypts the ciphertext data in sequence using the first number of round keys according to a second arrangement order of each round key to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order.
[0007] In a second aspect, the present disclosure provides an information interaction system, the system comprising:
[0008] The first client is configured to determine a first number of round keys according to the session key, encrypt the target information in sequence using the first number of round keys according to a first arrangement order of the round keys, obtain ciphertext data corresponding to the target information, and send the ciphertext data to the second client, wherein the session key is a key shared by the first client and the second client in information exchange;
[0009] The second client is used to determine the first number of round keys according to the session key, and decrypt the ciphertext data in sequence using the first number of round keys according to a second arrangement order of each round key to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order.
[0010] In a third aspect, the present disclosure provides an information interaction method, applied to a first client, the method comprising:
[0011] Determining a first number of round keys based on the session key;
[0012] According to the first arrangement order of each of the round keys, the target information is encrypted in sequence using the first number of the round keys to obtain ciphertext data corresponding to the target information, and the ciphertext data is sent to the second client so that the second client decrypts the ciphertext data to obtain the target information. The session key is a key shared by the first client and the second client in information exchange.
[0013] In a fourth aspect, the present disclosure provides an information interaction method, applied to a second client, the method comprising:
[0014] Receiving ciphertext data sent by a first client, where the ciphertext data is obtained by encrypting target information by using the first number of round keys according to a first arrangement sequence of the first number of round keys;
[0015] Determine the first number of the round keys according to the session key;
[0016] According to the second arrangement order of each of the round keys, the ciphertext data is decrypted in sequence using the second number of the round keys to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order, and the session key is a key shared by the client and the other client in information exchange.
[0017] In a fifth aspect, the present disclosure provides a non-temporary computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the third aspect or the fourth aspect.
[0018] In a sixth aspect, the present disclosure provides an electronic device, including:
[0019] a memory having a computer program stored thereon;
[0020] A processor is used to execute the computer program in the memory to implement the method described in the third aspect or the fourth aspect.
[0021] In a seventh aspect, the present disclosure provides a computer program product, including a computer program, which implements the method described in the third aspect or the fourth aspect when executed by a processor.
[0022] Through the above technical scheme, the first client encrypts the target information using a first number of round keys according to the first arrangement order of each round key, and the second client decrypts the ciphertext data using the first number of round keys according to the reverse order of the first arrangement order of each round key, thereby realizing symmetric encryption and decryption of information during information interaction, thereby reducing the amount of calculation in the encryption and decryption process, shortening the encryption and decryption time, and both the encryption process and the decryption process are realized according to multiple round keys, which improves the strength of the key in the information interaction process, and based on the complex encryption mechanism and high-strength key, it makes it difficult to crack the ciphertext, thereby improving the strong anti-attack capability in the information interaction process.
[0023] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0025] Figure 1 It is a schematic diagram of an information interaction method according to an exemplary embodiment of the present disclosure.
[0026] Figure 2 It is a block diagram of an information interaction system according to an exemplary embodiment of the present disclosure.
[0027] Figure 3 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0029] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.
[0030] As mentioned in the background technology, with the rapid development of information technology, identity authentication and key negotiation in network environments face more and more challenges. Traditional encryption methods are powerless in dealing with modern complex network attacks, such as man-in-the-middle attacks, replay attacks, identity forgery and other increasingly serious threats. A more secure and efficient information exchange method is urgently needed.
[0031] In view of this, the present disclosure provides an information interaction method, system, storage medium, electronic device and program product, which can improve the security and anti-attack ability in the information interaction process.
[0032] Figure 1 is a schematic diagram of an information interaction method according to an exemplary embodiment of the present disclosure. The first client and the second client in the method can be electronic devices, such as smart phones, laptops, smart wearable devices, etc. Figure 1 As shown, the method may include:
[0033] The first client determines a first number of round keys according to the session key, encrypts the target information in sequence using the first number of round keys according to a first arrangement order of the round keys, obtains ciphertext data corresponding to the target information, and sends the ciphertext data to the second client, wherein the session key is a key shared by the first client and the second client in information exchange;
[0034] The second client determines the first number of round keys according to the session key, and decrypts the ciphertext data in sequence using the first number of round keys according to a second arrangement order of each round key to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order.
[0035] It is worth noting that the second client initiates an interaction request to the first client, the first client responds to the interaction request, encrypts the target information, obtains the ciphertext data corresponding to the target information, and sends the ciphertext data to the second client; the second client decrypts the ciphertext data to obtain the target information. Among them, the first client can be the authentication responder, and user B refers to the first client in the subsequent implementation. The second client can be the authentication applicant, and user A refers to the second client in the subsequent implementation.
[0036] It should be understood that the first number can be preset according to the length of the target information to be encrypted. In the embodiment of the present disclosure, the first number is 32.
[0037] For example, user A initiates an interaction request to user B, and user B responds to the interaction request. session Determine 32 round keys RK i , according to each round key RK i The target information M is encrypted in the first arrangement order by using 32 round keys in turn to obtain the ciphertext data C' corresponding to the target information M, and the ciphertext data C' is sent to user A; user A uses the session key K session Determine 32 round keys RK i , according to each round key RK iThe reverse order of the first arrangement order, through 32 round keys RK i Decrypt the ciphertext data C' in sequence to obtain the target information M.
[0038] In the disclosed embodiment, the first client encrypts the target information using a first number of round keys according to a first arrangement order of the round keys, and the second client decrypts the ciphertext data using the first number of round keys according to the inverse order of the first arrangement order of the round keys, thereby realizing symmetric encryption and decryption of information during information interaction, thereby reducing the amount of computation in the encryption and decryption processes, shortening the encryption and decryption time, and both the encryption and decryption processes are realized based on multiple round keys, thereby improving the strength of the keys during the information interaction process, and based on the complex encryption mechanism and the high-strength keys, making it difficult to crack the ciphertext, thereby improving the strong anti-attack capability during the information interaction process.
[0039] In order to facilitate those skilled in the art to better understand the information interaction method provided by the present disclosure, the steps of the method are described in detail below.
[0040] It is worth noting that after user A initiates an interaction request to user B, user A and user B need to perform two-way identity authentication, and only after the two-way identity authentication is passed can user A and user B exchange information.
[0041] In a feasible implementation manner, before the first client determines the first number of round keys according to the session key, the following method may also be included:
[0042] The first client and the second client perform two-way identity authentication;
[0043] The first client determines a first number of round keys according to a preset session key, including:
[0044] After the two-way identity authentication is passed, the first client determines a first number of round keys according to a preset session key.
[0045] In the disclosed embodiment, the first client and the second client need to perform two-way identity authentication before exchanging information. After the two-way identity authentication of the first client and the second client is passed, the first client and the second client can exchange information. The two-way identity authentication increases the difficulty for an attacker to forge an identity, thereby effectively preventing man-in-the-middle attacks, thereby improving the security and integrity of communication data during transmission.
[0046] In a feasible implementation manner, the first client and the second client perform two-way identity authentication, which may include:
[0047] The first client receives the authentication request sent by the second client, generates first signature information according to the authentication request, and feeds back the first signature information to the second client;
[0048] The second client verifies the validity of the first signature information, generates second signature information when the validity verification passes, and sends the second signature information to the first client;
[0049] The first client verifies the validity of the second signature information. When the validity verification passes, the two-way identity authentication between the first client and the second client succeeds.
[0050] It is worth noting that validity verification is to verify whether the received signature information is generated by the sender, such as the second client verifies whether the first signature information is generated by the first client, and the first client verifies whether the second signature information is generated by the second client.
[0051] For example, user B receives an authentication request sent by user A, generates first signature information according to the authentication request, and feeds the first signature information back to user A; when user A determines that the first signature information is generated by user B, user A generates second signature information and sends the second signature information to user B. When user B determines that the second signature information is generated by user A, it determines that the two-way identity authentication between user A and user B is successful.
[0052] In the disclosed embodiment, the second client verifies the validity of the first signature information generated by the first client, and the first client verifies the validity of the second signature information generated by the second client, thereby realizing two-way identity authentication, thereby increasing the difficulty for an attacker to forge an identity, thereby effectively preventing man-in-the-middle attacks.
[0053] In a feasible implementation manner, the authentication request includes a first public key and a first identity identifier of the second client, and the first signature information includes a first digital signature;
[0054] The first client generates first signature information according to the authentication request, which may include:
[0055] The first client performs bilinear pairing processing on the first public key to obtain a first private key of the second client;
[0056] Performing hash processing according to the first private key, the first identity identifier, and the second public key of the first client to obtain a first hash value;
[0057] A first digital signature is generated according to the first hash value, the second private key of the first client, and a preset correction factor.
[0058] It is worth noting that the Key Generation Center (KGC) randomly selects the system master key s and generates the system public key P based on the system master key s. pub and a system parameter group, wherein the system parameter group includes a bilinear mapping, a homomorphic mapping, a hash function, etc.
[0059] Specifically, KGC presets two N-order element groups, namely the first element group G1 and the second element group G2, G1 corresponds to the generator P1, and G2 corresponds to the generator P2;
[0060] Bilinear map e: G1×G2→G T ;
[0061] The homomorphic mapping ψ from G2 to G1 satisfies P1 = ψ(P2);
[0062] The first hash function H1 is used to generate the user's private key, H1: Characterize the set of non-zero elements modulo N;
[0063] The second hash function is used to generate the hash value, H2: Characterize the set of non-zero elements modulo N′;
[0064] KGC randomly selects the system master key Calculate the system public key P based on s pub =[s]P2;
[0065] KGC publishes system parameter groups to clients:
[0066] W = {G1, G2, G T , P1, P2, ψ, H1, H2, P pub ,N,0×01},
[0067] Among them, 0×01 represents the identifier generated by the signature user's private key.
[0068] It is worth noting that the user provides the identity D i To KGC, KGC according to the system parameter group W and the user's identity D i Generate the user's private key d i , and feeds back the private key d to the user.
[0069] Specifically, user i provides identity D i To KGC;
[0070] KGC calculates t1 = h i +s, where h i =H1(D i||0x01||N);
[0071] If t1 = 0, KGC reselects the value of the system master key s and calculates t1 based on the reselected system master key s until t1 ≠ 0.
[0072] Get the private key d of user i i :
[0073] d i =t2·P2.
[0074] For example, user A randomly selects k A ∈[1, N-1], calculate the element K in G1 A =k A P1, the element K A As user A's first public key, K A and user A's identity D A Sent to user B as an authentication request;
[0075] After receiving the authentication request, user B chooses kB∈[1, N-1] and calculates the element K in G1 B =k B P1, K B As the second public key of user B;
[0076] K A Substitute the following formula to get G T Elements in g1:
[0077] g1=e(K A , P pub ),
[0078] Choose any random number r∈[1, N-1], and calculate the first private key ω of user A based on the elements g1 and r:
[0079] ω=g1 r ,
[0080] Through H2, the identity of user A is D A And user B's second public key K B Perform hash processing to obtain the first hash value h:
[0081] h=H2(M||ω||N), M=K B ||D A ;
[0082] Determine the correction factor L based on the first hash value:
[0083] L = rh (modN),
[0084] If L=0, reselect the random number r to determine the correction factor L;
[0085] According to the correction factor L, user B's private key d B , determine the element S in G1:
[0086] S=L·ψ(d B );
[0087] According to the first hash value h and element S, generate the first digital signature σ1 of user B:
[0088] σ1=h·S.
[0089] In the disclosed embodiment, the first client generates a first digital signature based on the authentication request of the second client. Both parties participate together, which can effectively prevent external attackers from stealing the signature subkey, improve the security of the signature, enhance the trust between clients, and do not require additional certificate management steps, thereby simplifying the operational flow of the identity authentication process.
[0090] In a feasible implementation manner, the first signature information includes the first digital signature, the second public key, and the second identity of the first client;
[0091] The second client verifies the validity of the first signature information, which may include:
[0092] The second client generates a verification value according to the second public key and the second identity, and generates a third private key for determining the second client according to the verification value and the first digital signature;
[0093] Performing hash processing according to the third private key, the second identity identifier, and the second public key to obtain a second hash value;
[0094] The second hash value is compared with the first hash value. When the first hash value is the same as the second hash value, the first signature information is valid.
[0095] For example, user A receives user B's first digital signature σ1 and second public key K fed back by user B. B and the second identity D B ;
[0096] K A Substitute the following formula to get G T Elements in g1:
[0097] g1=e(K A , P pub ),
[0098] K ASubstitute g1 into the following formula to get G T The element t in:
[0099]
[0100] K B and D B Substitute the following calculation formula to obtain the verification value P:
[0101] P=[H1(D B ||0x01||N)]·P2+P pub ,
[0102] Determine the element S according to the first digital signature σ1, and obtain G according to the element S and the verification value P T The element u in:
[0103] u=e(k A ·S, P),
[0104] Substitute the elements u and t into the following formula to obtain the third private key ω′ of user A:
[0105] ω′=u·t,
[0106] Through H2 to ω′, D B and K B Perform hashing to obtain the second hash value h':
[0107] h′=H2(M||ω′||N), M=K B ||D A ,
[0108] If h=h' is satisfied, it is confirmed that the signature σ1 is generated by user B, the signature σ1 is valid, and the message M has not been tampered with.
[0109] It should be understood that when user A verifies that the first signature information is valid, user A generates a second signature σ1 through the above-mentioned signature generation process and sends it to user B, and user B verifies the validity of the second signature σ1 through the above-mentioned verification process, that is, the process of user A and user B generating signature information and the process of verifying the validity of signatures are completely the same.
[0110] In the disclosed implementation, the validity of the signature information is verified to ensure the integrity of the target information and the reliability of the source in the subsequent information interaction process, effectively preventing signature forgery or tampering. It is not limited by the information type and information interaction scenario in the information interaction process, and can exchange different types of information in different application scenarios, with wide applicability.
[0111] In a feasible implementation manner, the session key may be obtained in the following manner:
[0112] The first client generates a temporary public key calculation value of the second client according to the preset system public key and the first identity identifier of the second client;
[0113] The temporary public key calculation value is matched with the temporary public key actual value sent by the second client. When the temporary public key calculation value is equal to the temporary public key actual value, a session key is generated according to the first random number, the preset system public key and the preset first element group.
[0114] For example, after verifying the signature of user A, user B sends the system public key P pub 、User A's identity D A Substitute the following formula to get the temporary public key calculation formula Q of user A: A :
[0115] Q A ′=[H1(D A ∥0x01∥N)]·P1+ψP pub ,
[0116] Q A 'The actual value Q of the temporary public key sent by user A A Match, if Q A '=Q A , then select a random number r∈[1, N-1] and calculate G T Element C in:
[0117] C=e(P1,P pub ) r ,
[0118] Generate session key K based on element C session :
[0119] K session =H2(C∥M∥N).
[0120] In the embodiment of the present disclosure, the first client and the second client negotiate to obtain a shared session key. There is no need to store and manage complex digital certificates in the client, thereby simplifying key management. Information interaction is performed based on the session key, thereby enhancing the security and privacy of the information summarized during the interaction process.
[0121] In a feasible implementation manner, the first client encrypts the target information in sequence using the first number of the round keys according to the first arrangement order of the round keys to obtain ciphertext data corresponding to the target information, which may include:
[0122] The first client groups the plaintext data of the target information according to a preset byte length to obtain a second number of data groups to be encrypted;
[0123] For each of the to-be-encrypted data groups, encrypting the to-be-encrypted data group in sequence using the first number of the round keys according to the first arrangement order of the round keys to obtain an encrypted data group;
[0124] The encrypted data groups corresponding to the second number of the data to be encrypted are concatenated to obtain ciphertext data corresponding to the target information.
[0125] It is worth noting that the preset byte length can be preset according to the encryption processing duration. In the embodiment of the present disclosure, the preset byte length is 128 bits.
[0126] For example, user B divides the plaintext data M' of the target information into 128-bit data groups to be encrypted. If the bytes of the last group are less than 128 bits, appropriate padding is performed. And according to the session key K session Generate 32 round keys RK i , according to the 32 round keys RK i The first permutation order is through 32 round keys RK i The data groups to be encrypted are encrypted in sequence to obtain encrypted data groups.
[0127] In the disclosed embodiment, the plaintext data of the target information is grouped to obtain multiple groups of data to be encrypted. The target information of different byte lengths can be encrypted to meet the encryption requirements of data of different byte lengths, and each group of data to be encrypted is encrypted in turn by multiple round keys to shorten the encryption time, thereby improving the encryption efficiency.
[0128] In a feasible implementation manner, the encrypting the to-be-encrypted data group in sequence using the first number of the round keys according to the first arrangement order of the round keys to obtain the encrypted data group includes:
[0129] The first round key in the first arrangement sequence is combined with the data to be encrypted
[0130] Substitute into the round function to obtain the intermediate encrypted data group;
[0131] Using the intermediate encrypted data group as the to-be-encrypted data group corresponding to the next round key in the first arrangement sequence, and substituting the next round key and the to-be-encrypted data group corresponding to the next round key into the round function until the first number of round keys are all encrypted, and using the intermediate encrypted data group corresponding to the last round key in the first arrangement sequence as the encrypted data group;
[0132] Wherein, the round function includes:
[0133]
[0134] Among them, X i Represents the i-th group of data to be encrypted, RK i represents the i-th round key in the first permutation order, L t () represents the cyclic left shift function, and T represents the nonlinear replacement process.
[0135] For example, for j data groups to be encrypted [X1, X2, ..., X j ] is the i-th data group to be encrypted X i , j≥i. The first round key RK1 in the first arrangement order is combined with the i-th data group to be encrypted X i Substitute into the round function:
[0136]
[0137] Among them, the circular left shift function L t The specific calculation principle of () is:
[0138]
[0139] in, T′=S_Box(T), where S_Box represents a nonlinear permutation based on a preset permutation table (S-box).
[0140] Solve the round function to obtain the intermediate encrypted data group y1, use the intermediate encrypted data group y1 as the data group to be encrypted for the second round key RK2, and substitute RK2 and y1 into the round function until all 32 round keys are encrypted, and the 32nd round key RK 32 The corresponding intermediate encrypted data group y 32 As the i-th data group to be encrypted X i The corresponding encrypted data group Y i ;
[0141] Get j data groups to be encrypted [X1, X2, ..., X j ] corresponding to the encrypted data group [Y1, Y2, …, Y j ], the encrypted data group [Y1, Y2, ..., Y j ] are concatenated to obtain the ciphertext data C'.
[0142] It should be understood that user B encrypts the plaintext data M' of the target information to obtain the ciphertext data C', and sends the ciphertext data to user A. User A divides the received ciphertext data C' into 128-bit data groups to be decrypted, and uses the session key K session Generate 32 round keys RK i , according to the 32 round keys RKi The reverse order of the first arrangement order, through 32 round keys RK i The encrypted data groups are decrypted in turn to obtain the decrypted data groups. The decryption process of user A is similar to the encryption process of user B. The decrypted data group X is obtained by the following calculation formula i ′:
[0143] X i ′=F -1 (X i+1 ,R K33-j ),
[0144] j encrypted data groups [X1', X2', ..., X j '], and the encrypted data group [X1', X2', ..., X j '] are concatenated to obtain plaintext data M", and user A obtains the target information based on the plaintext data M".
[0145] In the disclosed embodiment, user B performs multiple rounds of encryption on the encrypted data group based on the round function, and user A performs multiple rounds of decryption based on the round keys in reverse order during the encryption process. The security of the algorithm is increased by nonlinear permutation during the round function encryption process, and the obfuscation of the algorithm is increased by linear transformation, making the encryption and decryption processes more complicated, thereby improving the security of the information interaction process.
[0146] Based on the same inventive concept, the present disclosure also provides an information interaction system, such as Figure 2 As shown, the system includes a first client 100 and a second client 200 .
[0147] The first client 100 is used to determine a first number of round keys according to the session key, and encrypt the target information in sequence according to the first arrangement order of each of the round keys using the first number of round keys to obtain ciphertext data corresponding to the target information, and send the ciphertext data to the second client 200. The session key is a key shared by the first client 100 and the second client 200 in information exchange.
[0148] The second client 200 is used to determine the first number of round keys according to the session key, and decrypt the ciphertext data in sequence using the first number of round keys according to a second arrangement order of each round key to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order.
[0149] In the disclosed embodiment, the first client encrypts the target information using a first number of round keys according to a first arrangement order of the round keys, and the second client decrypts the ciphertext data using the first number of round keys according to the inverse order of the first arrangement order of the round keys, thereby realizing symmetric encryption and decryption of information during information interaction, thereby reducing the amount of computation in the encryption and decryption processes, shortening the encryption and decryption time, and both the encryption and decryption processes are realized based on multiple round keys, thereby improving the strength of the keys during the information interaction process, and based on the complex encryption mechanism and the high-strength keys, making it difficult to crack the ciphertext, thereby improving the strong anti-attack capability during the information interaction process.
[0150] Furthermore, the first client 100 groups the plaintext data of the target information according to a preset byte length to obtain a second number of data groups to be encrypted;
[0151] For each of the to-be-encrypted data groups, encrypting the to-be-encrypted data group in sequence using the first number of the round keys according to the first arrangement order of the round keys to obtain an encrypted data group;
[0152] The encrypted data groups corresponding to the second number of the data to be encrypted are concatenated to obtain ciphertext data corresponding to the target information.
[0153] Further, the first client 100 substitutes the first round key in the first arrangement sequence and the data group to be encrypted into the round function to obtain an intermediate encrypted data group;
[0154] Using the intermediate encrypted data group as the to-be-encrypted data group corresponding to the next round key in the first arrangement sequence, and substituting the next round key and the to-be-encrypted data group corresponding to the next round key into the round function until the first number of round keys are all encrypted, and using the intermediate encrypted data group corresponding to the last round key in the first arrangement sequence as the encrypted data group;
[0155] Wherein, the round function includes:
[0156]
[0157] Among them, X i Represents the i-th group of data to be encrypted, RK i represents the i-th round key in the first permutation order, L t () represents the cyclic left shift function, and T represents the nonlinear replacement process.
[0158] Furthermore, the first client 100 generates a temporary public key calculation value of the second client 200 according to the preset system public key and the first identity identifier of the second client 200;
[0159] The temporary public key calculation value is matched with the temporary public key actual value sent by the second client 200. When the temporary public key calculation value is equal to the temporary public key actual value, a session key is generated according to the first random number, the preset system public key and the preset first element group.
[0160] Furthermore, the first client 100 and the second client 200 perform two-way identity authentication;
[0161] After the two-way identity authentication is passed, the first client 100 determines a first number of round keys according to the preset session key.
[0162] Further, the first client 100 receives the authentication request sent by the second client 200, generates first signature information according to the authentication request, and feeds back the first signature information to the second client;
[0163] The second client 200 verifies the validity of the first signature information, generates second signature information when the validity verification passes, and sends the second signature information to the first client 100;
[0164] The first client 100 performs validity verification on the second signature information. When the validity verification passes, the two-way identity authentication between the first client 100 and the second client 200 succeeds.
[0165] Further, the authentication request includes a first public key and a first identity identifier of the second client 200, and the first signature information includes a first digital signature;
[0166] The first client 100 performs bilinear pairing processing on the first public key to obtain a first private key of the second client 200;
[0167] Performing hash processing according to the first private key, the first identity identifier, and the second public key of the first client to obtain a first hash value;
[0168] A first digital signature is generated according to the first hash value, the second private key of the first client 100 and a preset correction factor.
[0169] Furthermore, the first signature information includes the first digital signature, the second public key and the second identity of the first client 100;
[0170] The second client 200 generates a verification value according to the second public key and the second identity, and generates a third private key for determining the second client 200 according to the verification value and the first digital signature;
[0171] Performing hash processing according to the third private key, the second identity identifier, and the second public key to obtain a second hash value;
[0172] The second hash value is compared with the first hash value. When the first hash value is the same as the second hash value, the first signature information is valid.
[0173] Regarding the information interaction system in the above embodiment, the specific manner in which the first client and the second client perform operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0174] Based on the same inventive concept, the present disclosure further provides an information interaction method, which is applied to a first client, and the method may include:
[0175] Determining a first number of round keys based on the session key;
[0176] According to the first arrangement order of each of the round keys, the target information is encrypted in sequence using the first number of the round keys to obtain ciphertext data corresponding to the target information, and the ciphertext data is sent to the second client so that the second client decrypts the ciphertext data to obtain the target information. The session key is a key shared by the first client and the second client in information exchange.
[0177] Regarding the above-mentioned information interaction method applied to the first client, the specific encryption process has been described in detail in the above-mentioned information interaction method, and will not be elaborated here.
[0178] Based on the same inventive concept, the present disclosure also provides an information interaction method, which is applied to a second client, and the method includes:
[0179] Receiving ciphertext data sent by a first client, where the ciphertext data is obtained by encrypting target information by using the first number of round keys according to a first arrangement sequence of the first number of round keys;
[0180] Determine the first number of the round keys according to the session key;
[0181] According to the second arrangement order of each of the round keys, the ciphertext data is decrypted in sequence using the second number of the round keys to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order, and the session key is a key shared by the client and the other client in information exchange.
[0182] Regarding the above-mentioned information interaction method applied to the second client, the specific encryption process has been described in detail in the above-mentioned information interaction method, and will not be elaborated here.
[0183] Based on the same inventive concept, the present disclosure also provides an electronic device, including:
[0184] a memory having a computer program stored thereon;
[0185] A processor is used to execute the computer program in the memory to implement the above-mentioned information interaction method applied to the first client or the information interaction method applied to the second client.
[0186] In the disclosed embodiment, the first client encrypts the target information using a first number of round keys according to a first arrangement order of the round keys, and the second client decrypts the ciphertext data using the first number of round keys according to the inverse order of the first arrangement order of the round keys, thereby realizing symmetric encryption and decryption of information during information interaction, thereby reducing the amount of computation in the encryption and decryption processes, shortening the encryption and decryption time, and both the encryption and decryption processes are realized based on multiple round keys, thereby improving the strength of the keys during the information interaction process, and based on the complex encryption mechanism and the high-strength keys, making it difficult to crack the ciphertext, thereby improving the strong anti-attack capability during the information interaction process.
[0187] Figure 3 FIG. 1 is a block diagram of an electronic device 300 according to an exemplary embodiment. Figure 3 As shown, the electronic device 300 may include: a processor 301 , a memory 302 . The electronic device 300 may also include one or more of a multimedia component 303 , an input / output (I / O) interface 304 , and a communication component 305 .
[0188] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps of the information interaction method applied to the first client or the information interaction method applied to the second client. The memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include instructions for any application or method used to operate on the electronic device 300, and application-related data, such as session keys, round keys, target information, ciphertext data, etc. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 303 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 302 or sent through the communication component 305. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 304 provides an interface between the processor 301 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 305 is used for wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 305 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0189] In an exemplary embodiment, the electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components, and is used for all or part of the steps of the above-mentioned information interaction method applied to the first client or the information interaction method applied to the second client.
[0190] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by the processor, all or part of the steps of the above-mentioned information interaction method applied to the first client or the information interaction method applied to the second client are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 302 including program instructions, and the above-mentioned program instructions can be executed by the processor 301 of the electronic device 300 to complete all or part of the steps of the above-mentioned information interaction method applied to the first client or the information interaction method applied to the second client.
[0191] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0192] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0193] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. An information interaction method, characterized in that: The method comprises: The first client determines a first number of round keys according to the session key, encrypts the target information in sequence using the first number of round keys according to a first arrangement order of the round keys, obtains ciphertext data corresponding to the target information, and sends the ciphertext data to the second client, wherein the session key is a key shared by the first client and the second client in information exchange; The second client determines the first number of round keys according to the session key, and decrypts the ciphertext data in sequence using the first number of round keys according to a second arrangement order of each round key to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order.
2. The information interaction method according to claim 1, characterized in that: The first client encrypts the target information in sequence using the first number of the round keys according to the first arrangement order of the round keys to obtain ciphertext data corresponding to the target information, including: The first client groups the plaintext data of the target information according to a preset byte length to obtain a second number of data groups to be encrypted; For each of the to-be-encrypted data groups, according to the first arrangement order of the round keys, the to-be-encrypted data group is sequentially encrypted using the first number of the round keys to obtain an encrypted data group; The encrypted data groups corresponding to the second number of the data to be encrypted are concatenated to obtain ciphertext data corresponding to the target information.
3. The information interaction method according to claim 2, characterized in that: The method of encrypting the to-be-encrypted data group in sequence using the first number of the round keys according to the first arrangement order of the round keys to obtain an encrypted data group includes: Substituting the first round key in the first arrangement sequence and the data group to be encrypted into the round function to obtain an intermediate encrypted data group; Using the intermediate encrypted data group as the to-be-encrypted data group corresponding to the next round key in the first arrangement sequence, and substituting the next round key and the to-be-encrypted data group corresponding to the next round key into the round function until the first number of round keys are all encrypted, and using the intermediate encrypted data group corresponding to the last round key in the first arrangement sequence as the encrypted data group; Wherein, the round function includes: F(X i ,RK i )=L t (T=X i ⊕PK i ); Among them, X i Represents the i-th group of data to be encrypted, RK i represents the i-th round key in the first permutation order, L t () represents the cyclic left shift function, and T represents the nonlinear replacement process.
4. The information interaction method according to claim 1, characterized in that: The session key is obtained by: The first client generates a temporary public key calculation value of the second client according to the preset system public key and the first identity identifier of the second client; The temporary public key calculation value is matched with the temporary public key actual value sent by the second client. When the temporary public key calculation value is equal to the temporary public key actual value, a session key is generated according to the first random number, the preset system public key and the preset first element group.
5. The information interaction method according to any one of claims 1 to 4, characterized in that: Before the first client determines the first number of round keys according to the session key, the method further includes: The first client and the second client perform two-way identity authentication; The first client determines a first number of round keys according to a preset session key, including: After the two-way identity authentication is passed, the first client determines a first number of round keys according to a preset session key.
6. The information interaction method according to claim 5, characterized in that: The first client and the second client perform two-way identity authentication, including: The first client receives the authentication request sent by the second client, generates first signature information according to the authentication request, and feeds back the first signature information to the second client; The second client verifies the validity of the first signature information, generates second signature information when the validity verification passes, and sends the second signature information to the first client; The first client verifies the validity of the second signature information. When the validity verification passes, the two-way identity authentication between the first client and the second client succeeds.
7. The information interaction method according to claim 6, characterized in that: The authentication request includes a first public key and a first identity identifier of the second client, and the first signature information includes a first digital signature; The first client generates first signature information according to the authentication request, including: The first client performs bilinear pairing processing on the first public key to obtain a first private key of the second client; Performing hash processing according to the first private key, the first identity identifier, and the second public key of the first client to obtain a first hash value; A first digital signature is generated according to the first hash value, the second private key of the first client, and a preset correction factor.
8. The information interaction method according to claim 7, characterized in that: The first signature information includes the first digital signature, the second public key, and the second identity of the first client; The second client verifies the validity of the first signature information, including: The second client generates a verification value according to the second public key and the second identity, and generates a third private key for determining the second client according to the verification value and the first digital signature; Performing hash processing according to the third private key, the second identity identifier, and the second public key to obtain a second hash value; The second hash value is compared with the first hash value. When the first hash value is the same as the second hash value, the first signature information is valid.
9. An information interaction system, characterized in that: The system comprises: The first client is configured to determine a first number of round keys according to the session key, encrypt the target information in sequence using the first number of round keys according to a first arrangement order of the round keys, obtain ciphertext data corresponding to the target information, and send the ciphertext data to the second client, wherein the session key is a key shared by the first client and the second client in information exchange; The second client is used to determine the first number of round keys according to the session key, and decrypt the ciphertext data in sequence using the first number of round keys according to a second arrangement order of each round key to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order.
10. An information interaction method, characterized in that: Applied to a first client, the method includes: Determining a first number of round keys based on the session key; According to the first arrangement order of each of the round keys, the target information is encrypted in sequence using the first number of the round keys to obtain ciphertext data corresponding to the target information, and the ciphertext data is sent to the second client so that the second client decrypts the ciphertext data to obtain the target information. The session key is a key shared by the first client and the second client in information exchange.
11. An information interaction method, characterized in that: Applied to the second client, the method includes: Receiving ciphertext data sent by a first client, where the ciphertext data is obtained by encrypting target information by using the first number of round keys according to a first arrangement sequence of the first number of round keys; Determine the first number of the round keys according to the session key; According to the second arrangement order of each of the round keys, the ciphertext data is decrypted in sequence using the second number of the round keys to obtain the target information, wherein the second arrangement order is the reverse order of the first arrangement order, and the session key is a key shared by the client and the other client in information exchange.
12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to claim 10 or 11 is implemented.
13. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the method of claim 10 or 11.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to claim 10 or 11 is implemented.