Key negotiation method, device, equipment, system and medium
The SM4 algorithm processes random numbers and local temporary keys, combined with device attribute parameters, solves the computational complexity problem of the SM2 and SM9 key exchange protocols on resource-constrained devices, and realizes an efficient and secure key negotiation process.
Patent Information
- Application Number
- CN202411110151.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-31
AI Technical Summary
The SM2 and SM9 key exchange protocols are complex and time-consuming to compute on resource-constrained devices, making it difficult to efficiently complete key negotiation.
The SM4 algorithm is used to process random numbers and local temporary keys, combined with device attribute parameters, and mutual authentication is carried out through multiple information interactions, and the shared key is finally calculated, which simplifies the key negotiation process and reduces resource requirements.
Lightweight key negotiation is realized, improving the efficiency and security of key negotiation, and is suitable for devices with limited resources.
Smart Images

Figure CN119232367A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a key negotiation method, device, equipment, system and medium. Background Art
[0002] In two-way communication, in order to ensure the security of data communication between the sender and the receiver, usually before data is transmitted between the sender and the receiver, the two ends will jointly negotiate to create a shared key, so as to ensure the security of subsequent two-way data transmission based on the shared key.
[0003] At present, when the sender and receiver negotiate to create a shared key, for national commercial encryption, the SM2 or SM9 key exchange protocol can be used to achieve the creation of a shared key. The SM2 key exchange protocol can satisfy the communication parties to go through two or three information transmission processes, and combine calculations to obtain a shared key jointly determined by both parties. The SM9 key exchange protocol allows the communication parties to calculate and obtain a shared private key jointly determined by both parties through two or three optional information transmission processes using the other party's identification and their own private key.
[0004] However, since the implementation of SM2 and SM9 key exchange protocols are both based on elliptic curve calculations, the calculations are complex and time-consuming for resource-constrained devices. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a key negotiation method, apparatus, device, system and medium, which are used to at least partially solve the above technical problems.
[0006] In order to achieve the above-mentioned purpose, an embodiment of the present invention provides a key negotiation method, which is used to implement a shared key negotiation between a sending end device and a receiving end device and is applied to the sending end device. The key negotiation method includes: using the SM4 algorithm to process a first random number, a local temporary key, and an attribute parameter for the sending end device and the receiving end device to obtain a first confirmation value; sending the first confirmation value to the receiving end device; obtaining a second confirmation value obtained by the receiving end device using the SM4 algorithm to process a second random number, the local temporary key, and the attribute parameter; sending the first random number to the receiving end device so that the receiving end device: uses the SM4 algorithm to process the first random number, the local temporary key, and the attribute parameter to obtain a first verification value; and checks whether the first verification value is the same as the first confirmation value; when the receiving end device determines that the first verification value is the same as the first confirmation value, receiving the second random number sent by the receiving end device; using the SM4 algorithm to process the second random number, the local temporary key, and the attribute parameter to obtain a second verification value; checking whether the second verification value is the same as the second confirmation value; and when it is determined that the second verification value is the same as the second confirmation value, using the SM4 algorithm to process the local temporary key, the first random number, and the second random number to obtain a shared key.
[0007] Optionally, the local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
[0008] Optionally, the attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
[0009] On the other hand, an embodiment of the present invention also provides a key negotiation method for realizing shared key negotiation between a sending device and a receiving device, and is applied to the receiving device. The key negotiation method includes: using the SM4 algorithm to process a second random number, a local temporary key, and attribute parameters for the sending device and the receiving device to obtain a second confirmation value; obtaining a first confirmation value obtained by the sending device using the SM4 algorithm to process a first random number, the local temporary key, and the attribute parameter; sending the second confirmation value to the sending device; receiving the first random number sent by the sending device; using the SM4 algorithm to process the first random number, the local temporary key, and the attribute parameter to obtain a first verification value, and checking whether the first verification value is the same as the first confirmation value; and when it is determined that the first verification value is the same as the first confirmation value, sending the second random number to the sending device, and using the SM4 algorithm to process the local temporary key, the first random number, and the second random number to obtain a shared key.
[0010] Optionally, the local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
[0011] Optionally, the attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
[0012] On the other hand, an embodiment of the present invention further provides a key negotiation device, which is used to implement a shared key negotiation between a sending device and a receiving device, and is applied to the sending device. The key negotiation device includes: a first processing module, which is configured to use the SM4 algorithm to process a first random number, a local temporary key, and attribute parameters for the sending device and the receiving device to obtain a first confirmation value; and a first transmission module. The first transmission module is configured to: send the first confirmation value to the receiving device; obtain the second confirmation value obtained by the receiving device using the SM4 algorithm to process a second random number, the local temporary key, and the attribute parameters; send the first random number to the receiving device, so that the receiving device uses the SM4 algorithm to process the first random number, the local temporary key, and the attribute parameters to obtain a first verification value, and check whether the first verification value is the same as the first confirmation value; and receive the second random number sent by the receiving device when the receiving device determines that the first verification value is the same as the first confirmation value.
[0013] Among them, the first processing module is also configured to: use the SM4 algorithm to process the second random number, the local temporary key and the attribute parameter to obtain a second verification value; check whether the second verification value is the same as the second confirmation value; and when it is determined that the second verification value is the same as the second confirmation value, use the SM4 algorithm to process the local temporary key, the first random number and the second random number to obtain a shared key.
[0014] Optionally, the local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
[0015] Optionally, the attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
[0016] On the other hand, an embodiment of the present invention further provides a key negotiation device, which is used to implement shared key negotiation between a sending device and a receiving device, and is applied to the receiving device. The key negotiation device includes: a second processing module, which is configured to use the SM4 algorithm to process a second random number, a local temporary key, and attribute parameters for the sending device and the receiving device to obtain a second confirmation value; and a second transmission module. The second transmission module is configured to: obtain a first confirmation value obtained by the sending device using the SM4 algorithm to process a first random number, the local temporary key, and the attribute parameters; send the second confirmation value to the sending device; and receive the first random number sent by the sending device.
[0017] The second processing module is further configured to use the SM4 algorithm to process the first random number, the local temporary key and the attribute parameter to obtain a first verification value, and to verify whether the first verification value is the same as the first confirmation value.
[0018] Among them, when it is determined that the first verification value is the same as the first confirmation value, the second transmission module is also configured to send the second random number to the sending device, and the second processing module is also configured to use the SM4 algorithm to process the local temporary key, the first random number and the second random number to obtain a shared key.
[0019] Optionally, the local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
[0020] Optionally, the attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
[0021] On the other hand, an embodiment of the present invention also provides a sending end device, comprising: a memory storing a program or program unit that can be run on a processor; and the processor, which is configured to implement any of the above-mentioned key negotiation methods when executing the program, or to implement the functions of the various modules included in any of the above-mentioned key negotiation devices when executing the program unit.
[0022] On the other hand, an embodiment of the present invention also provides a receiving device, comprising: a memory storing a program or program unit that can be run on a processor; and the processor, which is configured to implement any of the above-mentioned key negotiation methods when executing the program, or to implement the functions of the various modules included in any of the above-mentioned key negotiation devices when executing the program unit.
[0023] On the other hand, an embodiment of the present invention further provides a communication system, comprising: any of the above-mentioned transmitting end devices; and any of the above-mentioned receiving end devices.
[0024] On the other hand, an embodiment of the present invention further provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute any of the above-mentioned key negotiation methods.
[0025] Through the above technical scheme, the embodiment of the present invention is based on a local temporary key and two information interaction processes. After the two parties have authenticated each other, each party uses the SM4 algorithm to calculate a shared key. The entire key negotiation process uses the SM4 algorithm, which is simple to calculate and has low resource requirements. It can efficiently complete key negotiation and realize lightweight key negotiation.
[0026] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0028] Figure 1 is a flow chart of a key negotiation method according to a first embodiment of the present invention;
[0029] Figure 2 is an information interaction diagram between a transmitting end device and a receiving end device in an example of an embodiment of the present invention;
[0030] Figure 3 is a flowchart of a key negotiation method according to a second embodiment of the present invention;
[0031] Figure 4is a structural diagram of a key agreement device according to Embodiment 3 of the present invention;
[0032] Figure 5 is a structural diagram of a key agreement device according to a fourth embodiment of the present invention;
[0033] Figure 6 A schematic diagram of the structure of a transmitting end device or a receiving end device according to an embodiment of the present invention; and
[0034] Figure 7 It is a schematic diagram of the structure of a communication system according to an embodiment of the present invention.
[0035] Description of Reference Numerals
[0036] 110, a first processing module; 120, a first transmission module;
[0037] 210, second processing module; 220, second transmission module. DETAILED DESCRIPTION
[0038] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0039] The main idea of the embodiment of the present invention is: considering whether a more lightweight algorithm can be adopted in view of the defects of the SM2 and SM9 key exchange protocols mentioned in the background technology. Accordingly, the inventors of the present application considered whether the SM4 cryptographic algorithm can be applied in the process of implementing the present application. The SM4 cryptographic algorithm is a block algorithm with a block length of 128 bits and a key length of 128 bits. Both the encryption algorithm and the key expansion algorithm adopt a 32-round nonlinear iterative structure. The algorithm structure of data decryption and data encryption is the same, except that the order of use of the round keys is opposite. The decryption round key is the reverse order of the encryption round key, which is a lightweight cryptographic algorithm. SM4 encrypts and decrypts data based on the negotiated key. Compared with SM2 and SM9, the algorithm calculation is simple, but SM4 itself does not have a key negotiation function. In this way, the embodiment of the present invention further considers how to implement key negotiation based on the SM4 algorithm.
[0040] Embodiment 1
[0041] Figure 1 1 is a flowchart of a key negotiation method according to a first embodiment of the present invention. The key negotiation method is used to implement a shared key negotiation between a sending end device and a receiving end device, and is applied to the sending end device. Figure 1 As shown, the key negotiation method includes the following steps:
[0042] Step S101: Use the SM4 algorithm to process a first random number, a local temporary key, and attribute parameters for the sending device and the receiving device to obtain a first confirmation value.
[0043] The attribute parameters include characteristic attribute values and identity identifiers of the transmitting device and the receiving device, respectively, which are known to the corresponding devices.
[0044] The local temporary key is a shared password negotiated between the sending device and the receiving device (hereinafter referred to as the two-end device) through a key negotiation channel or an out-of-band channel. That is, the local temporary key belongs to a shared password agreed upon in advance by the sending device and the receiving device, and is known to the two-end devices before the key negotiation method of the embodiment of the present invention is executed.
[0045] Step S102: sending the first confirmation value to the receiving device.
[0046] Step S103, obtaining a second confirmation value obtained by the receiving device using the SM4 algorithm to process the second random number, the local temporary key and the attribute parameter.
[0047] Step S104: Send the first random number to the receiving device.
[0048] After receiving the first random number, the receiving device uses the SM4 algorithm to process the first random number, the local temporary key and the attribute parameter to obtain a first verification value, and checks whether the first verification value is the same as the first confirmation value.
[0049] It should be noted that in the embodiment of the present invention, the check value and the confirmation value are corresponding concepts. The confirmation value is obtained by one of the sending device and the receiving device using a cryptographic algorithm to process the specified data, while the check value is obtained by the other end using the same cryptographic algorithm to process the same data. If the two are the same, it means that the devices at both ends are safe and reliable, and the negotiation of the shared key can continue. If the two are different, it means that there may be an impersonated third-party device, and the negotiation of the shared key should be terminated immediately. For step S104, if the first check value is different from the first confirmation value, it may be that the local temporary keys (shared passwords) of the devices at both ends are inconsistent, and the first random number received by the receiving device is incorrect, which indicates that there may be an impersonated third-party device.
[0050] Step S105: When the receiving end device determines that the first verification value is the same as the first confirmation value, receiving the second random number sent by the receiving end device.
[0051] Step S106: Use the SM4 algorithm to process the second random number, the local temporary key and the attribute parameter to obtain a second verification value.
[0052] Step S107, checking whether the second verification value is the same as the second confirmation value.
[0053] Step S108, when it is determined that the second verification value is the same as the second confirmation value, the local temporary key, the first random number and the second random number are processed using the SM4 algorithm to obtain a shared key.
[0054] Regarding steps S101-S108, the following is a specific introduction through examples. Figure 1 Implementation of the key negotiation method. Figure 2 is an information interaction diagram between a transmitting end device and a receiving end device in an example of an embodiment of the present invention. Figure 2 As shown, in this example, for the sending end device, the following steps may be specifically included:
[0055] Step S11, generating a first random number N by a random number generator A .
[0056] Among them, the first random number N A The length of is, for example, 16 bytes. It should be noted that, in this example, subscript A represents a transmitting device, and subscript B represents a receiving device, and the following is understood in this way and will not be repeated.
[0057] Step S12: Based on the local temporary key TK and the first random number N A , the characteristic attribute values Ch of both parties in communication A , Ch B and ID A 、ID B Calculate the first confirmation value C A .
[0058] For example, the specific calculation formula is:
[0059] C A =SM4(TK,SM4(TK, N A ⊕Ch A ⊕Ch B )⊕ID A ⊕ID B ) (1)
[0060] Among them, SM4() indicates that the SM4 algorithm is used for calculation. When the relevant data and calculation logic are known, the application of the SM4 algorithm is well known to those skilled in the art, so it will not be described in detail here.
[0061] Step S13: Send the calculated first confirmation value C to the receiving device. A .
[0062] Here, the receiving device receives the first confirmation value C A Before that, steps S21-S23 similar to the above steps S11-S13 are performed on the receiving end device, so that the sending end device receives the corresponding second confirmation value C B This will be described in detail in Example 2 and will not be described in detail here.
[0063] Step S14, in response to receiving a second confirmation value C from the receiving device B , sending a first random number N to the receiving device A .
[0064] Here, the receiving device receives the first random number N A Then, the formula (1) is used to calculate the value corresponding to the first confirmation value C A The first check value C′ A , and then verify whether the two are the same to decide whether to feedback the second random number N to the sending device B This corresponds to steps S24-S25, which will be described in detail in the second embodiment and will not be described again here.
[0065] Step S15, in response to receiving a second random number N from the receiving device B , based on the local temporary key TK, the second random number N B and the above attribute parameters, calculate the second check value C′ B .
[0066] For example, the specific calculation formula is:
[0067] C′ B =SM4(TK,SM4(TK,N B ⊕Ch A ⊕Ch B )⊕ID A ⊕ID B ) (2)
[0068] Step S16, verify the second check value C' B Is it equal to the second confirmation value C? B If they are different, the negotiation fails and the process ends; otherwise, continue to step S17.
[0069] Step S17, calculating the shared key K.
[0070] For example, the specific calculation formula is:
[0071] K=SM4(TK,N A ⊕N B ) (3)
[0072] In this way, key negotiation is successful and K is the shared key.
[0073] Through this example, it can be seen that the key negotiation algorithm provided in the first embodiment of the present invention is applied to the sending end device, which enables the sending end to always use the SM4 algorithm to negotiate keys with the receiving end. The calculation is simple, and based on a shared password, mutual authentication is completed with the receiving end in two information interaction processes with a smaller number of times, thereby ensuring the security of information transmission during the key negotiation process.
[0074] Embodiment 2
[0075] Figure 3 1 is a flow chart of a key negotiation method according to a second embodiment of the present invention. The key negotiation method is used to implement a shared key negotiation between a transmitting device and a receiving device, and is applied to the receiving device. Figure 3 As shown, the key negotiation method includes the following steps:
[0076] Step S201: Use the SM4 algorithm to process the second random number, the local temporary key, and the attribute parameters for the sending device and the receiving device to obtain a second confirmation value.
[0077] Step S202: Obtain a first confirmation value obtained by the sending device using an SM4 algorithm to process a first random number, the local temporary key, and the attribute parameter.
[0078] Step S203: Send the second confirmation value to the sending end device.
[0079] Step S204: receiving the first random number sent by the sending device.
[0080] Step S205: Use the SM4 algorithm to process the first random number, the local temporary key and the attribute parameter to obtain a first verification value.
[0081] Step S206, checking whether the first verification value is the same as the first confirmation value.
[0082] Step S207: When it is determined that the first check value is the same as the first confirmation value, sending the second random number to the sending end device;
[0083] Step S208: Use the SM4 algorithm to process the local temporary key, the first random number and the second random number to obtain a shared key.
[0084] For steps S201 - S208 , the meanings of the parameters involved may refer to the above-mentioned embodiment 1, and will not be described in detail here.
[0085] Continue below Figure 2 The key negotiation method applied to the receiving device is introduced as an example. Figure 2 As shown, in this example, for the receiving end device, the following steps may be specifically included:
[0086] Step S21, generating a second random number N by a random number generator B .
[0087] Among them, the second random number N B The length is 16 bytes.
[0088] Step S22: Based on the local temporary key TK and the second random number N B , the characteristic attribute values Ch of both parties in communication A , Ch B and ID A 、ID B Calculate the second confirmation value C B .
[0089] For example, the specific calculation formula is:
[0090] C B =SM4(TK, SM4(TK, N B ⊕Ch A ⊕Ch B )⊕ID A ⊕ID B ) (4)
[0091] Step S23, sending a second confirmation value C to the sending end device B .
[0092] Step S24, after obtaining the first random number N in step S14 A Afterwards, based on the local temporary key TK and the first random number N A and the above attribute parameters, calculate the first check value C′ A .
[0093] For example, the specific calculation formula is:
[0094] C′ A =SM4(TK, SM4(TK, N A ⊕Ch A ⊕Ch B )⊕ID A ⊕ID B ) (5)
[0095] Step S25, verify the first check value C' A Is it equal to the first confirmation value C? A If they are different, the negotiation fails and the process ends; otherwise, continue to step S26.
[0096] Step S26, sending a second random number N to the sending end device B , thereby enabling the sending end device to execute step S15 as described above.
[0097] Step S27, calculate the shared key K. For example, refer to the above formula (3) for calculation.
[0098] In this way, key negotiation is successful and K is the shared key.
[0099] Through this example, it can be seen that the key negotiation algorithm provided in the second embodiment of the present invention is applied to the receiving end device, which enables the receiving end to always use the SM4 algorithm to negotiate keys with the sending end. The calculation is simple, and based on a shared password, mutual authentication is completed with the sending end in two information interaction processes with a smaller number of times, thereby ensuring the security of information transmission during the key negotiation process.
[0100] Based on the above-mentioned embodiment 1 and embodiment 2, refer to Figure 2 From the example, it can be seen that the embodiment of the present invention is based on a shared password and two information exchange processes. After the two parties have authenticated each other, they each use the SM4 algorithm to calculate a shared key. The entire key negotiation process uses the SM4 algorithm without other complex calculations. Compared with the SM2 algorithm and the SM9 algorithm, the SM4 algorithm is simple to calculate and has low resource requirements. Therefore, it can efficiently complete key negotiation and key calculation, and realize a lightweight key negotiation solution.
[0101] In addition, from the overall analysis of steps S11-S17 executed at the sending end and steps S21-S27 executed at the receiving end, it can be seen that before the two communicating parties actually calculate the shared key, they go through two information exchange processes based on a shared password to complete their respective authentication of the other party's device, thereby ensuring the correctness of the identities of the sending and receiving ends, and providing a guarantee for the security of subsequent keys. Once the authentication process of either party fails, it means that there may be an impersonating third-party device, and the dangerous third-party device can be discovered early and the negotiation of the shared key can be terminated, avoiding the possibility of the subsequent shared key being stolen by a third-party device.
[0102] Embodiment 3
[0103] Figure 41 is a schematic diagram of the structure of a key negotiation device according to Embodiment 3 of the present invention, which is used to implement a shared key negotiation between a sending end device and a receiving end device and is applied to the sending end device. Moreover, the key negotiation device and the key negotiation method according to Embodiment 1 are based on the same inventive idea.
[0104] like Figure 4 As shown, the key negotiation device includes a first processing module 110 and a first transmission module 120, which are implemented by a processor chip and a wireless communication module, for example, respectively. The first processing module 110 is configured to use the SM4 algorithm to process the first random number, the local temporary key, and the attribute parameters for the sending device and the receiving device to obtain a first confirmation value. The first transmission module is configured to: send the first confirmation value to the receiving device; obtain the second confirmation value obtained by the receiving device using the SM4 algorithm to process the second random number, the local temporary key, and the attribute parameters; send the first random number to the receiving device, so that the receiving device uses the SM4 algorithm to process the first random number, the local temporary key, and the attribute parameters to obtain a first verification value, and check whether the first verification value is the same as the first confirmation value; and when the receiving device determines that the first verification value is the same as the first confirmation value, receive the second random number sent by the receiving device;
[0105] Furthermore, the first processing module 110 is also configured to: use the SM4 algorithm to process the second random number, the local temporary key and the attribute parameter to obtain a second verification value; check whether the second verification value is the same as the second confirmation value; and when it is determined that the second verification value is the same as the second confirmation value, use the SM4 algorithm to process the local temporary key, the first random number and the second random number to obtain a shared key.
[0106] For more implementation details and effects of the key agreement device of the third embodiment, reference may be made to the first embodiment, which will not be described in detail here.
[0107] Embodiment 4
[0108] Figure 5 1 is a schematic diagram of the structure of a key negotiation device according to Embodiment 4 of the present invention, which is used to implement a shared key negotiation between a sending device and a receiving device and is applied to the receiving device. Moreover, the key negotiation device and the key negotiation method according to Embodiment 2 are based on the same inventive idea.
[0109] like Figure 5As shown, the key agreement device includes a second processing module 210 and a second transmission module 220, which are implemented by a processor chip and a wireless communication module, for example. The second processing module 210 is configured to use the SM4 algorithm to process the second random number, the local temporary key, and the attribute parameters for the sending device and the receiving device to obtain a second confirmation value; the second transmission module 220 is configured to: obtain the first confirmation value obtained by the sending device using the SM4 algorithm to process the first random number, the local temporary key, and the attribute parameters; send the second confirmation value to the sending device; and receive the first random number sent by the sending device.
[0110] Furthermore, the second processing module 210 is also configured to use an SM4 algorithm to process the first random number, the local temporary key and the attribute parameter to obtain a first verification value, and to verify whether the first verification value is the same as the first confirmation value.
[0111] Moreover, when it is determined that the first verification value is the same as the first confirmation value, the second transmission module 220 is also configured to send the second random number to the sending device, and the second processing module is also configured to use the SM4 algorithm to process the local temporary key, the first random number and the second random number to obtain a shared key.
[0112] For more implementation details and effects of the key agreement device of the fourth embodiment, reference may be made to the second embodiment, which will not be described in detail here.
[0113] Embodiment 5
[0114] like Figure 6 As shown, an embodiment of the present invention also provides a sending end device, comprising: a memory, which stores a program or program unit that can be run on a processor; and the processor, which is configured to implement the key negotiation method described in the above-mentioned embodiment one when executing the program, or to implement the functions of each module included in the key negotiation device described in the above-mentioned embodiment three when executing the program unit.
[0115] In the key agreement device described in the third embodiment, the first processing module 110 and the first transmission module 120 are stored in the memory as program units.
[0116] The processor includes a kernel, which retrieves the corresponding program or program unit from the memory. One or more kernels can be set, and key negotiation is achieved by adjusting kernel parameters.
[0117] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0118] In addition, the transmitting end device implemented in the fifth embodiment, such as a base station device, includes a base station server and the like.
[0119] For more implementation details and effects of the fifth embodiment, please refer to the aforementioned embodiments, which will not be described in detail here.
[0120] Embodiment 6
[0121] Likewise Figure 6 As shown, an embodiment of the present invention also provides a receiving device, including: a memory, which stores a program or program unit that can be run on a processor; and the processor, which is configured to implement the key negotiation method described in the above-mentioned embodiment 2 when executing the program, or to implement the functions of each module included in the key negotiation device described in the above-mentioned embodiment 4 when executing the program unit.
[0122] The second processing module 210 and the second transmission module 220 in the key agreement device described in the fourth embodiment are stored in the memory as program units.
[0123] In addition, the receiving end device implemented in the sixth embodiment, such as a terminal device, includes a server, a PC, a PAD, a mobile phone, etc.
[0124] For more implementation details and effects of the sixth embodiment, please refer to the aforementioned embodiments, which will not be described in detail here.
[0125] Embodiment 7
[0126] like Figure 7 As shown, an embodiment of the present invention further provides a communication system, comprising the sending end device described in the fifth embodiment and the receiving end device described in the sixth embodiment, wherein the sending end device and the receiving end device communicate with each other.
[0127] For example, the communication system is a two-terminal system for realizing communication between a base station device and a terminal device, and the information exchange for key negotiation between the devices can refer to Figure 2 To understand.
[0128] For more implementation details and effects of the seventh embodiment, please refer to the aforementioned embodiments, which will not be described in detail here.
[0129] An embodiment of the present invention provides a machine-readable storage medium on which instructions are stored. When the instructions are executed by a processor, any of the above-mentioned key negotiation methods is implemented.
[0130] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes any of the above-mentioned key negotiation methods when running.
[0131] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing steps corresponding to any of the above-mentioned key negotiation methods.
[0132] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0134] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0136] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0137] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0138] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0139] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0140] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A key negotiation method, characterized in that: The method is used to implement shared key negotiation between a sending end device and a receiving end device, and is applied to the sending end device. The key negotiation method includes: Using an SM4 algorithm to process a first random number, a local temporary key, and attribute parameters for the sending end device and the receiving end device to obtain a first confirmation value; Sending the first confirmation value to the receiving end device; Obtaining a second confirmation value obtained by the receiving end device using the SM4 algorithm to process a second random number, the local temporary key, and the attribute parameter; Sending the first random number to the receiving device so that the receiving device: processes the first random number, the local temporary key and the attribute parameter using an SM4 algorithm to obtain a first check value; and verifies whether the first check value is the same as the first confirmation value; When the receiving end device determines that the first check value is the same as the first confirmation value, receiving the second random number sent by the receiving end device; Processing the second random number, the local temporary key and the attribute parameter using the SM4 algorithm to obtain a second verification value; checking whether the second check value is the same as the second confirmation value; and When it is determined that the second verification value is the same as the second confirmation value, the local temporary key, the first random number and the second random number are processed using the SM4 algorithm to obtain a shared key.
2. The key negotiation method according to claim 1, characterized in that: The local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
3. The key negotiation method according to claim 1, characterized in that: The attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
4. A key negotiation method, characterized in that: The method is used to implement shared key negotiation between a transmitting device and a receiving device, and is applied to the receiving device. The key negotiation method includes: Using the SM4 algorithm to process the second random number, the local temporary key, and the attribute parameters for the sending end device and the receiving end device to obtain a second confirmation value; Obtaining a first confirmation value obtained by the sending end device using an SM4 algorithm to process a first random number, the local temporary key, and the attribute parameter; Sending the second confirmation value to the sending end device; Receiving the first random number sent by the sending end device; Processing the first random number, the local temporary key, and the attribute parameter using an SM4 algorithm to obtain a first check value, and verifying whether the first check value is the same as the first confirmation value; and When it is determined that the first verification value is the same as the first confirmation value, the second random number is sent to the sending end device, and the local temporary key, the first random number and the second random number are processed using the SM4 algorithm to obtain a shared key.
5. The key negotiation method according to claim 4, characterized in that: The local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
6. The key negotiation method according to claim 4, characterized in that: The attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
7. A key agreement device, characterized in that: The key negotiation device is used to implement a shared key negotiation between a sending end device and a receiving end device, and is applied to the sending end device. The key negotiation device includes: A first processing module is configured to use an SM4 algorithm to process a first random number, a local temporary key, and attribute parameters for the sending end device and the receiving end device to obtain a first confirmation value; and The first transmission module is configured as follows: Sending the first confirmation value to the receiving end device; Obtaining a second confirmation value obtained by the receiving end device using the SM4 algorithm to process a second random number, the local temporary key, and the attribute parameter; Sending the first random number to the receiving device, so that the receiving device uses an SM4 algorithm to process the first random number, the local temporary key, and the attribute parameter to obtain a first verification value, and checking whether the first verification value is the same as the first confirmation value; and When the receiving end device determines that the first check value is the same as the first confirmation value, receiving the second random number sent by the receiving end device; Wherein, the first processing module is further configured to: Processing the second random number, the local temporary key and the attribute parameter using the SM4 algorithm to obtain a second verification value; checking whether the second check value is the same as the second confirmation value; and When it is determined that the second verification value is the same as the second confirmation value, the local temporary key, the first random number and the second random number are processed using the SM4 algorithm to obtain a shared key.
8. The key agreement device according to claim 7, characterized in that: The local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
9. The key agreement device according to claim 7, characterized in that: The attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
10. A key agreement device, characterized in that: The key negotiation device is used to implement a shared key negotiation between a sending end device and a receiving end device, and is applied to the receiving end device. The key negotiation device includes: A second processing module is configured to use an SM4 algorithm to process a second random number, a local temporary key, and attribute parameters for the sending end device and the receiving end device to obtain a second confirmation value; and The second transmission module is configured as follows: Obtaining a first confirmation value obtained by the sending end device using an SM4 algorithm to process a first random number, the local temporary key, and the attribute parameter; sending the second confirmation value to the transmitting end device; and Receiving the first random number sent by the sending end device; The second processing module is further configured to process the first random number, the local temporary key and the attribute parameter using an SM4 algorithm to obtain a first check value, and to verify whether the first check value is the same as the first confirmation value; and Moreover, when it is determined that the first verification value is the same as the first confirmation value, the second transmission module is also configured to send the second random number to the sending device, and the second processing module is also configured to use the SM4 algorithm to process the local temporary key, the first random number and the second random number to obtain a shared key.
11. The key agreement device according to claim 10, characterized in that: The local temporary key is a shared password negotiated between the sending device and the receiving device through a key negotiation channel or an out-of-band channel.
12. The key agreement device according to claim 11, characterized in that: The attribute parameters include characteristic attribute values and identity identifiers of the sending device and the receiving device, respectively.
13. A transmitting end device, characterized in that: include: A memory storing a program or a program unit that can be executed on the processor; as well as The processor is configured to implement the key negotiation method described in any one of claims 1 to 3 when executing the program, or to implement the functions of each module included in the key negotiation device described in any one of claims 7 to 9 when executing the program unit.
14. A receiving device, characterized in that: include: A memory storing a program or a program unit that can be executed on the processor; as well as The processor is configured to implement the key negotiation method described in any one of claims 4 to 6 when executing the program, or to implement the functions of each module included in the key negotiation device described in any one of claims 10 to 12 when executing the program unit.
15. A communication system, characterized in that: include: The transmitting end device as claimed in claim 13; as well as The receiving device as claimed in claim 14.
16. A machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the key negotiation method described in any one of claims 1 to 3 or the key negotiation method described in any one of claims 4 to 6.
