Key negotiation method, apparatus, and system
By informing the receiving device of all supported key negotiation algorithms, the method improves IKEv2 efficiency by ensuring compatible algorithm selection, reducing negotiation failures and packet exchanges.
Patent Information
- Application Number
- JP2024125889
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The IKEv2 negotiation process in IPsec tunnels results in low key negotiation efficiency due to increased packet exchanges when the sending and receiving devices select key negotiation algorithms that do not match, leading to negotiation failures.
A method where the sending device informs the receiving device of all supported key negotiation algorithms, allowing the receiving device to select an algorithm that is common to both, thereby reducing the need for retransmissions and improving efficiency.
This approach enhances key negotiation efficiency by ensuring that the selected algorithm is supported by both devices, minimizing packet exchanges and reducing negotiation failures.
Smart Images

Figure 2024153865000001_ABST
Abstract
Description
[Technical field]
[0001] The present application relates to the field of communication technologies, in particular to a key negotiation method, apparatus and system, which may be specifically applied to short-range communications, e.g., cockpit domain communications. [Background technology]
[0002] Internet Key Exchange Version 2 (IKEv2) is a protocol used to negotiate keys and may be used to negotiate parameters such as security protocols, algorithms, and keys for Internet Protocol Security (IPsec) tunnels.
[0003] The IKEv2 negotiation process may be as follows: A negotiation packet sent by a sending device to a receiving device includes at least one key negotiation algorithm supported by the sending device and a key negotiation parameter of one key negotiation algorithm corresponding to the sending device. After receiving the negotiation packet, the receiving device selects a key negotiation algorithm supported by the receiving device from the key negotiation algorithms included in the negotiation packet. If the key negotiation parameter of the sending device included in the negotiation packet does not correspond to the key negotiation algorithm selected by the receiving device, the receiving device sends a packet including a key negotiation algorithm supported by the receiving device to the sending device, and then the sending device resends the negotiation packet based on the key negotiation algorithm supported by the receiving device. As a result, the number of packet exchanges between the sending device and the receiving device increases, resulting in low key negotiation efficiency. Summary of the Invention
[0004] SUMMARY OF THE DISCLOSURE The embodiments of the present application provide a key negotiation method, apparatus, and system for improving key negotiation efficiency.
[0005] According to a first aspect, an embodiment of the present application comprises: transmitting first information, where the first information is used to indicate N key negotiation algorithms, N being an integer equal to or greater than 1, and the N key negotiation algorithms are algorithms supported by the sending device; receiving second information from the receiving device, the second information being used to indicate a targeted key negotiation algorithm and including a first key negotiation parameter, the targeted key negotiation algorithm being a key negotiation algorithm among the N key negotiation algorithms supported by the receiving device, the first key negotiation parameter being a key negotiation parameter corresponding to the receiving device and obtained based on the targeted key negotiation algorithm, or the first key negotiation parameter being a key negotiation parameter generated by the receiving device based on the targeted key negotiation algorithm; generating a target key based on the target key negotiation algorithm and the first key negotiation parameters; The present invention provides a method for key negotiation, comprising:
[0006] In a possible design, the method includes: sending third information to the receiving device, the third information including second key negotiation parameters, the second key negotiation parameters corresponding to the sending device and obtained based on a target key negotiation algorithm; Further includes:
[0007] In a possible design, the step of transmitting the third information to the receiving device comprises: Sending the third information, which has been processed by using an integrity protection algorithm, to a receiving device. Includes.
[0008] In a possible design, the first information is further used to indicate priority information of the N key negotiation algorithms; The first information includes identification information of the N key negotiation algorithms, the identification information being arranged or encapsulated based on priority information of the N key negotiation algorithms.
[0009] In a possible design, the second information may be further used to indicate M key negotiation algorithms supported by the receiving device, where M is an integer greater than or equal to 1.
[0010] In one possible design, the step of generating a target key based on a target key negotiation algorithm and the first key negotiation parameters includes: determining that the target key negotiation algorithm is a key negotiation algorithm having a highest priority among the N key negotiation algorithms supported by the receiving device; generating a target key based on the target key negotiation algorithm and the first key negotiation parameters; Includes.
[0011] Alternatively, in a possible design, the target key negotiation algorithm is the key negotiation algorithm that has the highest priority among the N key negotiation algorithms supported by the receiving device.
[0012] In a possible design, the method includes: receiving priority information of the M key negotiation algorithms from a receiving device; Further includes:
[0013] In a possible design, the second information is further used to indicate priority information of the M key negotiation algorithms supported by the receiving device; The second information includes identification information of the M key negotiation algorithms, the identification information being arranged or encapsulated based on a priority of the M key negotiation algorithms.
[0014] In a possible design, the third information further includes first authentication data, the first authentication data being authentication data obtained after the sending device performs an authentication process on the second information. Alternatively, in a possible design, the method further includes a step of transmitting the first authentication data to the receiving device, the first authentication data being authentication data obtained after the sending device performs an authentication process on the second information. The first authentication data may be indicated by using the third information, or may be indicated or conveyed by using another information.
[0015] In a possible design, the method includes: Receiving and attempting to verify the fourth information sent by the receiving device. Further comprising: The fourth information includes second authentication data, the second authentication data being from the receiving device and being obtained after an authentication process is performed on the third information.
[0016] In a possible design, the method includes: Receiving and attempting to verify the fourth information sent by the receiving device. Further comprising: The fourth information includes third authentication data, the third authentication data being from the receiving device and being obtained after an authentication process is performed on the third information and the N key negotiation algorithms indicated in the first information.
[0017] In a possible design, the fourth information is processed by using an integrity protection algorithm.
[0018] In a possible design, the authentication process further includes an authentication process performed based on a pre-established shared key.
[0019] In a possible design, the third information further indicates N key negotiation algorithms supported by the sending device.
[0020] In a possible design, the step of transmitting the first information to the receiving device comprises: Transmitting the first information to a receiving device in a broadcast manner. Includes.
[0021] In a possible design, prior to the step of transmitting the first information to the receiving device, the method further comprises: receiving fifth information from the receiving device, the fifth information being used to indicate to the sending device to send the first information to the receiving device; Further comprising: The step of transmitting the first information to the receiving device includes: Transmitting the first information to a receiving device in a unicast manner. Includes.
[0022] According to a second aspect, an embodiment of the present application is a key negotiation method, the method comprising: receiving first information from a sending device, the first information indicating N key negotiation algorithms supported by the sending device, where N is an integer greater than or equal to 1; determining a target key negotiation algorithm, the target key negotiation algorithm being a key negotiation algorithm among the N key negotiation algorithms supported by the receiving device; generating first key negotiation parameters based on a targeted key negotiation algorithm, the first key negotiation parameters corresponding to the receiving device and obtained based on the targeted key negotiation algorithm, or the first key negotiation parameters are key negotiation parameters generated by the receiving device based on the targeted key negotiation algorithm; sending second information to the sending device, the second information indicating a target key negotiation algorithm and including the first key negotiation parameters; The present invention provides a method for key negotiation, comprising:
[0023] In a possible design, the method includes: receiving third information from the sending device, the third information indicating second key negotiation parameters, the second key negotiation parameters corresponding to the sending device and obtained based on a target key negotiation algorithm; generating a target key based on the second key negotiation parameters and the target key negotiation algorithm; Further includes:
[0024] In a possible design, the third information is processed by using an integrity protection algorithm.
[0025] In a possible design, the second information further indicates priority information of the M key negotiation algorithms supported by the receiving device; The second information includes identification information of the M key negotiation algorithms, the identification information being arranged or encapsulated based on the priority information of the M key negotiation algorithms.
[0026] In a possible design, the first information is further used to indicate priority information of the N key negotiation algorithms, and the first information includes identification information of the N key negotiation algorithms, and the identification information is positioned or encapsulated based on the priority information of the N key negotiation algorithms.
[0027] In one possible design, the step of determining the target key negotiation algorithm may include: determining a key negotiation algorithm having a highest priority from the N key negotiation algorithms as a target key negotiation algorithm; Includes.
[0028] Alternatively, in a possible design, the target key negotiation algorithm is the key negotiation algorithm that has the highest priority among the N key negotiation algorithms supported by the receiving device.
[0029] In a possible design, the method includes: The method further includes receiving first authentication data from the sending device, the first authentication data being authentication data obtained after the sending device performs an authentication process on the second information. Alternatively, the third information further includes the first authentication data, the first authentication data being authentication data obtained after the sending device performs an authentication process on the second information. The first authentication data may be indicated by using the third information, or may be indicated or conveyed by using another information.
[0030] In a possible design, the method includes: sending fourth information to the sending device, the fourth information including second authentication data, the second authentication data being authentication data obtained after the receiving device performs an authentication process on the third information; Further includes:
[0031] In a possible design, the method includes: sending fourth information to the sending device, the fourth information including third authentication data, the third authentication data being authentication data obtained after the receiving device performs an authentication process for the third information and the N key negotiation algorithms indicated in the first information; Further includes:
[0032] In a possible design, the step of transmitting the fourth information to the transmitting device comprises: Sending the fourth information, which has been processed by using an integrity protection algorithm, to the sending device. Includes.
[0033] In a possible design, the authentication process further comprises an authentication process performed based on a pre-established key.
[0034] In a possible design, the third information further indicates N key negotiation algorithms supported by the sending device.
[0035] In a possible design, prior to the step of receiving the first information from the transmitting device, the method further comprises: transmitting fifth information to the sending device, the fifth information being used to indicate to the sending device to send the first information to the receiving device; Further includes:
[0036] According to a third aspect, an embodiment of the present application comprises: At least one module, component, or circuit configured to implement the key negotiation method of the first aspect; At least one module, component, or circuit configured to implement the key negotiation method of the second aspect; The present invention provides a key negotiation apparatus, comprising:
[0037] According to a fourth aspect, an embodiment of the present application provides a key negotiation apparatus, including at least one processor and a memory, wherein the at least one processor is configured to execute a computer program in the memory, such that the key negotiation apparatus performs a key negotiation method according to the first or second aspect of the embodiment of the present application.
[0038] According to a fifth aspect, an embodiment of the present application provides a key negotiation apparatus. The key negotiation apparatus includes one or more processors and a communication unit. The one or more processors are configured to support the communication apparatus in performing the key negotiation method according to the first or second aspect of the embodiment of the present application. The communication unit is configured to support the key negotiation apparatus in communicating with another device to implement a receiving function and / or a transmitting function.
[0039] Optionally, the device may further include one or more memories. The memory is configured to be coupled to the processor, and the memory stores program instructions and / or data required for the device. The one or more memories may be integrated with the processor or may be disposed independently of the processor. This is not limited in the present application.
[0040] The key negotiation device may alternatively be a chip, and the communication unit may be an input / output circuit or an interface of a communication chip.
[0041] According to a sixth aspect, an embodiment of the present application provides a computer-readable storage medium configured to store a computer program, the computer program including instructions used to perform a key negotiation method according to the first or second aspect of the embodiment of the present application.
[0042] According to a seventh aspect, an embodiment of the present application provides a computer program product, the computer program product comprising computer program code, which when executed on a computer, enables the computer to perform a key negotiation method according to the first or second aspect of the embodiment of the present application.
[0043] According to an eighth aspect, an embodiment of the present application provides a key negotiation system including a key negotiation device configured to perform a key negotiation method according to a first aspect of an embodiment of the present application, and a key negotiation device configured to perform a key negotiation method according to a second aspect of an embodiment of the present application.
[0044] According to a ninth aspect, an embodiment of the present application provides a terminal. The terminal may be a transportation vehicle or an intelligent device, including a drone, an unmanned transport vehicle, an automobile, a robot, etc. The transportation vehicle or the intelligent device includes a key negotiation apparatus according to the third aspect, and / or the fourth aspect, and / or the fifth aspect.
[0045] The embodiments of the present application provide a key negotiation method, apparatus, and system. During the key negotiation period between the sending device and the receiving device, the sending device informs the receiving device of all the key negotiation algorithms supported by the sending device by using the first information. The receiving device selects a key negotiation algorithm supported by the receiving device from the received key negotiation algorithms supported by the sending device. In this way, the key negotiation algorithm selected by the receiving device is supported by both the sending device and the receiving device. This avoids the key negotiation algorithm negotiation failure caused by the sending device not supporting the key negotiation algorithm selected by the receiving device, and improves the key negotiation efficiency. In addition, the key negotiation method provided in the embodiments of the present application supports Chinese encryption algorithms. [Brief description of the drawings]
[0046] [Figure 1] FIG. 1 is a schematic diagram of an application scenario according to an embodiment of the present application. [Diagram 2] 1 is a schematic diagram of a hardware structure of a communication device applicable to an embodiment of the present application; [Diagram 3] 1 is a flow chart of a key negotiation method. [Figure 4] 1 is a flowchart of a key negotiation method according to an embodiment of the present application. [Diagram 5]4 is a flowchart of a key negotiation method according to another embodiment of the present application. [Figure 6] 4 is a flowchart of a key negotiation method according to another embodiment of the present application. [Figure 7] 4 is a flowchart of a key negotiation method according to another embodiment of the present application. [Figure 8] 1 is a schematic diagram of the structure of a key negotiation device according to an embodiment of the present application; [Figure 9] FIG. 2 is a schematic diagram of the structure of a key negotiation device according to another embodiment of the present application; [Figure 10] FIG. 2 is a schematic diagram of the structure of a key negotiation device according to another embodiment of the present application; [Figure 11] FIG. 1 is a schematic diagram of the structure of a key negotiation system according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0047] The terms used in the implementation section of this application are only used to describe specific embodiments of this application and are not intended to limit this application.
[0048] The embodiments of the present application can be used in various types of communication systems. Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present application. The communication system shown in Figure 1 mainly includes a sending device 11 and a receiving device 12. The sending device 11 is the initiator in the communication, and the receiving device 12 is the receiver in the communication.
[0049] The transmitting device 11 or receiving device 12 included in the communication system shown in Figure 1 may be any device having a transceiver function, including, but not limited to, an evolved Node B (NodeB, eNB, or e-NodeB, evolved NodeB) in a long term evolution (LTE) system, a gNode B (gNodeB or gNB) or a transmission receiving point / transmission reception point (TRP) in a new radio (NR) system, a base station later evolved by the 3rd generation partnership project (3GPP), an access node, a wireless relay node, a wireless backhaul node in a wireless communication system (e.g., Wi-Fi or Bluetooth), or a data transit device (such as a router, repeater, bridge, or switch) in a universal mobile communication technology. The base station may be a macro base station, a micro base station, a picocell base station, a small cell, a relay station, a balloon station, etc.
[0050] The sending device 11 or the receiving device 12 may alternatively be a radio controller, a centralized unit (CU), and / or a distributed unit (DU) in a cloud radio access network (CRAN) scenario.
[0051] The sending device 11 or the receiving device 12 may alternatively be a server, a wearable device (such as a smart watch, a smart band, or a pedometer), a machine communication device, or an in-vehicle device.
[0052] The transmitting device 11 or the receiving device 12 may alternatively be a mobile phone, a tablet computer (pad), a computer with wireless receiving and transmitting capabilities, headphones, speakers, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a terminal in machine type communication (MTC), a terminal in industrial control, an in-vehicle terminal device, a terminal in self driving, a terminal device in assisted driving, a terminal in telemedicine, a terminal in a smart grid, a terminal in transportation safety, a terminal in a smart city, a terminal in a smart home, etc.
[0053] The sending device 11 or the receiving device 12 may alternatively be a vehicle cockpit domain device or a module within a vehicle cockpit domain device (e.g. a cockpit domain controller (CDC), a camera, a screen, a microphone, a speaker, an electronic key, or a passive entry passive start system controller).
[0054] The application scenario is not limited in the embodiments of the present application. Sometimes, the terminal can also be called a terminal device, a user equipment (UE), an access terminal device, an in-vehicle terminal, an industrial control terminal, a UE unit, a UE station, a mobile station, a mobile console, a remote station, a remote terminal device, a mobile device, a UE terminal device, a wireless communication device, a machine terminal, a UE agent, a UE device, etc. The terminal can be fixed or mobile.
[0055] The communication system 10 shown in Fig. 1 is only used as an example and is not intended to limit the technical solution of the present application. Those skilled in the art should understand that in a specific implementation process, the communication system 10 may further include other devices, and the quantity of the sending device and the receiving device may be determined based on specific requirements, and they are not limited.
[0056] Optionally, in this embodiment of the present application, each of the devices in Fig. 1, for example, the sending device 11 and the receiving device 12, may be a functional module in an apparatus. It may be understood that the functional module may be an element in a hardware device, for example, a chip or a communication component in a terminal device or a network device, or may be a software functional module executed on hardware, or a virtualized function instantiated on a platform (for example, a cloud platform).
[0057] For example, each device in FIG. 1 may be implemented by using a communication device 200 in FIG. 2. The communication device 200 may be a device, or a chip or integrated circuit in a device. FIG. 2 is a schematic diagram of a hardware structure of a communication device applicable to an embodiment of the present application. The communication device 200 may include at least one processor 201 and at least one communication interface 204. Optionally, the communication device 200 may further include at least one of a communication line 202 and a memory 203.
[0058] The processor 201 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to control program execution in the solutions of the present application.
[0059] The communication line 202 may include a channel, such as a bus, over which information is transmitted between the aforementioned components.
[0060] The communication interface 204 is used to communicate with another device or a communication network by using any device, such as a transceiver, for example an Ethernet interface, a radio access network (RAN) interface, or a wireless local area network (WLAN) interface.
[0061] The memory 203 may be a read-only memory (ROM) or another type of static storage device capable of storing static information and instructions, or a random access memory (RAM) or another type of dynamic storage device capable of storing information and instructions, or may be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or another type of compact disc storage, an optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), a magnetic disc storage medium or another magnetic storage device, or any other medium capable of carrying or storing the expected program code in the form of instructions or data structures and accessible by a computer. However, the memory 203 is not limited thereto. The memory may exist independently and be connected to the processor through the communication line 202. The memory may alternatively be integrated into the processor. The memory provided in this embodiment of the present application may typically be non-volatile. The memory 203 is configured to store computer-executable instructions for executing the solutions of the present application, and the processor 201 controls the execution. The processor 201 is configured to execute the computer-executable instructions stored in the memory 203 to implement the methods provided in the embodiments of the present application.
[0062] Optionally, the computer-executable instructions in this embodiment of the present application may be referred to as application program code, which is not particularly limited in this embodiment of the present application.
[0063] During a particular implementation, in one embodiment, the processor 201 may include one or more CPUs, for example, CPU 0 and CPU 1 in FIG.
[0064] During a particular implementation, in one embodiment, the communications device 200 may include multiple processors, such as processor 201 and processor 207 in FIG. 2. Each of the processors may be a single-CPU processor or a multi-CPU processor. A processor herein may be one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0065] During a particular implementation, in one embodiment, the communication apparatus 200 may further include an output device 205 and an input device 206. The output device 205 communicates with the processor 201 and may display information in a number of ways. For example, the output device 205 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, a projector, etc. The input device 206 communicates with the processor 201 and may receive user input in a number of ways. For example, the input device 206 may be a mouse, a keyboard, a touch screen device, or a sensing device.
[0066] During a particular implementation, the communication device 200 may be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, an embedded device, or a device having a structure similar to that in Fig. 2. The type of the communication device 200 is not limited in this embodiment of the present application.
[0067] A possible key negotiation method is specifically described below with reference to Figures 1 and 2. The sending device and the receiving device in the following embodiments may include the components shown in Figure 2.
[0068] A method for key negotiation between a sending device and a receiving device is shown in FIG. 3, and the key negotiation method includes the following steps.
[0069] S301: A sending device sends a negotiation packet to a receiving device. In response, the receiving device receives the negotiation packet.
[0070] The negotiation packet is used to indicate N key negotiation algorithms and includes the key negotiation parameters of the sending device, which are obtained based on one of the key negotiation algorithms supported by the sending device.
[0071] In this embodiment, the sending device uses any key negotiation algorithm supported by the sending device as an algorithm for generating the target key, obtains key negotiation parameters according to the selected key negotiation algorithm, and then adds the key negotiation parameters to a negotiation packet and sends the negotiation packet to the receiving device. In this way, the receiving device can determine all the key negotiation algorithms supported by the sending device by using the negotiation packet, and can directly obtain the key negotiation parameters of the sending device used by the receiving device to generate the target key.
[0072] S302: The receiving device determines a target key negotiation algorithm, and generates key negotiation parameters of the receiving device based on the target negotiation algorithm.
[0073] The key negotiation parameters of the receiving device are obtained based on a target key negotiation algorithm.
[0074] In this embodiment, the receiving device selects one of the key negotiation algorithms from all the key negotiation algorithms supported by the sending device, which is obtained based on the negotiation packet, as an algorithm for generating the target key, and obtains key negotiation parameters based on the selected key negotiation algorithm. In the process of selecting the target key negotiation algorithm, the receiving device does not consider which key negotiation algorithm is selected by the sending device. In other words, the sending device and the receiving device are independent of each other when selecting their respective key negotiation algorithms used to generate the target key. Therefore, it is easy to have a situation where the key negotiation algorithm selected by the receiving device does not match the key negotiation algorithm selected by the sending device. As a result, the key negotiation algorithm selected by the receiving device does not match the key negotiation parameters of the sending device.
[0075] S303: If the key negotiation parameters of the sending device match the target key negotiation algorithm, the receiving device sends a negotiation response packet to the sending device.
[0076] The negotiation response packet is used to indicate the target key negotiation algorithm and contains the key negotiation parameters of the receiving device.
[0077] S304: The receiving device generates a target key based on the key negotiation parameters of the sending device and the target key negotiation algorithm.
[0078] S305: The sending device generates a target key based on the key negotiation parameters of the receiving device and a target key negotiation algorithm.
[0079] In this embodiment, the process by which the receiving device and the sending device generate the target key is as follows.
[0080] The Diffie-Hellman DH algorithm is used as an example. The two nodes use the same relatively large prime number p and the same random number g (i.e., prime number p and random number g are the public keys between the sending device and the receiving device), and generate random numbers a and b, respectively (i.e., random number a is the private key of the receiving device, and random number b is the private key of the sending device). The prime number p, random number g, and random numbers a and b can all be considered as parameters of the key negotiation algorithm. The receiving device negotiates the value A generated by raising g modulus P to the power of a (i.e., A=g a The sending device transmits the received value A to the power of b (i.e., B=g mod p, where A is a first key negotiation algorithm parameter) to the sending device, which then raises the received value A to the power of b to generate a secret value KE. The sending device then transmits the received value A to the power of b (i.e., B=g mod P, where A is a first key negotiation algorithm parameter) to the sending device, which then raises the received value A to the power of b to generate a secret value KE. b mod p, where B is a second key negotiation algorithm parameter) to the receiving device, which then raises the received value B to the power of a to generate a secret value KE. b mod p=(g a mod p) b mod p=g ab mod p=(g b mod p) a mod p=B a Since mod p, the secret value KE generated by the sending device and the receiving device is identical, i.e. the target keys are identical.
[0081] In the current technology, since the receiving device and the sending device respectively select the key negotiation algorithm supported by the receiving device and the sending device, it can be known that the key negotiation algorithm selected by the receiving device may not match the key negotiation parameters of the initiating device, and as a result, the negotiation fails. If the key negotiation algorithm selected by the receiving device does not match the key negotiation parameters of the initiating device, the receiving device needs to send a packet to the initiating device, so that the initiating device resends the negotiation packet and repeats the above steps until the key negotiation algorithm selected by the receiving device matches the key negotiation parameters of the initiating device. As a result, the number of packet exchanges between the sending device and the receiving device increases, resulting in low key negotiation efficiency.
[0082] To solve the aforementioned problem, the embodiment of the present application proposes that the sending device informs the receiving device of the key negotiation algorithms supported by the sending device, and the receiving device selects from the key negotiation algorithms a key negotiation algorithm supported by both the receiving device and the sending device, and sends the selected key negotiation algorithm and key negotiation parameters corresponding to the receiving device and generated based on the key negotiation algorithm to the sending device. Compared with the method in which the sending device and the receiving device respectively select the key negotiation algorithms supported by the sending device and the receiving device, the method in the present application solves the problem that the key negotiation algorithms selected by the sending device and the receiving device do not match, and improves the key negotiation efficiency.
[0083] The key negotiation method proposed in this application is described in detail below with reference to specific embodiments.
[0084] 4 is a flowchart of a key negotiation method according to an embodiment of the present application. As shown in FIG. 4, the key negotiation method in this embodiment of the present application includes the following steps:
[0085] S401: A sending device sends first information to a receiving device. In response, the receiving device receives the first information.
[0086] The first information is used to indicate N key negotiation algorithms, where N is an integer equal to or greater than 1, and the N key negotiation algorithms are supported by the sending device.
[0087] For example, the first information is carried in a negotiation packet. Specifically, before two devices in a communication system perform data transmission, the two devices need to perform key negotiation to obtain a target key, so as to encrypt and decrypt the transmitted data based on the target key. When a sending device and a receiving device perform key negotiation, the initiating device sends a negotiation packet to the receiving device.
[0088] The first information may indicate the N key negotiation algorithms in any one of the following manners:
[0089] Method 1: The first information includes identifiers of N key negotiation algorithms supported by the initiating device, so that the receiving device obtains the N key negotiation algorithms supported by the initiating device.
[0090] The algorithm identifiers shown in Table 1 are used as examples. If the first information includes ID 1, ID 3, and ID 5, the first information is used to indicate algorithm 1, algorithm 3, and algorithm 5. If the first information includes ID 2 and ID 4, the first information is used to indicate algorithm 2 and algorithm 4.
[0091] [Table 1]
[0092] It can be understood that Table 1 is merely an example of the key negotiation algorithm identifier indicated by the first information. In a specific application, the key negotiation algorithm indicated by the first information may alternatively be in another form, and is not limited thereto.
[0093] Method 2: The first information includes a bit sequence, where one bit in the bit sequence corresponds to one algorithm, and each bit in the bit sequence may be 0 or 1 to indicate whether the first information indicates the algorithm corresponding to that bit. For example, if a bit is 1, it may indicate that the first information indicates the algorithm corresponding to that bit, and if the bit is 0, it may indicate that the first information does not indicate the algorithm corresponding to that bit.
[0094] For example, the first information includes five bits, where a first bit in the five bits corresponds to algorithm 1, a second bit corresponds to algorithm 2, a third bit corresponds to algorithm 3, a fourth bit corresponds to algorithm 4, and a fifth bit corresponds to algorithm 5. If the five bits are 01010, it may indicate that the first information is used to indicate algorithm 2 and algorithm 4. If the five bits are 11001, it may indicate that the first information is used to indicate algorithm 1, algorithm 2, and algorithm 5.
[0095] Optionally, the first information is further used to indicate priority information of the N key negotiation algorithms, and the identification information of the N key negotiation algorithms included in the first information is arranged or encapsulated based on the priority information of the N key negotiation algorithms.
[0096] For example, the N key negotiation algorithms indicated by the first information are arranged in descending order of priority, or the N key negotiation algorithms indicated by the first information are arranged in ascending order of priority. For example, as shown in Table 2, the first information is used to indicate algorithm 1, algorithm 2, algorithm 3, algorithm 4, and algorithm 5. The priority of algorithm 4 is higher than the priority of algorithm 2, which is higher than the priority of algorithm 5, which is higher than the priority of algorithm 1, which is higher than the priority of algorithm 3.
[0097] [Table 2]
[0098] Optionally, the sending device sends the negotiation packet to the receiving device in a broadcast manner, so that no additional packet exchange is required and the key negotiation efficiency is improved. Also, the negotiation packet is sent in a broadcast manner, so that multiple receiving devices can receive the negotiation packet and the number of packet exchanges is further reduced.
[0099] It should be noted that in the process of transmitting the first information, the first information may be intercepted by a third party device. The third party device tampers with the first information and transmits the tamped first information to the receiving device. In this case, there may be a difference between the key negotiation algorithm supported by the transmitting device indicated in the first information received by the receiving device and the key negotiation algorithm supported by the transmitting device indicated in the first information transmitted by the transmitting device. In this case, the key negotiation algorithm supported by the transmitting device indicated in the first information received by the receiving device is K key negotiation algorithms, where K is an integer equal to or greater than 0.
[0100] It can be understood that the K key negotiation algorithms supported by the sending device indicated in the first information received by the receiving device and the N key negotiation algorithms supported by the sending device indicated in the first information transmitted by the sending device have at least the following three relationships:
[0101] First relationship: K is equal to N, and the K key negotiation algorithms supported by the sending device as indicated in the first information received by the receiving device have a one-to-one correspondence with the N key negotiation algorithms supported by the sending device as indicated in the first information sent by the sending device.
[0102] Second relationship: K is equal to N, but the K key negotiation algorithms supported by the sending device as indicated in the first information received by the receiving device do not have a one-to-one correspondence with the N key negotiation algorithms supported by the sending device as indicated in the first information sent by the sending device.
[0103] Third relation: K is not equal to N.
[0104] If the relationship between the K key negotiation algorithms and the N key negotiation algorithms is a first relationship, it indicates that the N key negotiation algorithms indicated in the first information sent by the sending device have not been tampered with. If the relationship between the K key negotiation algorithms and the N key negotiation algorithms is a second relationship or a third relationship, it indicates that the first information sent by the sending device has been tampered with.
[0105] Optionally, before S401, the key negotiation algorithm described in the present application further includes receiving fifth information from the receiving device, where the fifth information is used to indicate to the sending device to send the first information. Correspondingly, a possible implementation of S401 is to send the first information to the receiving device in a unicast manner. Specifically, when the receiving device needs to communicate with the sending device, the receiving device may first send information, i.e., the fifth information, to the sending device. The fifth information is used to indicate to the sending device to send the first information to the receiving device. In this way, after receiving the fifth information, the sending device sends the first information to the receiving device. The sending device sends the first information in a unicast manner.
[0106] Optionally, the fifth information carries an indication identifier. For example, the indication identifier may be pre-negotiated by the sending device and the receiving device. When the receiving device needs to indicate to the sending device to send the first information to the receiving device, the fifth information includes the pre-negotiated indication identifier. After receiving the fifth information including the indication identifier, the sending device sends the first information to the receiving device.
[0107] Optionally, the fifth information includes a null target key negotiation algorithm. For example, an identifier of a bit used to indicate a key negotiation algorithm is "null". When the receiving device needs to indicate to the sending device to send the first information to the receiving device, the fifth information includes a null target key negotiation algorithm, and after receiving the fifth information including the null target key negotiation algorithm, the sending device sends the first information to the receiving device.
[0108] S402: The receiving device determines a target key negotiation algorithm.
[0109] The target key negotiation algorithm is a key negotiation algorithm among the N key negotiation algorithms that is supported by the receiving device.
[0110] In this embodiment, the receiving device determines a key negotiation algorithm supported by the receiving device as a target negotiation algorithm from the N key negotiation algorithms in the first information.
[0111] Optionally, the receiving device determines a key negotiation algorithm that has the highest priority among the N key negotiation algorithms and is supported by the receiving device based on the priority information of the N key negotiation algorithms indicated in the received first information, and uses the key negotiation algorithm as the target negotiation algorithm. It should be noted that the highest priority in this specification is determined based on the priority of the key negotiation algorithm corresponding to the sending device.
[0112] For example, Table 3 shows all key negotiation algorithms supported by the receiving device. The first information received by the receiving device shows five key negotiation algorithms shown in Table 1. In the first information, the identifiers of the five algorithms are arranged in descending order of priority. It can be known from Table 1 to Table 3 that, among the five key negotiation algorithms, the receiving device supports algorithm 2, algorithm 3, and algorithm 5, and the priority of algorithm 2 is higher than the priority of algorithm 3 and the priority of algorithm 5. In this case, the receiving device selects algorithm 2 as the target negotiation algorithm.
[0113] [Table 3]
[0114] Optionally, based on the N key negotiation algorithms indicated in the received first information, the receiving device determines a key negotiation algorithm among the N key negotiation algorithms and supported by the receiving device that has the highest priority for the receiving device, and uses the key negotiation algorithm as a target negotiation algorithm, i.e., in the N key negotiation algorithms, the target key negotiation algorithm is determined from the key negotiation algorithms supported by both the receiving device and the sending device based on the priority of the key negotiation algorithms corresponding to the receiving device.
[0115] For example, Table 4 shows the priority information of the key negotiation algorithms supported by the receiving device. As shown in Table 3, the first information received by the receiving device shows the five key negotiation algorithms shown in Table 1, and the receiving device supports algorithm 2, algorithm 3, and algorithm 5 in the five key negotiation algorithms. For the receiving device, it can be known from Table 4 that the priority of algorithm 3 is higher than the priority of algorithm 2, and the priority of algorithm 2 is higher than the priority of algorithm 5. In this case, the receiving device selects algorithm 3 as the target negotiation algorithm. It should be noted that in this embodiment, the N key negotiation algorithms supported by the sending device shown in the first information may not be arranged according to priority, that is, the first information does not show the priority information of the N key negotiation algorithms supported by the sending device.
[0116] [Table 4]
[0117] S403: The receiving device generates first key negotiation parameters based on the target key negotiation algorithm.
[0118] The first key negotiation parameter is a key negotiation parameter corresponding to the receiving device and obtained based on a target key negotiation algorithm.
[0119] For example, the receiving device generates a private key in the manner of S304, and only the receiving device knows the private key; then, the receiving device generates a public key corresponding to the receiving device by using the selected key negotiation algorithm, and uses the public key as a first key negotiation parameter, i.e., key negotiation parameter KE1.
[0120] The manner of obtaining the first key negotiation parameter is not limited in this application.
[0121] S404: The receiving device transmits second information to the transmitting device, and in response, the transmitting device receives the second information from the receiving device.
[0122] The second information indicates a target key negotiation algorithm and includes the first key negotiation parameters.
[0123] Optionally, the second information further carries a first random number, where the first random number (NONCE 1) is a random number generated by the receiving device.
[0124] S405: The sending device generates a target key based on the target key negotiation algorithm and the first key negotiation parameters.
[0125] In this embodiment, the second information carries an identifier of a target key negotiation algorithm, so that the sending device determines the key negotiation algorithm selected by the receiving device by using the identifier of the target key negotiation algorithm. For example, the sending device generates a secret key in the manner of S305. The secret key is only known by the sending device. Then, the sending device obtains a public key corresponding to the sending device through calculation based on the first target key negotiation algorithm, and uses the public key as a second key negotiation parameter, and the second key negotiation parameter is represented as KE2. Then, the target key KE is generated based on the target key negotiation algorithm and the key negotiation parameter KE1.
[0126] Optionally, after determining the target key negotiation algorithm by using the second information, the sending device determines whether the target key negotiation algorithm is one of the N key negotiation algorithms indicated by the first information, and if yes, the sending device obtains a target key and / or key negotiation parameters KE2 based on the target key negotiation algorithm, and if no, the sending device discards the second information.
[0127] Optionally, the sending device obtains an encryption key and an integrity protection key based on the target key KE. The encryption key is used to encrypt information transmitted between the sending device and the receiving device. The integrity protection key is used to provide integrity protection to the information transmitted between the sending device and the receiving device.
[0128] The manner in which the sending device obtains the encryption and integrity protection keys is as follows.
[0129] The sending device randomly generates a second random number (NONCE 2), and the sending device uses the target key KE, the random number (NONCE 1), and the random number (NONCE 2) as inputs to a key derivation function (KDF) KDF 1 to obtain a shared key Kgt, i.e., Kgt=KDF 1(KE, NONCE 1, NONCE 2).
[0130] The sending device uses the shared key Kgt as input for KDF 2 to obtain an encryption key and an integrity protection key, i.e., Kenc=KDF 2(Kgt). Similarly, Kint=KDF 3(Kgt), where Kenc is the encryption key and Kint is the integrity protection key.
[0131] In another approach, after obtaining the target key KE, the sending device uses the target key KE as an input of KDF 2 to obtain an encryption key and an integrity protection key, i.e., Kenc=KDF 2(KE). Similarly, Kint=KDF 3(KE). Kenc is the encryption key and Kint is the integrity protection key.
[0132] It should be noted that KDF 1, KDF 2, and KDF 3 may be the same or different. Also, the KDF used to derive the shared key Kgt, the KDF used to derive the encryption key Kenc, and the KDF used to derive the integrity protection key Kint are not limited in this application.
[0133] It can be understood that the manner of obtaining the shared key Kgt, the encryption key Kenc, and the integrity protection key Kint in this embodiment of the present application is not intended to limit the present application, and another manner may be used as an alternative. For example, Kenc=KDF 2(Kgt, ID 1), and Kint=KDF 3(Kgt, ID 2), where ID 1 is the identifier of the encryption algorithm, and ID 2 is the identifier of the integrity protection algorithm.
[0134] Optionally, the method further includes S406: the sending device sends the third information to the receiving device, and correspondingly, the receiving device receives the third information from the sending device.
[0135] The third information includes a second key negotiation parameter, where the second key negotiation parameter corresponds to the sending device and is obtained based on a target key negotiation algorithm.
[0136] Specifically, the third information carries a second random number (NONCE 2).
[0137] Since there is no security protection for the second information sent by the receiving device to the sending device, the second information may be tampered with during the sending process. If the second information is tampered with, the key negotiation between the sending device and the receiving device may fail. Therefore, it is necessary to verify whether the second information is tampered with. The method of verifying whether the second information is tampered with may be, for example, as follows.
[0138] The sending device performs an authentication process on the second information, generates a first authentication data AUTH 1 by using the second information as a parameter, and sends the first authentication data AUTH 1 to the receiving device, so that the receiving device verifies whether the second information has been tampered with. Optionally, the third information includes the first authentication data AUTH 1. A method for obtaining AUTH 1 includes:
[0139] Method 1: The authentication data AUTH1 is obtained by the sending device based on the second information received by the sending device, the pre-set shared key PSK, and KDF4, i.e. AUTH1=KDF4(PSK, second information). The pre-set shared key PSK is a key shared in advance by the sending device and the receiving device, so that based on the pre-set shared key PSK, verification can be performed on the identity of both the sending device and the receiving device, so as to avoid tampering with the information exchanged between the sending device and the receiving device. It should be noted that the method of pre-setting the pre-set shared key PSK is not limited in this embodiment of the present application. For example, the pre-set shared key PSK may be obtained by inputting the same number in advance into each of the sending device and the receiving device, or may be obtained by using the same derivation algorithm after the target key KE is obtained.
[0140] Correspondingly, after receiving the third information, the receiving device obtains the authentication data AUTH1 and matches the authentication data AUTH1 with the first reference authentication data. The first reference authentication data is obtained by the receiving device according to the transmitted second information, the pre-set shared key PSK and KDF4, i.e., the first reference authentication data=KDF4(PSK, second information). Therefore, if the second information has not been tampered with during the transmission process, i.e., if the second information received by the transmitting device matches the second information transmitted by the receiving device, the authentication data AUTH1 matches the reference authentication data, otherwise, the authentication data AUTH1 does not match the reference authentication data. Therefore, the receiving device may determine whether the second information received by the transmitting device matches the second information transmitted by the receiving device according to the matching result of the authentication data AUTH1 with the first reference authentication data. If the authentication data AUTH 1 matches the reference authentication data, it indicates that the second information has not been tampered with; if not, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0141] Method 2: The authentication data AUTH 1 is obtained by the sending device based on the second information received by the sending device, the random number (NONCE 2), the pre-set shared key PSK, and KDF 5, i.e., AUTH 1=KDF 5(PSK, NONCE 2, second information). Correspondingly, the first reference authentication data is obtained by the receiving device based on the transmitted second information, the random number (NONCE 2) in the received third information, the pre-set shared key PSK, and KDF 5, i.e., the first reference authentication data=KDF 5(PSK, NONCE 2, second information). Therefore, if the second information has not been tampered with during the sending process, i.e., the second information received by the sending device matches the second information sent by the receiving device, and the random number (NONCE 2) in the third information has not been tampered with, the authentication data AUTH 1 matches the reference authentication data, otherwise, the authentication data AUTH 1 does not match the reference authentication data. Therefore, the receiving device may determine whether the second information received by the sending device matches the second information sent by the receiving device according to the matching result between the authentication data AUTH 1 and the first reference authentication data. If the authentication data AUTH 1 matches the reference authentication data, it indicates that the second information and the random number (NONCE 2) have not been tampered with, otherwise, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0142] In this embodiment of the present application, AUTH 1 may alternatively be obtained in other ways, which are not enumerated one by one in this specification.
[0143] It should be noted that the KDF for obtaining AUTH 1 and the KDF for obtaining the first reference authentication data are not limited in this embodiment of the present application, as long as the KDF for obtaining AUTH 1 is the same as the KDF for obtaining the first reference authentication data, and the parameters for obtaining AUTH 1 correspond one-to-one with the parameters for obtaining the first reference authentication data. For example, AUTH 1 is obtained by using KDF 4, the second information received by the sending device, and the pre-set shared key PSK, and correspondingly, the first reference authentication data is obtained by using KDF 4, the second information sent by the receiving device, and the pre-set shared key PSK.
[0144] Optionally, the third information is information that has been processed by using an integrity protection algorithm.
[0145] For example, before S406 is performed, after the sending device obtains the encryption key Kenc and the integrity protection key Kint, the sending device obtains a first message authentication code (MAC) based on the integrity protection algorithm, the integrity protection key Kint, and some or all of the information in the third information sent by the sending device, and performs integrity protection on the third information by using the first MAC. For example, the third information includes the first MAC.
[0146] S407: The receiving device generates a target key based on the second key negotiation parameters and the target key negotiation algorithm.
[0147] In this embodiment, after receiving the key negotiation parameters KE2 of the sending device, the receiving device obtains the target key KE according to the key negotiation algorithm and the received key negotiation parameters KE2.
[0148] Optionally, the receiving device obtains an encryption key Kenc and an integrity protection key Kint based on the target key KE by using the same method as the sending device. The receiving device obtains a second MAC based on the integrity protection algorithm, the integrity protection key Kint, and some or all of the information in the third information received by the receiving device. If the first MAC matches the second MAC, it indicates that the third information has not been tampered with. If not, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0149] Optionally, the method further includes: S408. The receiving device transmits the fourth information to the transmitting device. In response, the transmitting device receives the fourth information.
[0150] The fourth piece of information is used by the sending device to determine whether the key negotiation was successful.
[0151] Optionally, the fourth information is encrypted by using the encryption key Kenc. The receiving device encrypts the fourth information by using the encryption key Kenc. After receiving the fourth information, the sending device decrypts the encrypted fourth information by using the encryption key Kenc to obtain the fourth information.
[0152] Optionally, the fourth information further includes third authentication data. A manner of obtaining the third authentication data AUTH3 includes:
[0153] Method 1: The receiving device obtains AUTH 3 based on the K key negotiation algorithms indicated in the first information received by the receiving device, the received third information, a pre-configured shared key PSK, a random number (NONCE 1), and KDF 6, i.e., AUTH 3=KDF 6(PSK, K key negotiation algorithms, third information, NONCE 1).
[0154] Method 2: The receiving device obtains AUTH 3 based on the K key negotiation algorithms indicated in the first information received by the receiving device, the received third information, the pre-configured shared key PSK, and KDF 7, i.e., AUTH 3=KDF 7(PSK, K key negotiation algorithms, third information).
[0155] In this embodiment of the present application, AUTH 1 may alternatively be obtained in other ways, which are not enumerated one by one in this specification.
[0156] Optionally, the fourth information is information that has been processed by using an integrity protection algorithm.
[0157] The receiving device obtains a third message authentication code (MAC) based on the integrity protection algorithm, the integrity protection key (Kint), and some or all of the information in the fourth information sent by the receiving device, and performs integrity protection on the fourth information by using the third MAC. For example, the fourth information includes the third MAC.
[0158] Optionally, the method further includes: S409: The sending device attempts to verify the fourth information.
[0159] Optionally, the sending device obtains a fourth message authentication code MAC according to the integrity protection algorithm, the integrity protection key Kint, and some or all of the information in the fourth information received by the sending device. If the third MAC matches the fourth MAC, it indicates that the fourth information has not been tampered with, and the following operation is performed. If not, the receiving device discards the fourth information. The specific operation content of the following operation is not limited in this embodiment of the present application.
[0160] Optionally, the fourth information includes authentication data AUTH3, and correspondingly, the sending device obtains the authentication data AUTH3 and matches the authentication data AUTH3 with the third reference authentication data.
[0161] The KDF and the parameters for obtaining the third reference authentication data correspond to the method for obtaining AUTH 3. For example, as follows:
[0162] When AUTH 3 is obtained by method 1, the third reference authentication data is obtained by the sending device based on the N key negotiation algorithms indicated in the first information sent by the sending device, the sent third information, the pre-set shared key PSK, a random number (NONCE 1), and KDF 6. That is, the third reference authentication data=KDF 6 (PSK, N key negotiation algorithms indicated in the sent first information, the third information, NONCE 1). Therefore, if the first information and the third information are not tampered with during the transmission period, that is, the first information and the third information received by the receiving device match the first information and the third information sent by the sending device, respectively, the authentication data AUTH 3 matches the third reference authentication data. If the first information and / or the third information are tampered with during the transmission period, the authentication data AUTH 3 does not match the third reference authentication data. Therefore, according to the matching result of the authentication data AUTH 3 with the third reference authentication data, the sending device can determine whether the first information received by the receiving device matches the first information sent by the sending device, and whether the third information received by the receiving device matches the third information sent by the sending device. If the authentication data AUTH 3 matches the reference authentication data, it indicates that neither the first information nor the third information has been tampered with, and the key negotiation between the sending device and the receiving device is successful; otherwise, the sending device discards the fourth information and disconnects from the receiving device.
[0163] When AUTH 3 is obtained by method 2, the third reference authentication data is obtained by the sending device based on the N key negotiation algorithms indicated in the first information sent by the sending device, the sent third information, the pre-set shared key PSK, and KDF 6. That is, the third reference authentication data=KDF 7 (PSK, N key negotiation algorithms indicated in the first information sent, the third information). Therefore, if the first information and the third information are not tampered with during the transmission period, that is, the first information and the third information received by the receiving device match the first information and the third information sent by the sending device respectively, the authentication data AUTH 3 matches the third reference authentication data. If the first information and / or the third information are tampered with during the transmission period, the authentication data AUTH 3 does not match the third reference authentication data. Therefore, according to the matching result of the authentication data AUTH 3 with the third reference authentication data, the sending device can determine whether the first information received by the receiving device matches the first information sent by the sending device, and whether the third information received by the receiving device matches the third information sent by the sending device. If the authentication data AUTH 3 matches the reference authentication data, it indicates that neither the first information nor the third information has been tampered with, and the key negotiation between the sending device and the receiving device is successful; otherwise, the sending device discards the fourth information and disconnects from the receiving device.
[0164] It should be noted that the KDF for obtaining AUTH 3 and the KDF for obtaining the third reference authentication data are not limited in this embodiment of the present application, as long as the KDF for obtaining AUTH 3 is the same as the KDF for obtaining the third reference authentication data, and the parameters for obtaining AUTH 3 correspond one-to-one with the parameters for obtaining the third reference authentication data.For example, AUTH 3 is obtained by using KDF 6, K key negotiation algorithms indicated in the first information received by the receiving device, the received third information, a pre-set shared key PSK, and a random number (NONCE 1).Correspondingly, the third reference authentication data is obtained by using KDF 6, N key negotiation algorithms indicated in the first information sent by the sending device, the sent third information, a pre-set shared key PSK, and a random number (NONCE 1).
[0165] In this embodiment, during the key negotiation between the sending device and the receiving device, the sending device informs the receiving device of all the key negotiation algorithms supported by the sending device by using the first information, and the receiving device selects a key negotiation algorithm supported by the receiving device from the received key negotiation algorithms supported by the sending device. In this way, the key negotiation algorithm selected by the receiving device is supported by both the sending device and the receiving device. This avoids the key negotiation algorithm negotiation failure caused by the sending device not supporting the key negotiation algorithm selected by the receiving device, and improves the key negotiation efficiency. In addition, the key negotiation method provided in this embodiment of the present application supports the algorithm of Chinese encryption.
[0166] 5 is a flowchart of a key negotiation method according to another embodiment of the present application. As shown in FIG. 5, the key negotiation method in this embodiment of the present application includes the following steps:
[0167] S501: A sending device sends first information to a receiving device. In response, the receiving device receives the first information.
[0168] The first information is used to indicate N key negotiation algorithms, where N is an integer equal to or greater than 1, and the N key negotiation algorithms are supported by the sending device.
[0169] For example, the first information is carried in a negotiation packet. Specifically, before two devices in a communication system perform data transmission, the two devices need to perform key negotiation to obtain a target key, so as to encrypt and decrypt the transmitted data based on the target key. When a sending device and a receiving device perform key negotiation, the initiating device sends a negotiation packet to the receiving device.
[0170] Optionally, the first information is further used to indicate priority information of the N key negotiation algorithms, and the identification information of the N key negotiation algorithms included in the first information are arranged or encapsulated based on the priority information of the N key negotiation algorithms.
[0171] For example, the N key negotiation algorithms indicated by the first information are arranged in descending order of priority, or the N key negotiation algorithms indicated by the first information are arranged in ascending order of priority. For example, as shown in Table 2, the first information is used to indicate algorithm 1, algorithm 2, algorithm 3, algorithm 4, and algorithm 5. The priority of algorithm 4 is higher than the priority of algorithm 2, which is higher than the priority of algorithm 5, which is higher than the priority of algorithm 1, which is higher than the priority of algorithm 3.
[0172] S502: The receiving device determines a target key negotiation algorithm.
[0173] The target key negotiation algorithm is a key negotiation algorithm among the N key negotiation algorithms that is supported by the receiving device.
[0174] In this embodiment, the receiving device determines a key negotiation algorithm supported by the receiving device as a target negotiation algorithm from the N key negotiation algorithms in the first information.
[0175] Optionally, the receiving device selects a key negotiation algorithm that is among the N key negotiation algorithms and has the highest priority with respect to the sending device among the key negotiation algorithms supported by the receiving device based on priority information of the N key negotiation algorithms indicated in the received first information, and uses the key negotiation algorithm as a target negotiation algorithm.
[0176] For example, Table 3 shows all key negotiation algorithms supported by the receiving device. The first information received by the receiving device shows five key negotiation algorithms shown in Table 1. In the first information, the identifiers of the five algorithms are arranged in descending order of priority. It can be known from Table 1 to Table 3 that, among the five key negotiation algorithms, the receiving device supports algorithm 2, algorithm 3, and algorithm 5, and the priority of algorithm 2 is higher than the priority of algorithm 3 and the priority of algorithm 5. In this case, the receiving device selects algorithm 2 as the target negotiation algorithm.
[0177] Optionally, based on the N key negotiation algorithms indicated in the received first information, the receiving device determines a key negotiation algorithm that is among the N key negotiation algorithms and has the highest priority for the receiving device among the key negotiation algorithms supported by the receiving device, and uses the key negotiation algorithm as a target negotiation algorithm.
[0178] For example, Table 4 shows the priority information of the key negotiation algorithms supported by the receiving device. As shown in Table 3, the first information received by the receiving device shows the five key negotiation algorithms shown in Table 1, and the receiving device supports algorithm 2, algorithm 3, and algorithm 5 in the five key negotiation algorithms. For the receiving device, it can be known from Table 4 that the priority of algorithm 3 is higher than the priority of algorithm 2, and the priority of algorithm 2 is higher than the priority of algorithm 5. In this case, the receiving device selects algorithm 3 as the target negotiation algorithm. It should be noted that in this embodiment, the N key negotiation algorithms supported by the sending device, which are shown in the first information, may not be arranged according to priority information, i.e., the first information does not show the priority information of the N key negotiation algorithms supported by the sending device.
[0179] S503: The receiving device generates first key negotiation parameters based on the target key negotiation algorithm.
[0180] The first key negotiation parameter is a key negotiation parameter corresponding to the receiving device and obtained based on a target key negotiation algorithm.
[0181] For example, the receiving device obtains the key negotiation parameter KE1 through calculation by using the selected key negotiation algorithm.
[0182] S504: The receiving device transmits second information to the transmitting device, and in response, the transmitting device receives the second information from the receiving device.
[0183] The second information indicates a target key negotiation algorithm and includes the first key negotiation parameters, and optionally, the second information further indicates M key negotiation algorithms supported by the receiving device.
[0184] In this embodiment, the second information further indicates M key negotiation algorithms supported by the receiving device, so that the sending device determines whether the key negotiation algorithm selected by the receiving device is supported by both the receiving device and the sending device. If it is determined that the key negotiation algorithm selected by the receiving device is supported by both the receiving device and the sending device, the sending device performs S505; otherwise, the sending device discards the second information and disconnects from the receiving device.
[0185] The second information may indicate the M key negotiation algorithms in any one of the following manners.
[0186] Method 1: The second information includes identifiers of M key negotiation algorithms supported by the receiving device, so that the sending device obtains the M key negotiation algorithms supported by the receiving device.
[0187] The algorithm identifiers shown in Table 1 are used as examples. If the second information includes ID 2, ID 3, and ID 5, the second information is used to indicate algorithm 2, algorithm 3, and algorithm 5. If the second information includes ID 1 and ID 5, the second information is used to indicate algorithm 1 and algorithm 5.
[0188] It can be understood that Table 1 is only an example of the key negotiation algorithm identifier indicated by the second information. In a specific application, the key negotiation algorithm indicated by the second information may alternatively be in another form, and is not limited thereto.
[0189] Method 2: The second information includes a bit sequence, where one bit in the bit sequence corresponds to one algorithm, and each bit in the bit sequence may be 0 or 1 to indicate whether the second information indicates the algorithm corresponding to that bit. For example, if a bit is 1, it may indicate that the second information indicates the algorithm corresponding to that bit, and if the bit is 0, it may indicate that the second information does not indicate the algorithm corresponding to that bit.
[0190] For example, the first information includes four bits, where a first bit in the four bits corresponds to algorithm 1, a second bit corresponds to algorithm 2, a third bit corresponds to algorithm 3, and a fourth bit corresponds to algorithm 4. If the four bits are 1001, it may indicate that the second information is used to indicate algorithm 1 and algorithm 4. If the five bits are 1100, it may indicate that the first algorithm negotiation request information is used to indicate algorithm 1 and algorithm 2.
[0191] Optionally, the sending device determines the priority of the key negotiation algorithm supported by the receiving device based on the M key negotiation algorithms supported by the receiving device indicated in the received second information, so as to determine whether the key negotiation algorithm selected by the receiving device is the key negotiation algorithm with the highest priority for the sending device or the receiving device in the algorithms supported by both the receiving device and the sending device. If yes, the sending device performs S505; if not, the sending device discards the second information and disconnects from the receiving device.
[0192] For example, the key negotiation algorithms supported by the receiving device include algorithm 2, algorithm 3, algorithm 5, and algorithm 6. For the receiving device, as shown in Table 4, the priority of algorithm 3 is higher than the priority of algorithm 6, which is higher than the priority of algorithm 2. Also, the priority of algorithm 2 is higher than the priority of algorithm 5.
[0193] It can be learned by referring to Tables 2 and 4 that when the receiving device selects a key negotiation algorithm having the highest priority for the sending device among the algorithms supported by both the receiving device and the sending device as a target negotiation algorithm, the target negotiation algorithm obtained by the sending device by using the second information should be algorithm 2. If the target negotiation algorithm obtained by the sending device by using the second information is not algorithm 2, the sending device discards the second information.
[0194] If the receiving device selects as the target negotiation algorithm a key negotiation algorithm that has the highest priority for the receiving device among the algorithms supported by both the receiving device and the sending device, the target negotiation algorithm obtained by the sending device by using the second information should be algorithm 3. If the target negotiation algorithm obtained by the sending device by using the second information is not algorithm 3, the sending device discards the second information.
[0195] For example, techniques by which a sending device may determine the priority of key negotiation algorithms supported by a receiving device include the following.
[0196] Method 1: The sending device receives priority information of M key negotiation algorithms from the receiving device. For example, a key negotiation is performed between the sending device and the receiving device. During the key negotiation period, the receiving device indicates the priority of the key negotiation algorithms supported by the receiving device to the sending device by using the information. Then, the sending device associates the priority of the key negotiation algorithms supported by the receiving device with the receiving device and stores the association. Therefore, in this key negotiation process, the sending device determines the priority of the key negotiation algorithms supported by the receiving device based on the identifier of the receiving device.
[0197] Method 2: The second information is further used to indicate priority information of the M key negotiation algorithms supported by the receiving device. The second information includes identification information of the M key negotiation algorithms, and the identification information is arranged or encapsulated based on the priorities of the M key negotiation algorithms. In this case, the sending device obtains the priority information of the key negotiation algorithms supported by the receiving device based on the second information.
[0198] Optionally, the second information further carries a first random number, where the first random number (NONCE 1) is a random number generated by the receiving device.
[0199] Optionally, the second information further carries an identifier of the receiving device. The identifier of the receiving device is used to identify the receiving device.
[0200] S505: The sending device generates a target key based on the target key negotiation algorithm and the first key negotiation parameters.
[0201] In this embodiment, the second information carries an identifier of a target key negotiation algorithm, so that the sending device determines the key negotiation algorithm selected by the receiving device by using the identifier of the target key negotiation algorithm, and generates a target key KE according to the target key negotiation algorithm and the key negotiation parameter KE 1. And the sending device calculates a key negotiation parameter KE 2 according to the target key negotiation algorithm.
[0202] Optionally, after determining the target key negotiation algorithm by using the second information, the sending device determines whether the target key negotiation algorithm is one of the N key negotiation algorithms indicated by the first information, and if yes, the sending device obtains a target key and / or key negotiation parameters KE2 based on the target key negotiation algorithm, and if no, the sending device discards the second information.
[0203] Optionally, the sending device obtains an encryption key and an integrity protection key based on the target key KE. The encryption key is used to encrypt information transmitted between the sending device and the receiving device. The integrity protection key is used to provide integrity protection to the information transmitted between the sending device and the receiving device.
[0204] The manner in which the sending device obtains the encryption and integrity protection keys is as follows.
[0205] The sending device randomly generates a second random number (NONCE 2), and the sending device uses the target key KE, the random number (NONCE 1), and the random number (NONCE 2) as inputs to a key derivation function (KDF) KDF 1 to obtain a shared key Kgt, i.e., Kgt=KDF 1(KE, NONCE 1, NONCE 2).
[0206] The sending device uses the shared key Kgt as input for KDF 2 to obtain an encryption key and an integrity protection key, i.e., Kenc=KDF 2(Kgt). Similarly, Kint=KDF 3(Kgt), where Kenc is the encryption key and Kint is the integrity protection key.
[0207] In another approach, after obtaining the target key KE, the sending device uses the target key KE as an input of KDF 2 to obtain an encryption key and an integrity protection key, i.e., Kenc=KDF 2(KE). Similarly, Kint=KDF 3(KE). Kenc is the encryption key and Kint is the integrity protection key.
[0208] It should be noted that KDF 1, KDF 2, and KDF 3 may be the same or different. Also, the KDF used to derive the shared key Kgt, the KDF used to derive the encryption key Kenc, and the KDF used to derive the integrity protection key Kint are not limited in this application.
[0209] It can be understood that the manner of obtaining the shared key Kgt, the encryption key Kenc, and the integrity protection key Kint in this embodiment of the present application is not intended to limit the present application, and another manner may be used as an alternative. For example, Kenc=KDF 2(Kgt, ID 1), and Kint=KDF 3(Kgt, ID 2), where ID 1 is the identifier of the encryption algorithm, and ID 2 is the identifier of the integrity protection algorithm.
[0210] Optionally, the method further includes S506: the sending device sends the third information to the receiving device, and correspondingly, the receiving device receives the third information from the sending device.
[0211] The third information includes a second key negotiation parameter, where the second key negotiation parameter corresponds to the sending device and is obtained based on a target key negotiation algorithm.
[0212] Specifically, the third information carries a second random number (NONCE 2).
[0213] Optionally, the second information transmitted by the receiving device to the sending device is not secured, so that the second information may be tampered with during the sending process. If the second information is tampered with, the key negotiation between the sending device and the receiving device may fail. Therefore, it is necessary to verify whether the second information is tampered with. The manner of verifying whether the second information is tampered with may be, for example, as follows.
[0214] The sending device performs an authentication process on the second information, generates a first authentication data AUTH 1 by using the second information as a parameter, and sends the authentication data AUTH 1 to the receiving device, so that the receiving device verifies whether the second information has been tampered with. Optionally, the third information includes the authentication data AUTH 1. A method for obtaining AUTH 1 includes:
[0215] Method 1: The authentication data AUTH1 is obtained by the sending device based on the second information received by the sending device, the pre-set shared key PSK, and KDF4, i.e. AUTH1=KDF4(PSK, second information). The pre-set shared key PSK is a key shared in advance by the sending device and the receiving device, so that based on the pre-set shared key PSK, verification can be performed on the identity of both the sending device and the receiving device, so as to avoid tampering with the information exchanged between the sending device and the receiving device. It should be noted that the method of pre-setting the pre-set shared key PSK is not limited in this embodiment of the present application. For example, the pre-set shared key PSK may be obtained by inputting the same number in advance into each of the sending device and the receiving device, or may be obtained by using the same derivation algorithm after the target key KE is obtained.
[0216] Correspondingly, after receiving the third information, the receiving device obtains the authentication data AUTH1 and compares the authentication data AUTH1 with the first reference authentication data. The first reference authentication data is obtained by the receiving device according to the transmitted second information, the pre-set shared key PSK and KDF4, i.e., the first reference authentication data=KDF4(PSK, second information). Therefore, if the second information has not been tampered with during the sending process, i.e., if the second information received by the sending device matches the second information sent by the receiving device, the authentication data AUTH1 matches the reference authentication data, otherwise, the authentication data AUTH1 does not match the reference authentication data. Therefore, the receiving device can determine whether the second information received by the sending device matches the second information sent by the receiving device according to the comparison result between the authentication data AUTH1 and the first reference authentication data. If the authentication data AUTH 1 matches the reference authentication data, it indicates that the second information has not been tampered with; if not, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0217] Method 2: The authentication data AUTH 1 is obtained by the sending device based on the second information received by the sending device, the random number (NONCE 2), the pre-set shared key PSK, and KDF 5, i.e., AUTH 1=KDF 5(PSK, NONCE, second information 2). Correspondingly, the first reference authentication data is obtained by the receiving device based on the transmitted second information, the random number (NONCE 2) in the received third information, the pre-set shared key PSK, and KDF 5, i.e., the first reference authentication data=KDF 5(PSK, NONCE, second information 2). Therefore, if the second information has not been tampered with during the sending process, i.e., the second information received by the sending device matches the second information sent by the receiving device, and the random number (NONCE 2) in the third information has not been tampered with, the authentication data AUTH 1 matches the reference authentication data, otherwise, the authentication data AUTH 1 does not match the reference authentication data. Therefore, the receiving device may determine whether the second information received by the sending device matches the second information sent by the receiving device according to the matching result between the authentication data AUTH 1 and the first reference authentication data. If the authentication data AUTH 1 matches the reference authentication data, it indicates that the second information and the random number (NONCE 2) have not been tampered with, otherwise, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0218] In this embodiment of the present application, AUTH 1 may alternatively be obtained in other ways, which are not enumerated one by one in this specification.
[0219] It should be noted that the KDF for obtaining AUTH 1 and the KDF for obtaining the first reference authentication data are not limited in this embodiment of the present application, as long as the KDF for obtaining AUTH 1 is the same as the KDF for obtaining the first reference authentication data, and the parameters for obtaining AUTH 1 correspond one-to-one with the parameters for obtaining the first reference authentication data. For example, AUTH 1 is obtained by using KDF 4, the second information received by the sending device, and the pre-set shared key PSK, and correspondingly, the first reference authentication data is obtained by using KDF 4, the second information sent by the receiving device, and the pre-set shared key PSK.
[0220] Optionally, the third information is information that has been processed by using an integrity protection algorithm.
[0221] For example, before S406 is performed, after the sending device obtains the encryption key Kenc and the integrity protection key Kint, the sending device obtains a first message authentication code (MAC) based on the integrity protection algorithm, the integrity protection key Kint, and some or all of the information in the third information sent by the sending device, and performs integrity protection on the third information by using the first MAC. For example, the third information includes the first MAC.
[0222] S507: The receiving device generates a target key based on the second key negotiation parameters and the target key negotiation algorithm.
[0223] In this embodiment, after receiving the key negotiation parameters KE2 of the sending device, the receiving device obtains the target key KE according to the key negotiation algorithm and the received key negotiation parameters KE2.
[0224] Optionally, the receiving device obtains an encryption key Kenc and an integrity protection key Kint based on the target key KE by using the same method as the sending device. The receiving device obtains a second message authentication code MAC based on the integrity protection algorithm, the integrity protection key Kint, and some or all of the information in the third information received by the receiving device. If the first MAC matches the second MAC, it indicates that the third information has not been tampered with. If not, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0225] Optionally, the method further includes: S508. The receiving device transmits the fourth information to the transmitting device. In response, the transmitting device receives the fourth information.
[0226] Optionally, the method further includes: S509: The sending device attempts to verify the fourth information.
[0227] In this embodiment, the fourth information further includes second authentication data AUTH2, which is authentication data obtained after the receiving device performs an authentication process on the third information. The second authentication data AUTH2 is used to indicate whether the third information has been tampered with. Whether the third information has been tampered with is indicated by using a matching result between the second authentication data AUTH2 and the second reference authentication data. The second reference authentication data is authentication data obtained after the authentication process is performed on the third information.
[0228] The second information indicates all key negotiation algorithms supported by the receiving device. If S508 is performed, it indicates that the first information and the second information have not been tampered with during the sending process. Therefore, it is not necessary to check whether the first information has been tampered with.
[0229] The sending device sends the third information to the receiving device to enable the receiving device to obtain the target key. However, since the receiving device does not generate the target key, the encryption key cannot be generated. Therefore, the sending device cannot encrypt the third information, that is, the third information is not protected by security, and as a result, the third information may be tampered with during the transmission period. If the third information is tampered with, the information in the communication between the sending device and the receiving device may be leaked. Therefore, it is necessary to determine whether the third information is tampered with. Therefore, the receiving device performs an authentication process on the third information to obtain the second authentication data AUTH 2. And since the third information is sent by the sending device, the authentication data AUTH 2 is included in the fourth information and sent to the sending device, and the sending device determines whether the third information is tampered with. For example, AUTH 2 is obtained by the receiving device based on the received third information, a pre-configured shared key PSK, a random number (NONCE 1), and KDF 6, i.e., AUTH 2=KDF 8(PSK, third information, NONCE 1).
[0230] The sending device obtains AUTH 2 from the fourth information, and compares the authentication data AUTH 2 with the second reference authentication data. The second reference authentication data is obtained by the sending device based on the third information sent by the sending device, the pre-set shared key PSK, the random number (NONCE 1), and KDF 8, i.e., the third reference authentication data=KDF 8(PSK, third information, NONCE 1). Therefore, if the third information is not tampered with during the transmission period, i.e., the third information received by the receiving device matches the third information sent by the sending device, the authentication data AUTH 2 matches the second reference authentication data. If the third information is tampered with during the transmission period, the authentication data AUTH 2 does not match the second reference authentication data. Therefore, the sending device may determine whether the third information received by the receiving device matches the third information sent by the sending device according to the matching result between the authentication data AUTH2 and the second reference authentication data. If the authentication data AUTH2 matches the reference authentication data, it indicates that the third information has not been tampered with and the key negotiation between the sending device and the receiving device is successful; if not, the sending device discards the fourth information and disconnects from the receiving device.
[0231] 6 is a flowchart of a key negotiation method according to another embodiment of the present application. As shown in FIG. 6, the key negotiation method in this embodiment of the present application includes the following steps:
[0232] S601: A sending device sends first information to a receiving device. In response, the receiving device receives the first information.
[0233] The first information is used to indicate N key negotiation algorithms, where N is an integer equal to or greater than 1, and the N key negotiation algorithms are supported by the sending device.
[0234] For example, the first information is carried in a negotiation packet. Specifically, before two devices in a communication system perform data transmission, the two devices need to perform key negotiation to obtain a target key, so as to encrypt and decrypt the transmitted data based on the target key. When a sending device and a receiving device perform key negotiation, the initiating device sends a negotiation packet to the receiving device.
[0235] Optionally, the first information is further used to indicate priority information of the N key negotiation algorithms, and the identification information of the N key negotiation algorithms included in the first information are arranged or encapsulated based on the priority information of the N key negotiation algorithms.
[0236] For example, the N key negotiation algorithms indicated by the first information are arranged in descending order of priority, or the N key negotiation algorithms indicated by the first information are arranged in ascending order of priority. For example, as shown in Table 2, the first information is used to indicate algorithm 1, algorithm 2, algorithm 3, algorithm 4, and algorithm 5. The priority of algorithm 4 is higher than the priority of algorithm 2, which is higher than the priority of algorithm 5, which is higher than the priority of algorithm 1, which is higher than the priority of algorithm 3.
[0237] S602: The receiving device determines a target key negotiation algorithm.
[0238] The target key negotiation algorithm is a key negotiation algorithm among the N key negotiation algorithms that is supported by the receiving device.
[0239] In this embodiment, the receiving device determines a key negotiation algorithm supported by the receiving device as a target negotiation algorithm from the N key negotiation algorithms in the first information.
[0240] Optionally, based on priority information of the N key negotiation algorithms indicated in the received first information, the receiving device selects a key negotiation algorithm that is among the N key negotiation algorithms and has the highest priority with respect to the sending device among the key negotiation algorithms supported by the receiving device, and uses the key negotiation algorithm as the target negotiation algorithm.
[0241] For example, Table 3 shows all key negotiation algorithms supported by the receiving device. The first information received by the receiving device shows five key negotiation algorithms shown in Table 1. In the first information, the identifiers of the five algorithms are arranged in descending order of priority. It can be known from Table 1 to Table 3 that, among the five key negotiation algorithms, the receiving device supports algorithm 2, algorithm 3, and algorithm 5, and the priority of algorithm 2 is higher than the priority of algorithm 3 and the priority of algorithm 5. In this case, the receiving device selects algorithm 2 as the target negotiation algorithm.
[0242] Optionally, based on the N key negotiation algorithms indicated in the received first information, the receiving device determines a key negotiation algorithm that is among the N key negotiation algorithms and has the highest priority for the receiving device among the key negotiation algorithms supported by the receiving device, and uses the key negotiation algorithm as the target negotiation algorithm.
[0243] For example, Table 4 shows the priority information of the key negotiation algorithms supported by the receiving device. As shown in Table 3, the first information received by the receiving device shows the five key negotiation algorithms shown in Table 1, and the receiving device supports algorithm 2, algorithm 3, and algorithm 5 in the five key negotiation algorithms. For the receiving device, it can be known from Table 4 that the priority of algorithm 3 is higher than the priority of algorithm 2, and the priority of algorithm 2 is higher than the priority of algorithm 5. In this case, the receiving device selects algorithm 3 as the target negotiation algorithm. It should be noted that in this embodiment, the N key negotiation algorithms supported by the sending device shown in the first information may not be arranged according to priority information, i.e., the first information does not show the priority information of the N key negotiation algorithms supported by the sending device.
[0244] S603: The receiving device generates first key negotiation parameters based on the target key negotiation algorithm.
[0245] The first key negotiation parameter is a key negotiation parameter corresponding to the receiving device and obtained based on a target key negotiation algorithm.
[0246] For example, the receiving device obtains the key negotiation parameter KE1 through calculation by using the selected key negotiation algorithm.
[0247] S604: The receiving device transmits second information to the sending device, and in response, the sending device receives the second information from the receiving device.
[0248] The second information indicates a target key negotiation algorithm and includes the first key negotiation parameters.
[0249] Optionally, the second information further carries a first random number, where the first random number (NONCE 1) is a random number generated by the receiving device.
[0250] Optionally, the second information further carries an identifier of the receiving device. The identifier of the receiving device is used to identify the receiving device.
[0251] S605: The sending device generates a target key based on the target key negotiation algorithm and the first key negotiation parameters.
[0252] In this embodiment, the second information carries an identifier of a target key negotiation algorithm, so that the sending device determines the key negotiation algorithm selected by the receiving device by using the identifier of the target key negotiation algorithm, and generates a target key KE according to the target key negotiation algorithm and a key negotiation parameter KE 1. And the sending device obtains a second key negotiation parameter, represented as KE 2, through calculation based on the target key negotiation algorithm.
[0253] Optionally, after determining the target key negotiation algorithm by using the second information, the sending device determines whether the target key negotiation algorithm is one of the N key negotiation algorithms indicated by the first information, and if yes, the sending device obtains a target key and / or key negotiation parameters KE2 based on the target key negotiation algorithm, and if no, the sending device discards the second information.
[0254] Optionally, the sending device obtains an encryption key and an integrity protection key based on the target key KE. The encryption key is used to encrypt information transmitted between the sending device and the receiving device. The integrity protection key is used to provide integrity protection to the information transmitted between the sending device and the receiving device.
[0255] The manner in which the sending device obtains the encryption and integrity protection keys is as follows.
[0256] The sending device randomly generates a second random number (NONCE 2), and the sending device uses the target key KE, the random number (NONCE 1), and the random number (NONCE 2) as inputs to a key derivation function (KDF) KDF 1 to obtain a shared key Kgt, i.e., Kgt=KDF 1(KE, NONCE 1, NONCE 2).
[0257] The sending device uses the shared key Kgt as input for KDF 2 to obtain an encryption key and an integrity protection key, i.e., Kenc=KDF 2(Kgt). Similarly, Kint=KDF 3(Kgt), where Kenc is the encryption key and Kint is the integrity protection key.
[0258] In another approach, after obtaining the target key KE, the sending device uses the target key KE as an input of KDF 2 to obtain an encryption key and an integrity protection key, i.e., Kenc=KDF 2(KE). Similarly, Kint=KDF 3(KE). Kenc is the encryption key and Kint is the integrity protection key.
[0259] It should be noted that KDF 1, KDF 2, and KDF 3 may be the same or different. Also, the KDF used to derive the shared key Kgt, the KDF used to derive the encryption key Kenc, and the KDF used to derive the integrity protection key Kint are not limited in this application.
[0260] It can be understood that the manner of obtaining the shared key Kgt, the encryption key Kenc, and the integrity protection key Kint in this embodiment of the present application is not intended to limit the present application, and another manner may be used as an alternative. For example, Kenc=KDF 2(Kgt, ID 1), and Kint=KDF 3(Kgt, ID 2), where ID 1 is the identifier of the encryption algorithm, and ID 2 is the identifier of the integrity protection algorithm.
[0261] Optionally, the method further includes S606: the sending device sends the third information to the receiving device, and in response, the receiving device receives the third information from the sending device.
[0262] The third information includes a second key negotiation parameter, the second key negotiation parameter corresponds to the sending device and is obtained based on the target key negotiation algorithm, and the third information is further used to indicate the N key negotiation algorithms supported by the sending device. The receiving device determines whether the first information has been tampered with.
[0263] The third information again indicates the N key negotiation algorithms supported by the sending device. Since the third information is integrity protected, the receiving device can determine whether the third information has been tampered with by using a comparison result between the first MAC and the second MAC. When the third information is not tampered with, if the N key negotiation algorithms supported by the sending device indicated by the third information match the N key negotiation algorithms supported by the sending device obtained from the first information, it indicates that the first information has not been tampered with; otherwise, it indicates that the first information has been tampered with, and the receiving device discards the third information and disconnects from the sending device.
[0264] S607: The receiving device generates a target key based on the second key negotiation parameters and the target key negotiation algorithm.
[0265] In this embodiment, after receiving the key negotiation parameters KE2 of the sending device, the receiving device obtains the target key KE according to the key negotiation algorithm and the received key negotiation parameters KE2.
[0266] Optionally, the receiving device obtains an encryption key Kenc and an integrity protection key Kint based on the target key KE by using the same method as the sending device. The receiving device obtains a second message authentication code MAC based on the integrity protection algorithm, the integrity protection key Kint, and some or all of the information in the third information received by the receiving device. If the first MAC matches the second MAC, it indicates that the third information has not been tampered with. If not, the receiving device may discard the third information, release the current connection between the receiving device and the sending device, and then resend the second information.
[0267] Optionally, the method further includes: S608. The receiving device transmits the fourth information to the transmitting device. In response, the transmitting device receives the fourth information.
[0268] Optionally, the method further includes: S609: The sending device attempts to verify the fourth information.
[0269] In this embodiment, the fourth information further includes second authentication data AUTH2, where the second authentication data is authentication data obtained after the receiving device performs an authentication process on the third information. The second authentication data is used to indicate whether the third information has been tampered with. Whether the third information has been tampered with is indicated by using a matching result between the second authentication data and second reference authentication data. The second reference authentication data is authentication data obtained after the authentication process is performed on the third information.
[0270] The sending device sends the third information to the receiving device to enable the receiving device to obtain the target key. However, since the receiving device does not generate the target key, the encryption key cannot be generated. Therefore, the sending device cannot encrypt the third information, that is, the third information is not protected by security, and as a result, the third information may be tampered with during the transmission period. If the third information is tampered with, the information in the communication between the sending device and the receiving device may be leaked. Therefore, it is necessary to determine whether the third information is tampered with. Therefore, the receiving device performs an authentication process on the third information to obtain the second authentication data AUTH 2, adds the authentication data AUTH 2 to the fourth information, and transmits the fourth information to the sending device. Since the third information is transmitted by the sending device, the sending device determines whether the third information is tampered with. For example, AUTH 2 is obtained by the receiving device based on the received third information, a pre-configured shared key PSK, a random number (NONCE 1), and KDF 6, i.e., AUTH 2=KDF 6(PSK, third information, NONCE 1).
[0271] The sending device obtains AUTH 2 from the fourth information, and compares the authentication data AUTH 2 with the second reference authentication data. The second reference authentication data is obtained by the sending device based on the third information sent by the sending device, the pre-set shared key PSK, the random number (NONCE 1), and KDF 5, i.e., the third reference authentication data=KDF 6(PSK, third information, NONCE 1). Therefore, if the third information is not tampered with during the transmission period, i.e., the third information received by the receiving device matches the third information sent by the sending device, the authentication data AUTH 2 matches the second reference authentication data. If the third information is tampered with during the transmission period, the authentication data AUTH 2 does not match the second reference authentication data. Therefore, the sending device may determine whether the third information received by the receiving device matches the third information sent by the sending device according to the matching result between the authentication data AUTH2 and the second reference authentication data. If the authentication data AUTH2 matches the reference authentication data, it indicates that the third information has not been tampered with and the key negotiation between the sending device and the receiving device is successful; if not, the sending device disconnects from the receiving device.
[0272] 7 is a flowchart of a key negotiation method according to another embodiment of the present application. As shown in FIG. 7, the key negotiation method in this embodiment of the present application includes the following steps:
[0273] S701: Transmit sixth information. Correspondingly, the receiving device receives the sixth information.
[0274] In this embodiment, compared with the first information, the sixth information does not indicate the N key negotiation algorithms supported by the sending device. Therefore, after receiving the sixth information, the receiving device cannot learn about the key negotiation algorithms supported by the sending device.
[0275] S702: The receiving device determines a first target key negotiation algorithm.
[0276] The first target key negotiation algorithm is a key negotiation algorithm determined by the receiving device from the M key negotiation algorithms.
[0277] In this embodiment, since the receiving device does not learn about the key negotiation algorithms supported by the sending device, the receiving device determines a first target key negotiation algorithm from the M key negotiation algorithms supported by the receiving device.
[0278] S703: The receiving device generates first key negotiation parameters based on a first target key negotiation algorithm.
[0279] In this embodiment, the receiving device generates a private key, which is known only to the receiving device, and the receiving device generates a public key by using a selected key negotiation algorithm, and the public key is a key negotiation parameter KE1.
[0280] S704: The receiving device transmits second information to the sending device, and in response, the sending device receives the second information from the receiving device.
[0281] The second information is used to indicate the M key negotiation algorithms supported by the receiving device, the first target key negotiation parameter, and the first key negotiation parameter.
[0282] S705: The sending device determines whether to perform target key negotiation based on a first target key negotiation algorithm, and if yes, performs S706, or if no, performs S710.
[0283] In this embodiment, when selecting the first target key negotiation algorithm, the receiving device does not know the key negotiation algorithm supported by the sending device. Therefore, the first target key negotiation algorithm may not be supported by the sending device. Therefore, after receiving the second information, the sending device determines whether the first target key negotiation algorithm is supported by the sending device, and if yes, performs S706; if not, performs S710.
[0284] Optionally, the sending device may further determine whether the first target key negotiation is the key negotiation algorithm with the highest priority for the sending device among the algorithms supported by the sending device and also supported by the receiving device. If yes, S706 is performed; if not, S710 is executed.
[0285] Optionally, the second information further indicates the priority information of the M key negotiation algorithms supported by the receiving device. Thus, the sending device can learn about the priority information of the M key negotiation algorithms supported by the receiving device based on the second information. In this case, the sending device can further determine whether the first target key negotiation is the key negotiation algorithm that has the highest priority for the receiving device among the algorithms supported by the sending device and also supported by the receiving device. If yes, S706 is performed; if not, S710 is performed.
[0286] S706: The sending device generates a target key based on the first target key negotiation algorithm and the first key negotiation parameters.
[0287] In this embodiment, the sending device generates a target key KE based on a first target key negotiation algorithm and a key negotiation parameter KE 1. The sending device also generates a private key, which is known only to the sending device, and then the sending device obtains a corresponding public key through calculation based on the first target key negotiation algorithm. The public key is a second key negotiation parameter and is represented as KE 2.
[0288] S707: The sending device sends the third information to the receiving device. In response, the receiving device receives the third information from the sending device.
[0289] The third information includes a second key negotiation parameter.
[0290] S708: The receiving device generates a target key based on the second key negotiation parameters and the first target key negotiation algorithm.
[0291] In this embodiment, the third information includes key negotiation parameters KE2, and after receiving the third information, the receiving device generates a target key KE based on the key negotiation parameters KE2 and the first target key negotiation algorithm.
[0292] S709: The receiving device transmits the fourth information to the transmitting device. In response, the transmitting device receives the fourth information.
[0293] The fourth piece of information is used by the sending device to determine whether the key negotiation will be successful.
[0294] S710: The sending device determines a second target key negotiation algorithm.
[0295] The second target key negotiation algorithm is a key negotiation algorithm supported by both the sending device and the receiving device and determined by the sending device from the N key negotiation algorithms and the M key negotiation algorithms.
[0296] In this embodiment, the sending device knows M key negotiation algorithms supported by the receiving device, in which case the sending device selects a key negotiation algorithm supported by both the sending device and the receiving device as the second target key negotiation algorithm from the N key negotiation algorithms supported by the sending device and the M key negotiation algorithms supported by the receiving device.
[0297] Optionally, the sending device may further select, from the N key negotiation algorithms supported by the sending device and the M key negotiation algorithms supported by the receiving device, a key negotiation algorithm that has the highest priority for the sending device and is supported by both the sending device and the receiving device as a second target key negotiation algorithm.
[0298] Optionally, the second information further indicates priority information of the M key negotiation algorithms supported by the receiving device.
[0299] Optionally, the sending device may further select, from the N key negotiation algorithms supported by the sending device and the M key negotiation algorithms supported by the receiving device, a key negotiation algorithm that has the highest priority for the sending device and is supported by both the sending device and the receiving device as a second target key negotiation algorithm.
[0300] Optionally, the second information further indicates priority information of the M key negotiation algorithms supported by the receiving device. In this case, the sending device may further select a key negotiation algorithm that has the highest priority for the receiving device and is supported by both the sending device and the receiving device as a second target key negotiation algorithm from the N key negotiation algorithms supported by the sending device and the M key negotiation algorithms supported by the receiving device.
[0301] S711: The transmitting device transmits seventh information to the receiving device.
[0302] The seventh information is used to indicate the second target key negotiation algorithm selected by the sending device.
[0303] For example, the sending device sends a second target key negotiation algorithm to the receiving device by using the seventh information. After receiving the seventh information, the receiving device performs steps S403 to S408 in Fig. 4, but the target key negotiation algorithm is the second target key negotiation algorithm. Specifically, the receiving device learns about the second target key negotiation algorithm based on the seventh information, and then generates a private key, where the private key is only known by the receiving device, the receiving device generates a public key by using the second key negotiation algorithm, where the public key is a key negotiation parameter KE1, and the receiving device sends the second information to the sending device, where the second information includes the key negotiation parameter KE1.
[0304] After receiving the second information, the sending device obtains key negotiation parameters KE1, and the sending device generates a private key, where the private key is known only to the sending device. The sending device obtains a target key KE according to the key negotiation parameters KE1, the private key corresponding to the sending device, and the second target key negotiation algorithm. And the sending device generates a public key based on the generated private key by using the second key negotiation algorithm, where the public key is key negotiation parameters KE2, and the sending device sends third information to the receiving device, where the third information includes the key negotiation parameters KE2.
[0305] After receiving the third information, the receiving device obtains the key negotiation parameters KE2, and the receiving device generates a secret key, where the secret key is known only to the receiving device. The receiving device obtains a target key KE according to the key negotiation parameters KE2, the secret key corresponding to the receiving device, and the second target key negotiation algorithm.
[0306] Optionally, the seventh information is used to indicate the second target key negotiation algorithm selected by the sending device and the second key negotiation parameters. After determining the second target key negotiation algorithm, the sending device generates a secret key, and the secret key is only known to the sending device. The sending device generates the key negotiation parameters KE2 by using the second target key negotiation algorithm, and sends the key negotiation parameters KE2 and the second target key negotiation algorithm to the receiving device. In this way, the receiving device can directly learn about the key negotiation parameters KE2 by using the seventh information, so that the sending device does not need to send another information to indicate the key negotiation parameters KE2, and the information exchange between the sending device and the receiving device is reduced, and the key negotiation efficiency is improved.
[0307] After receiving the seventh information, the receiving device may obtain the key negotiation parameters KE2 and the second target key negotiation algorithm of the sending device. The receiving device generates a private key, which is known only to the receiving device. Then, the receiving device generates the key negotiation parameters KE1 based on the second target key negotiation algorithm. Then, the receiving device generates the target key KE based on the key negotiation parameters KE2 and the second target key negotiation algorithm. Then, the receiving device sends the second information to the sending device, where the second information includes the key negotiation parameters KE1.
[0308] Optionally, the second information further includes a first random number (NONCE 1) randomly generated by the receiving device.
[0309] Optionally, the second information may further include fourth authentication data, and the fourth authentication data is obtained by the receiving device according to the received seventh information, the pre-set shared key PSK, and KDF 9, i.e., the fourth reference authentication data=KDF 9(PSK, the seventh information received by the receiver). After receiving the second information, the sending device compares the fourth authentication data with the fourth reference authentication data. The fourth reference authentication data is obtained by the sending device according to the transmitted seventh information, the pre-set shared key PSK, and KDF 9. In this case, if the fourth authentication data matches with the fourth reference authentication data, it indicates that the seventh information has not been tampered with during the sending process; otherwise, the sending device discards the second information and disconnects from the receiving device. Optionally, the second information is integrity-protected information.
[0310] If the seventh information has not been tampered with during the sending process, the sending device sends third information to the receiving device, where the third information is encrypted and integrity protected information. The third information includes fifth authentication data, where the fifth authentication data is obtained by the sending device according to the corresponding second information received by the sending device in S704, the pre-set shared key PSK, the second information received by the sending device and carrying the fourth authentication data, and KDF 10, that is, the fourth reference authentication data=KDF 9(PSK, the corresponding second information received by the sending device in S704, and the second information received by the sending device and carrying the fourth authentication data). After receiving the third information, the sending device compares the fifth authentication data with the fifth reference authentication data. The fifth reference authentication data is obtained by the receiving device according to the corresponding second information sent in S704, the pre-set shared key PSK, the sent second information carrying the fourth authentication data, and KDF 10. Therefore, if the fifth authentication data matches with the fifth reference authentication data, it indicates that neither the corresponding second information in S704 nor the second information carrying the fourth authentication data has been tampered with during the sending process; otherwise, the receiving device discards the third information and disconnects from the receiving device.
[0311] After receiving the second information, the sending device obtains the key negotiation parameters KE1, and obtains the target key KE based on the key negotiation parameters KE1 and the second target key negotiation algorithm.
[0312] Optionally, the seventh information further includes a second random number (NONCE 2) randomly generated by the sending device.
[0313] In the above embodiments, it can be understood that the methods or steps implemented by the sending device may be implemented by components that can be used for the receiving device, and vice versa.
[0314] Figure 8 is a schematic diagram of the structure of a key negotiation device according to an embodiment of the present application. As shown in Figure 8, the key negotiation device 800 in this embodiment may be the sending device or the receiving device mentioned in the above method embodiment. The key negotiation device may be configured to implement the method corresponding to the sending device or the receiving device described in the above method embodiment. For details, please refer to the description in the above method embodiment.
[0315] The key negotiation device 800 may include one or more processors 801. The processor 801 may be referred to as a processing unit and may implement specific control or processing functions. The processor 801 may be a general-purpose processor, a special-purpose processor, etc. For example, the processor may be a baseband processor or a central processing unit. The baseband processor may be configured to process communication protocols and communication data. The central processing unit may be configured to control the communication device, execute software programs, and process data of the software programs.
[0316] In an optional design, the processor 801 may store instructions 803 or data (e.g., intermediate data). The instructions 803 may be executed by the processor to enable the key negotiation apparatus 800 to perform a method corresponding to the sending device or receiving device described in the above method embodiments.
[0317] In another possible design, the key negotiation device 800 may include circuitry that may implement the transmitting, receiving, or communication functions in the method embodiments described above.
[0318] Optionally, the key negotiation device 800 may include one or more memories 802. The memories may store instructions 804, which, when executed on a processor, may enable the key negotiation device 800 to perform the methods described in the preceding method embodiments.
[0319] Optionally, the memory may store data. The processor and the memory may be disposed separately or integrated together.
[0320] Optionally, the key negotiation device 800 may further include a transceiver 805 and / or an antenna 806. The processor 801 may be referred to as a processing unit and controls the key negotiation device (sender device or receiver device). The transceiver 805 may be referred to as a transceiver unit, transceiver machine, transceiver circuit, transceiver, etc., and is configured to implement the receiving and transmitting functions of the key negotiation device.
[0321] In design, the key negotiation apparatus 800 is configured to implement the operation corresponding to the receiving device in the above embodiment. For example, the transceiver 805 may receive first information from the sending device. The processor 801 determines based on the first information that the receiving device will perform key negotiation with the sending device.
[0322] In another design, the key negotiation apparatus 800 is configured to implement operations corresponding to those of the sending device in the above embodiment. For example, the processor 801 may determine first information, where the first information indicates a key negotiation algorithm capability supported by the sending device, and the transceiver 805 transmits the first information to the receiving device.
[0323] For the specific implementation process of the transceiver 805 and the processor 801, please refer to the relevant descriptions in the preceding embodiments, and the details will not be described again here.
[0324] The processor 801 and transceiver 805 described in this application may be implemented in an integrated circuit (IC), an analog IC, a radio frequency integrated circuit (RFIC), a mixed signal IC, an application-specific integrated circuit (ASIC), a printed circuit board (PCB), an electronic device, etc. The processor and transceiver may be fabricated by using various IC technologies, for example, complementary metal oxide semiconductor (CMOS), N-type metal oxide semiconductor (NMOS), p-channel metal oxide semiconductor (PMOS), bipolar junction transistor (BJT), bipolar CMOS (BiCMOS), silicon germanium (SiGe), and gallium arsenide (GaAs).
[0325] Although the key negotiation device 800 is described in the above embodiment by using a sending device or a receiving device as an example, the scope of the key negotiation device described in this application is not limited to the above sending device or the above receiving device. Also, the structure of the key negotiation device may not be limited to FIG. 8. The key negotiation device 800 may be an independent device or may be part of a relatively larger device. For example, the device may be: (1) An independent integrated circuit IC, chip, or chip system or subsystem; (2) a set including one or more ICs, optionally the IC set may further include a storage component configured to store data and / or instructions; (3) ASIC, e.g., modem (MSM), (4) A module that can be embedded in another device; (5) Receivers, terminals, cellular telephones, wireless devices, mobile telephones, mobile units, network devices, etc., or (6) Other items It may be.
[0326] 9 is a schematic diagram of the structure of a key negotiation apparatus according to another embodiment of the present application. The apparatus may be a sending device, or may be a component (e.g., an integrated circuit or chip) of the sending device, or may be another communication module configured to implement operations or steps corresponding to the sending device in the method embodiments shown in FIG. 4 to FIG. 6. As shown in FIG. 9, the key negotiation apparatus provided in this embodiment includes a first sending module 901, a first receiving module 902, and a first processing module 903.
[0327] The first sending module 901 is configured to send first information to the receiving device, where the first information is used to indicate N key negotiation algorithms, N is an integer greater than or equal to 1, and the N key negotiation algorithms are algorithms supported by the sending device.
[0328] The first receiving module 902 is configured to receive second information from the receiving device, where the second information is used to indicate a target key negotiation algorithm and includes a first key negotiation parameter, where the target key negotiation algorithm is a key negotiation algorithm among the N key negotiation algorithms supported by the receiving device, and the first key negotiation parameter is a key negotiation parameter corresponding to the receiving device and obtained based on the target key negotiation algorithm.
[0329] The first processing module 903 is configured to generate a target key based on the target key negotiation algorithm and the first key negotiation parameters.
[0330] Optionally, the first sending module 901 is: sending third information to the receiving device, the third information including second key negotiation parameters, the second key negotiation parameters corresponding to the sending device and obtained based on a target key negotiation algorithm; The device is further configured to:
[0331] Optionally, when sending the third information to the receiving device, the first sending module 901: It is particularly configured to transmit the third information, which has been processed by using an integrity protection algorithm, to a receiving device.
[0332] Optionally, the first information is further used to indicate priority information of the N key negotiation algorithms.
[0333] The first information includes identification information of the N key negotiation algorithms, the identification information being arranged or encapsulated based on priority information of the N key negotiation algorithms.
[0334] Optionally, the second information is further used to indicate M key negotiation algorithms supported by the receiving device, where M is an integer equal to or greater than 1.
[0335] Generating a target key based on a target key negotiation algorithm and the first key negotiation parameters includes: determining that the target key negotiation algorithm is the key negotiation algorithm having the highest priority for the receiving device among the M key negotiation algorithms; generating a target key based on the target key negotiation algorithm and the first key negotiation parameters; Includes.
[0336] Optionally, the first receiving module 902 comprises: Receive priority information of the M key negotiation algorithms from the receiving device. The method is further configured as follows.
[0337] Optionally, the second information is further used to indicate priority information of the M key negotiation algorithms supported by the receiving device.
[0338] The second information includes identification information of the M key negotiation algorithms, the identification information being arranged or encapsulated based on a priority of the M key negotiation algorithms.
[0339] Optionally, the first sending module 901 is: Sending first authentication data to the receiving device, the first authentication data being authentication data obtained after the sending device performs an authentication process on the second information; The device is further configured to:
[0340] Optionally, the first receiving module 902 comprises: Receive the fourth information sent by the receiving device. The method further comprises: The first processing module 903 is Attempt to verify the fourth piece of information The method further comprises: The fourth information includes second authentication data, the second authentication data being from the receiving device and being obtained after an authentication process is performed on the third information.
[0341] Optionally, the first receiving module 902 comprises: Receive the fourth information sent by the receiving device. The method further comprises: The first processing module 903 is Attempt to verify the fourth piece of information The method further comprises: The fourth information includes third authentication data, the third authentication data being from the receiving device and being obtained after an authentication process is performed on the third information and the N key negotiation algorithms indicated in the first information.
[0342] Optionally, the fourth information has been processed by using an integrity protection algorithm.
[0343] Optionally, the authentication process further includes an authentication process performed based on a pre-established shared key.
[0344] Optionally, the third information further indicates N key negotiation algorithms supported by the sending device.
[0345] Optionally, when transmitting the first information to the receiving device, the first sending module 901: It is particularly configured to transmit the first information to the receiving device in a broadcast manner.
[0346] Specifically, the device provided in this embodiment can be configured correspondingly to implement the technical solutions in any one of the above-mentioned method embodiments. The implementation principle and its technical effect are similar, and the details are not described again here.
[0347] 10 is a schematic diagram of the structure of a key negotiation apparatus according to another embodiment of the present application. The apparatus may be a receiving device, or may be a component (e.g., an integrated circuit or chip) of the receiving device, or may be another communication module configured to implement the operations or steps corresponding to the receiving device in the method embodiments shown in FIG. 4 to FIG. 6. As shown in FIG. 10, the key negotiation apparatus provided in this embodiment includes a second receiving module 1001, a second processing module 1002, and a second transmitting module 1003.
[0348] The second receiving module 1001 is configured to receive first information from a sending device, where the first information indicates N key negotiation algorithms supported by the sending device, where N is an integer greater than or equal to 1.
[0349] The second processing module 1002 is configured to determine a target key negotiation algorithm and generate first key negotiation parameters based on the target key negotiation algorithm, where the target key negotiation algorithm is a key negotiation algorithm among the N key negotiation algorithms supported by the receiving device, and the first key negotiation parameters are key negotiation parameters corresponding to the receiving device and obtained based on the target key negotiation algorithm.
[0350] The second sending module 1003 is configured to send second information to the sending device, where the second information indicates the target key negotiation algorithm and includes the first key negotiation parameters.
[0351] The second receiving module 1001 is configured to receive third information from the sending device, where the third information indicates second key negotiation parameters, where the second key negotiation parameters correspond to the sending device and are obtained based on a target key negotiation algorithm.
[0352] The second processing module 1002 is further configured to generate a target key based on the second key negotiation parameters and the target key negotiation algorithm.
[0353] Optionally, the third information has been processed by using an integrity protection algorithm.
[0354] Optionally, the first information is further used to indicate priority information of the N key negotiation algorithms, the first information including identification information of the N key negotiation algorithms, the identification information being located or encapsulated based on the priority information of the N key negotiation algorithms.
[0355] The second processing module 1002 determines a target key negotiation algorithm; From the N key negotiation algorithms, the key negotiation algorithm having the highest priority for the sending device is determined as the target key negotiation algorithm.
[0356] Optionally, when determining the target key negotiation algorithm, the second processing module 1002: From the N key negotiation algorithms, determine the key negotiation algorithm having the highest priority with respect to the receiving device as the target key negotiation algorithm. The device is specifically configured as follows.
[0357] Optionally, the second information is further used to indicate priority information of the M key negotiation algorithms supported by the receiving device.
[0358] The second information includes identification information of the M key negotiation algorithms, the identification information being arranged or encapsulated based on the priority information of the M key negotiation algorithms.
[0359] Optionally, the second receiving module 1001 comprises: receiving first authentication data from the transmitting device, the first authentication data being authentication data obtained after the transmitting device performs an authentication process on the second information; The device is further configured to:
[0360] Optionally, the second sending module 1003 is: Sending fourth information to the sending device, the fourth information including second authentication data, the second authentication data being authentication data obtained after the receiving device performs an authentication process on the third information; The device is further configured to:
[0361] Optionally, the second sending module 1003 is: Sending fourth information to the sending device, the fourth information including third authentication data, the third authentication data being authentication data obtained after the receiving device performs an authentication process on the third information and the N key negotiation algorithms indicated in the first information; The device is further configured to:
[0362] Optionally, when sending the fourth information to the sending device, the second sending module 1003: Sending the fourth information to the sending device, the fourth information being processed by using an integrity protection algorithm. The device is specifically configured as follows.
[0363] Optionally, the authentication process further comprises an authentication process performed based on a preset key.
[0364] Optionally, the third information further indicates N key negotiation algorithms supported by the sending device.
[0365] Specifically, the device provided in this embodiment can be configured correspondingly to implement the technical solutions in any one of the above-mentioned method embodiments. The implementation principle and its technical effect are similar, and the details are not described again here.
[0366] 11 is a schematic diagram of a structure of a communication system according to an embodiment of the present application. As shown in FIG. 11, the communication system 1100 in this embodiment may include a sending device 1101 and a receiving device 1102.
[0367] In another possible implementation, the sending device 1101 may use the structure of the apparatus embodiment shown in Figure 8 or Figure 9. Correspondingly, the sending device 1101 may perform the technical solution related to the sending device in any one of the above method embodiments. The implementation principle and its technical effect are similar. The details are not described again here.
[0368] In another possible implementation, the receiving device 1102 may use the structure of the apparatus embodiment shown in Figure 8 or Figure 10. Correspondingly, the receiving device 1102 may perform the technical solution related to the receiving device in any one of the above-mentioned method embodiments. The implementation principle and its technical effect are similar. The details are not described again here.
[0369] In another possible implementation, the sending device 1101 may use the structure of the apparatus embodiment shown in FIG. 8 or FIG. 9. Correspondingly, the sending device 1101 may perform the technical solution related to the sending device in any one of the above-mentioned method embodiments. The implementation principle and its technical effect are similar. The details are not described again here. The receiving device 1102 may use the structure of the apparatus embodiment shown in FIG. 8 or FIG. 10. Correspondingly, the receiving device 1102 may perform the technical solution related to the receiving device in any one of the above-mentioned method embodiments. The implementation principle and its technical effect are similar. The details are not described again here.
[0370] When the integrated module is implemented in the form of a software function module and sold and used as an independent product, the integrated module may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application that substantially or partially contributes to the current technology, or all or part of the technical solution, may be implemented in the form of a software product. The computer software product is stored in a storage medium and includes some instructions for instructing a computer device (which may be a personal computer, a server, or a network device) or a processor to perform all or part of the steps of the method described in the embodiments of the present application. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, removable hard disk drives, read-only memory (ROM), random access memory (RAM), magnetic disks, and optical disks, etc.
[0371] An embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed on one or more processors, the method in any one of the embodiments shown in Figures 3 to 7 is performed.
[0372] An embodiment of the present application further provides a chip system, which includes at least one processor, at least one memory, and an interface circuit, the interface circuit being configured to provide information input / output to the at least one processor, the at least one memory storing a computer program, and when the computer program is executed on the one or more processors, the method in any one of the embodiments shown in Figures 3 to 7 is performed.
[0373] An embodiment of the present application further provides a smart cockpit product. The smart cockpit product includes the key negotiation device provided in Fig. 8 or Fig. 10, or the key negotiation device provided in Fig. 8 or Fig. 9. The key negotiation device can perform a method performed by a sending device or a receiving device corresponding to the key negotiation device in any one of the embodiments in Fig. 3 to Fig. 7.
[0374] An embodiment of the present application further provides a smart terminal. The smart terminal includes the key negotiation device provided in Fig. 8 or Fig. 10, or the key negotiation device provided in Fig. 8 or Fig. 9. The key negotiation device can perform the method performed by the sending device or the receiving device corresponding to the key negotiation device in any one of the embodiments in Fig. 3 to Fig. 7. Furthermore, the smart terminal can be a transportation vehicle or an intelligent device, including a drone, an unmanned transportation vehicle, a smart car, a robot, etc.
[0375] All the embodiments in this specification are described in a progressive manner, and for the same or similar parts in the embodiments, please refer to these embodiments, and each embodiment focuses on the difference with other embodiments. In particular, the device embodiment is basically similar to the method embodiment, and therefore is described briefly. For the relevant parts, please refer to the description of the method embodiment. The described device embodiment is only an example. The units described as separate parts may be physically separate or not physically separate, and the parts displayed as units may be physical units or not physical units, and may be located in one location or distributed to multiple network units. Some or all of the modules may be selected according to the actual requirements to achieve the purpose of the solution of the embodiment. Those skilled in the art may understand and implement the embodiment without creative efforts.
[0376] All or part of the above-mentioned embodiments may be implemented using software, hardware, firmware, or any combination thereof. When software is used to implement the embodiments, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded into a computer and executed, the procedures or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or another programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, or digital subscriber line (DSL)) or wirelessly (e.g., infrared, radio, or microwave). The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device integrating one or more available media, such as a server or a data center, etc. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a DVD), a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0377] The above description is merely a specific implementation of the present application, and is not intended to limit the scope of protection of the present application. Any variation or replacement that is easily conceived by a person skilled in the art within the technical scope disclosed in the present application should fall within the scope of protection of the present application. Therefore, the scope of protection of the present application should be subject to the scope of protection of the claims.
Claims
1. 1. A method of key negotiation, comprising: transmitting first information, the first information being used to indicate N key negotiation algorithms, N being an integer equal to or greater than 1, the N key negotiation algorithms being algorithms supported by a sending device; receiving second information from a receiving device, the second information being used to indicate a target key negotiation algorithm and including a first key negotiation parameter, the target key negotiation algorithm being a key negotiation algorithm among the N key negotiation algorithms supported by the receiving device, the first key negotiation parameter being a key negotiation parameter corresponding to the receiving device and obtained based on the target key negotiation algorithm; generating a target key based on the target key negotiation algorithm and the first key negotiation parameters; A key negotiation method, comprising:
2. The method comprises: sending third information to the receiving device, the third information including second key negotiation parameters, the second key negotiation parameters corresponding to the sending device and obtained based on the target key negotiation algorithm; The method of claim 1 further comprising:
3. The step of transmitting third information to the receiving device further comprises: transmitting the third information, which has been processed by using an integrity protection algorithm, to the receiving device. The method of claim 2 comprising:
4. the first information is further used to indicate priority information of the N key negotiation algorithms; 4. The method of claim 1, wherein the first information includes identification information of the N key negotiation algorithms, the identification information being arranged or encapsulated based on the priority information of the N key negotiation algorithms.
5. The method of claim 1 , wherein the second information is further used to indicate M key negotiation algorithms supported by the receiving device, where M is an integer greater than or equal to 1.
6. The step of generating a target key based on the target key negotiation algorithm and the first key negotiation parameters comprises: determining that the target key negotiation algorithm is a key negotiation algorithm having a highest priority among the N key negotiation algorithms supported by the receiving device; generating the target key based on the target key negotiation algorithm and the first key negotiation parameters; 6. The method according to claim 1 , comprising:
7. The method comprises: receiving priority information of the M key negotiation algorithms from the receiving device; The method of claim 5 or 6, further comprising:
8. the second information is further used to indicate priority information of the M key negotiation algorithms supported by the receiving device; 7. The method of claim 5 or 6, wherein the second information includes identification information of the M key negotiation algorithms, the identification information being arranged or encapsulated based on a priority of the M key negotiation algorithms.
9. The method according to any one of claims 2 to 6, wherein the third information further includes first authentication data, the first authentication data being authentication data obtained after the sending device performs an authentication process on the second information.
10. The method comprises: receiving and attempting to verify fourth information from the receiving device; Further comprising:
10. The method according to claim 2, wherein the fourth information comprises second authentication data, the second authentication data being data obtained after an authentication process has been performed on the third information.
11. The method comprises: receiving and attempting to verify the fourth information sent by the receiving device. Including, 10. The method according to claim 2, wherein the fourth information includes third authentication data, the third authentication data being data obtained after an authentication process is performed on the third information and the N key negotiation algorithms indicated in the first information.
12. The method according to claim 10 or 11, wherein the fourth information is information that has been processed by using an integrity protection algorithm.
13. The method according to claim 9 , wherein the authentication process further includes an authentication process based on a preset shared key.
14. The method of claim 2 , wherein the third information further indicates the N key negotiation algorithms.
15. The step of transmitting first information comprises: transmitting the first information to the receiving device in a broadcast manner; 15. The method of any one of claims 1 to 14, comprising:
16. Prior to the step of transmitting first information, the method further comprises: receiving fifth information from the receiving device, the fifth information being used to indicate to the sending device to transmit the first information; Further comprising: The step of transmitting first information comprises: transmitting the first information to the receiving device in a unicast manner.
15. The method of any one of claims 1 to 14, comprising:
17. 1. A method of key negotiation, comprising: receiving first information from a sending device, the first information indicating N key negotiation algorithms supported by the sending device, where N is an integer greater than or equal to 1; determining a target key negotiation algorithm, the target key negotiation algorithm being a key negotiation algorithm of the N key negotiation algorithms that is supported by a receiving device; generating first key negotiation parameters based on the target key negotiation algorithm; sending second information to the sending device, the second information indicating the target key negotiation algorithm and including the first key negotiation parameters; A key negotiation method, comprising:
18. The method comprises: receiving third information from the sending device, the third information indicating second key negotiation parameters, the second key negotiation parameters corresponding to the sending device and obtained based on the target key negotiation algorithm; generating a target key based on the second key negotiation parameters and the target key negotiation algorithm; 20. The method of claim 17 further comprising:
19. 20. The method of claim 18, wherein the third information is processed by using an integrity protection algorithm.
20. The second information further indicates priority information of M key negotiation algorithms supported by the receiving device; and 20. The method of claim 17, wherein the second information includes identification information of the M key negotiation algorithms, the identification information being arranged or encapsulated based on the priority information of the M key negotiation algorithms.
21. 21. The method of claim 17, wherein the first information is further used to indicate priority information of the N key negotiation algorithms, the first information including identification information of the N key negotiation algorithms, the identification information being positioned or encapsulated based on the priority information of the N key negotiation algorithms.
22. The step of determining a target key negotiation algorithm comprises: determining a key negotiation algorithm having a highest priority from the N key negotiation algorithms as the target key negotiation algorithm; 22. The method of any one of claims 17 to 21, comprising:
23. The method comprises: receiving first authentication data from the transmitting device, the first authentication data being authentication data obtained after the transmitting device performs an authentication process on the second information; 23. The method of any one of claims 17 to 22, further comprising:
24. transmitting fourth information to the transmitting device, the fourth information including second authentication data, the second authentication data being authentication data obtained after the receiving device performs an authentication process on the third information; 24. The method of any one of claims 18 to 23, further comprising:
25. sending fourth information to the sending device, the fourth information including third authentication data, the third authentication data being authentication data obtained after the receiving device performs an authentication process for the third information and the N key negotiation algorithms indicated in the first information; 24. The method of any one of claims 18 to 23, further comprising:
26. The step of transmitting fourth information to the transmitting device further comprises: transmitting the fourth information, which has been processed by using an integrity protection algorithm, to the sending device.
26. The method of claim 24 or 25, comprising:
27. 27. The method according to any one of claims 23 to 26, wherein the authentication process further comprises an authentication process based on a preset key.
28. 28. The method of any one of claims 18 to 27, wherein the third information further indicates the N key negotiation algorithms supported by the sending device.
29. Prior to the step of receiving first information from a sending device, the method further comprises: sending fifth information to the sending device, the fifth information being used to indicate to the sending device to send the first information; 29. The method of any one of claims 17 to 28, further comprising:
30. A key negotiation device configured to implement the method according to any one of claims 1 to 16 and / or configured to perform the method according to any one of claims 17 to 29.
31. 1. A key negotiation apparatus, comprising: one or more processors coupled to one or more memories; the one or more memories are configured to store computer programs or instructions; 30. A key negotiation apparatus, wherein the one or more processors are configured to execute the computer programs or instructions stored in the one or more memories to enable the apparatus to perform the method of any one of claims 1 to 16 and / or to perform the method of any one of claims 17 to 29.
32. A communication system comprising a sending device configured to perform the method according to any one of claims 1 to 16 and a receiving device configured to perform the method according to any one of claims 17 to 29.
33. 30. A readable storage medium comprising a program or instructions which, when executed on a processor, performs the method according to any one of claims 1 to 16 and / or the method according to any one of claims 17 to 29.
Citation Information
Patent Citations
Cipher key distributing system
JP1986163746A
