A method for determining master and slave devices in a key agreement process and related apparatuses

CN116545638BActive Publication Date: 2026-08-21HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210088566.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-25
Publication Date
2026-08-21
Estimated Expiration
2042-01-25

AI Technical Summary

Technical Problem

[0004]然而,网络设备的安全性与网络设备的位置不具有强相关性,相关技术中的主设备选举方式并不能够保证选举出来的主设备是两个网络设备中安全性最高的网络设备,从而无法保障密钥协商过程和数据传输的安全性

Benefits of technology

[0049]上述第三方面至第八方面提供的方案,用于实现或配合实现上述第一方面或第二方面提供的方法,因此能够与第一方面或第二方面达到相同或相应的有益效果,此处不再进行赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116545638B_ABST
    Figure CN116545638B_ABST
Patent Text Reader

Abstract

The application discloses a method for determining master and slave devices in a key agreement process, and is applied to network devices to be executed in a key agreement process. In the method, a message indicating security capability sent by another network device is received by a network device, and security capability possessed between the two network devices is compared based on the message, so that the network device with the highest security is determined as a master device, thereby effectively guaranteeing the security of the key agreement process and data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer security technology, and in particular to a method and related apparatus for determining master and slave devices during key negotiation. Background Technology

[0002] Encrypted data transmission is a fundamental security requirement for communication between network devices. To achieve encrypted data transmission, two network devices typically perform key negotiation to obtain a key for encrypting the transmitted data. During key negotiation, the network device acting as the master device generates the key and distributes it to the network devices acting as slave devices. Therefore, before the two network devices can negotiate the key, a master device often needs to be elected from among them.

[0003] Currently, related technologies determine the master device selection based on the distance between the network device's location and the network core. For example, for two network devices, the one closer to the network core becomes the master device, while the one farther away becomes the slave device.

[0004] However, the security of network devices is not strongly correlated with their location. The master device election methods in related technologies cannot guarantee that the elected master device is the most secure of the two network devices, thus failing to guarantee the security of the key negotiation process and data transmission. Summary of the Invention

[0005] This application provides a method for determining the master and slave devices in a key negotiation process, which can effectively determine the network device with the highest security as the master device, thus effectively ensuring the security of the key negotiation process and data transmission.

[0006] A first aspect of this application provides a method for determining master and slave devices during key negotiation, comprising: a first network device receiving a first message sent by a second network device, the first message indicating one or more security capabilities possessed by the second network device, which help ensure key security. Based on the one or more security capabilities and the security capabilities possessed by the first network device, the first network device determines a master device and a slave device among the first network device and the second network device, wherein the master device is used to generate a key and distribute the key to the slave device during the key negotiation process, and the security capabilities of the master device are higher than those of the slave device.

[0007] In this scheme, during the key negotiation process, the network device at one end of the key negotiation receives a message indicating the security capabilities sent by the other network device at the other end of the key negotiation. Based on this message, the security capabilities of the two network devices undergoing key negotiation are compared, thereby determining the network device with the highest security as the master device, effectively ensuring the security of the key negotiation process and data transmission.

[0008] Optionally, the first message received by the first network device includes a first field, which includes at least one bit, each bit representing whether a security capability is possessed. For example, when the value of a bit is 1, it indicates that the second network device possesses the security capability represented by the bit; when the value of a bit is 0, it indicates that the second network device does not possess the security capability represented by the bit.

[0009] Optionally, the first message received by the first network device includes a first field, which includes at least one identifier used to represent one or more security capabilities.

[0010] Optionally, the first message further includes a second field, which includes a first checksum. The method further includes: a first network device performing an integrity check on the content of the first field to obtain a second checksum; and in response to the first checksum being the same as the second checksum, the first network device determining that the content of the first field has passed the integrity check.

[0011] Optionally, the first message includes a third field, which includes a third check value; the method further includes: the first network device performing integrity verification on the content of the first message other than the third field to obtain a fourth check value; in response to the third check value being the same as the fourth check value, the first network device determines that the first message has passed the integrity verification.

[0012] Optionally, the first network device compares one or more security capabilities with the security capabilities it possesses in descending order of security capability priority, in order to determine the master device and the slave device among the first network device and the second network device; wherein the master device possesses the target security capability and the slave device does not possess the target security capability, and the target security capability is the security capability with the highest priority among one or more security capabilities that differ between the master device and the slave device.

[0013] In this scheme, the first network device compares the priority of security capabilities between the two network devices to select the master and slave devices from the perspective of the contribution of security capabilities to device security, thereby accurately selecting the device with the highest security as the master device.

[0014] Optionally, the priority of the security capabilities represented by each bit in the first field from left to right decreases sequentially from the most significant bit to the least significant bit. Based on the security capabilities possessed by the first network device, the first network device generates a capability value including multiple bits from left to right, wherein the priority of the security capabilities represented by each bit in the first field decreases sequentially from the most significant bit to the least significant bit. The first network device determines the master device and the slave device from the second network device by comparing the values ​​represented by the multiple bits with the capability value.

[0015] In this scheme, multiple bits sorted according to the priority of security capabilities are used to represent the security capabilities of network devices. This allows network devices to quickly select the device with the highest security as the master device by comparing the values ​​used to represent security capabilities, thereby improving the efficiency of network devices in determining master and slave devices.

[0016] Optionally, the method further includes: the first network device sending a second message to the second network device, the second message indicating one or more security capabilities possessed by the first network device.

[0017] Optionally, the method further includes: a first network device generating a fourth field, the fourth field being used to indicate one or more security capabilities possessed by the first network device; the first network device encrypting the fourth field using a preset key to obtain a fifth field; and the first network device generating a second message based on the fourth field and the fifth field, the second message including the fourth field and the fifth field.

[0018] Optionally, the method further includes: a first network device generating a fourth field, the fourth field being used to indicate one or more security capabilities possessed by the first network device; the first network device generating a third message based on the fourth field, the third message including the fourth field; the first network device encrypting the third message using a preset key to obtain a sixth field; and the first network device adding the sixth field to the third message to obtain a second message.

[0019] Optionally, security capabilities may include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability.

[0020] Optionally, the first message is carried in the key negotiation message.

[0021] A second aspect of this application provides a method for determining master and slave devices during key negotiation, comprising: a first network device sending a first message to a second network device, the first message indicating one or more security capabilities possessed by the first network device, the one or more security capabilities contributing to key security; the first network device receiving a second message sent by the second network device, the second message indicating a master device and / or slave device determined in the first network device and the second network device, the master device generating a key and distributing the key to the slave device during the key negotiation process, the master device having higher security capabilities than the slave device.

[0022] Optionally, the first message includes a first field, which includes at least one bit, each bit of which is used to indicate whether a security capability is present.

[0023] Optionally, the first message includes a first field, which includes at least one identifier, which is used to represent one or more security capabilities.

[0024] Optionally, the method further includes: a first network device generating a first field, the first field being used to indicate one or more security capabilities possessed by the first network device; the first network device encrypting the first field using a preset key to obtain a second field; and the first network device generating a first message based on the first field and the second field, the first message including the first field and the second field.

[0025] Optionally, the method further includes: a first network device generating a first field, the first field being used to indicate one or more security capabilities possessed by the first network device; the first network device generating a third message based on the first field, the third message including the first field; the first network device encrypting the third message using a preset key to obtain the third field; and the first network device adding the third field to the third message to obtain the first message.

[0026] Optionally, the first message is carried in the key negotiation message.

[0027] A third aspect of this application provides an apparatus for determining master and slave devices during key negotiation. The apparatus is deployed in a first network device and includes: a receiving unit for receiving a first message sent by a second network device, the first message indicating one or more security capabilities possessed by the second network device, the one or more security capabilities helping to ensure key security; and a processing unit for determining a master device and a slave device in the first network device and the second network device based on the one or more security capabilities and the security capabilities possessed by the first network device, wherein the master device generates a key and distributes the key to the slave device during the key negotiation process, and the security capabilities of the master device are higher than those of the slave device.

[0028] Optionally, the first message includes a first field, which includes at least one bit, each bit of which is used to indicate whether a security capability is present.

[0029] Optionally, the first message includes a first field, which includes at least one identifier, which is used to represent one or more security capabilities.

[0030] Optionally, the first message also includes a second field, which includes a first check value; the processing unit is further configured to: perform integrity verification on the content of the first field to obtain a second check value; and determine that the content of the first field passes the integrity verification in response to the first check value being the same as the second check value.

[0031] Optionally, the first message includes a third field, which includes a third check value; the processing unit is further configured to: perform integrity verification on the content of the first message other than the third field to obtain a fourth check value; and determine that the first message passes the integrity verification in response to the third check value being the same as the fourth check value.

[0032] Optionally, the processing unit is specifically used to: compare one or more security capabilities with the security capabilities possessed by the first network device in descending order of priority of security capabilities, so as to determine the master device and the slave device among the first network device and the second network device; wherein the master device possesses the target security capability and the slave device does not possess the target security capability, and the target security capability is the security capability with the highest priority among one or more security capabilities that differ between the master device and the slave device.

[0033] Optionally, the priority of the security capabilities represented by each bit in the first field from left to right decreases sequentially from the most significant bit to the least significant bit. The processing unit is specifically used to: generate a capability value including multiple bits from left to right based on the security capabilities possessed by the first network device, wherein the priority of the security capabilities represented by each bit in the first field from left to right decreases sequentially from the most significant bit to the least significant bit; and determine the master device and the slave device in the first network device and the second network device by comparing the values ​​represented by the multiple bits with the capability value.

[0034] Optionally, the device further includes: a sending unit for sending a second message to a second network device, the second message being used to indicate one or more security capabilities possessed by the first network device.

[0035] Optionally, the processing unit is further configured to: generate a fourth field, the fourth field being used to indicate one or more security capabilities possessed by the first network device; encrypt the fourth field using a preset key to obtain a fifth field; and generate a second message based on the fourth field and the fifth field, the second message including the fourth field and the fifth field.

[0036] Optionally, the processing unit is further configured to: generate a fourth field, the fourth field being used to indicate one or more security capabilities possessed by the first network device; generate a third message based on the fourth field, the third message including the fourth field; encrypt the third message using a preset key to obtain a sixth field; and add the sixth field to the third message to obtain a second message.

[0037] Optionally, security capabilities may include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability.

[0038] Optionally, the first message is carried in the key negotiation message.

[0039] A fourth aspect of this application provides an apparatus for determining master and slave devices during key negotiation, characterized in that the apparatus is deployed in a first network device and includes: a sending unit for sending a first message to a second network device, the first message indicating one or more security capabilities possessed by the first network device, the one or more security capabilities contributing to key security; and a receiving unit for receiving a second message sent by the second network device, the second message indicating a master device and / or slave device determined in the first and second network devices, the master device generating a key and distributing the key to the slave device during key negotiation, the master device having higher security capabilities than the slave device.

[0040] Optionally, the first message includes a first field, which includes at least one bit, each bit of which is used to indicate whether a security capability is present.

[0041] Optionally, the first message includes a first field, which includes at least one identifier, which is used to represent one or more security capabilities.

[0042] Optionally, the apparatus further includes a processing unit, which is configured to: generate a first field, the first field being used to indicate one or more security capabilities possessed by the first network device; encrypt the first field using a preset key to obtain a second field; and generate a first message based on the first field and the second field, the first message including the first field and the second field.

[0043] Optionally, the apparatus further includes a processing unit, which is configured to: generate a first field, the first field being used to indicate one or more security capabilities possessed by the first network device; generate a third message based on the first field, the third message including the first field; encrypt the third message using a preset key to obtain the third field; and add the third field to the third message to obtain the first message.

[0044] Optionally, the first message is carried in the key negotiation message.

[0045] A fifth aspect of this application provides a network device including a processor and a memory; wherein the memory is used to store program code, and the processor is used to call the program code in the memory to cause the network device to perform a method as described in any of the embodiments of the first or second aspect.

[0046] The sixth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform a method as described in any of the embodiments of the first or second aspect.

[0047] The seventh aspect of this application provides a computer program product that, when run on a computer, causes the computer to perform a method as described in any of the embodiments of the first or second aspect.

[0048] This application provides a chip, including one or more processors. Part or all of the processors are used to read and execute computer instructions stored in a memory to perform the methods in any possible implementation of any of the above aspects. Optionally, the chip also includes a memory. Optionally, the chip also includes a communication interface, with the processor connected to the communication interface. The communication interface is used to receive data and / or information to be processed, the processor obtains the data and / or information from the communication interface, processes the data and / or information, and outputs the processing results through the communication interface. Optionally, the communication interface is an input / output interface or a bus interface. The methods provided in this application are implemented by one chip or by multiple chips working together.

[0049] The solutions provided in the third to eighth aspects above are used to implement or cooperate with the methods provided in the first or second aspects above, and therefore can achieve the same or corresponding beneficial effects as the first or second aspects, which will not be elaborated here. Attached Figure Description

[0050] Figure 1 A schematic diagram of the network architecture used in the method for determining master and slave devices during the key negotiation process provided in the embodiments of this application;

[0051] Figure 2 A flowchart illustrating a method for determining master and slave devices during key negotiation, provided as an embodiment of this application;

[0052] Figure 3 This application provides a schematic diagram illustrating a process for performing integrity verification on a first field.

[0053] Figure 4 A flowchart illustrating the method for determining master and slave devices during key negotiation, as provided in the embodiments of this application;

[0054] Figure 5 A schematic diagram of the structure of a key negotiation message provided in an embodiment of this application;

[0055] Figure 6 A schematic diagram illustrating the structure of the master device priority field in a key negotiation message, provided in an embodiment of this application;

[0056] Figure 7 A flowchart illustrating another method for determining master and slave devices during key negotiation, provided in an embodiment of this application;

[0057] Figure 8 A schematic diagram of the structure of a device for determining master and slave devices during key negotiation, provided in an embodiment of this application;

[0058] Figure 9 A schematic diagram of the structure of a device for determining master and slave devices during key negotiation, provided in an embodiment of this application;

[0059] Figure 10 This is a schematic diagram of the structure of a network device 1000 provided in an embodiment of this application. Detailed Implementation

[0060] The embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. As those skilled in the art will understand, with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0061] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. The term "multiple" in the specification, claims, and accompanying drawings of this application refers to two or more objects.

[0062] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0063] The following explains some terms and concepts involved in the embodiments of this application.

[0064] (1) 802.1x

[0065] The 802.1x protocol is a client / server-based access control and authentication protocol. It restricts unauthorized users / devices from accessing a local area network (LAN) through access ports. Before accessing the various services provided by a switch or LAN, 802.1x authenticates users / devices connected to the switch port. Before successful authentication, 802.1x only allows data to pass through the switch port to which the device is connected; after successful authentication, legitimate data can pass through the Ethernet port.

[0066] (2) Media Access Control Security (MACsec)

[0067] MACsec defines a method for secure data communication in a network. MACsec provides users with secure MAC layer data sending and receiving services, including user data encryption, data frame integrity checks, and data source authenticity verification. MACsec is typically used in conjunction with the 802.1X authentication framework. After successful 802.1X authentication, the device executing MACsec receives messages from other devices and uses the key negotiated via the MACsec Key Agreement (MKA) protocol to encrypt and perform integrity checks on the received messages, preventing the port from processing messages from unauthenticated devices or messages tampered with by unauthenticated devices.

[0068] (3) Security Association key (SAK)

[0069] SAK is the working key used for data encryption in MACsec.

[0070] The above describes the terminology and concepts involved in the embodiments of this application. The following will describe the application scenarios of the master-slave device determination method provided in the key negotiation process of this application embodiments.

[0071] Please see Figure 1 , Figure 1 This is a schematic diagram of the network architecture used in the method for determining master and slave devices during the key negotiation process provided in the embodiments of this application. Figure 1 As shown, the network architecture includes a first network device and a second network device to perform a key negotiation process. The first and second network devices elect a master and a slave device through the key negotiation process. After the master device is elected, it generates a key and distributes the generated key to the slave devices, enabling the master and slave devices to encrypt data transmission based on the key.

[0072] Optionally, the first network device and the second network device perform the key negotiation process by running the same key negotiation protocol. The key negotiation protocol running in both the first and second network devices is a physical layer or data link layer protocol. For example, the key negotiation protocol is the MKA protocol.

[0073] For example, the first network device and the second network device can be physical devices such as routers, switches, hubs, gateways, firewalls, servers, personal computers, laptops, smartphones, or tablets. Optionally, the first network device and the second network device are implemented using virtualization devices. For example, a virtualization device is a virtual machine (VM) running a program for sending packets, a virtual router, or a virtual switch. The virtualization device is deployed on hardware devices (e.g., physical servers). For example, the first network device and the second network device described above can be implemented based on a physical server combined with network functions virtualization (NFV) technology.

[0074] The above describes the application scenarios of the master-slave device determination method in the key negotiation process provided by the embodiments of this application. The following will describe in detail the specific implementation process of the master-slave device determination method in the key negotiation process provided by the embodiments of this application.

[0075] Please see Figure 2 , Figure 2 This is a flowchart illustrating a method for determining master and slave devices during key negotiation, as provided in an embodiment of this application. Figure 2 As shown, the method for determining the master and slave devices during the key negotiation process includes the following steps 201-202. Figure 2 The method for determining the master and slave devices during the key negotiation process shown is applied to network devices that are about to perform the key negotiation process.

[0076] Step 201: The first network device receives a first message sent by the second network device. The first message indicates one or more security capabilities possessed by the second network device, which help ensure key security.

[0077] In this embodiment, during the key negotiation process between the first network device and the second network device, the first network device receives a first message sent by the second network device. For example, the first and second network devices determine the master and slave devices in the key negotiation process by exchanging key negotiation messages, and the aforementioned first message is carried within these key negotiation messages. For instance, the first message may be carried within a key server selection message, where the key server selection message is the key negotiation message used to select the master device during the key negotiation process.

[0078] In this process, the first message received by the first network device is generated by the second network device based on one or more security capabilities it possesses that help ensure key security. Therefore, the first network device can determine the one or more security capabilities possessed by the second network device based on the first message.

[0079] Optionally, security capabilities that help ensure key security include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability.

[0080] Secure boot capability refers to the ability of a network device to boot securely. Generally, secure boot involves the following process: First, the chip in the network device performs digital signature verification on the Basic Input / Output System (BIOS) based on a hardware root of trust. After the BIOS passes verification, it performs digital signature verification on the network device's operating system. After the operating system passes verification, it then performs digital signature verification on the application software, thereby ensuring that the software packages loaded and run by the network device are not tampered with or counterfeited.

[0081] Hardware-level key management refers to the operation of key generation, derivation, use, updating, and destruction being implemented by a hardware security module within the network device's chip. Hardware-level key management ensures the security of key management at the hardware level.

[0082] Trusted Execution Environment (TEE) capability refers to the presence of a trusted execution environment within a network device for running software. A TEE is a secure area constructed within a central processing unit (CPU) using both hardware and software methods. Programs and data loaded within a TEE are protected in terms of confidentiality and integrity. Typically, trusted applications running in a TEE have full access to the network device's processor and memory. Furthermore, the TEE protects trusted applications from interference from other applications running within the operating system through hardware isolation.

[0083] Security chip capability refers to the presence of a security chip in a network device. For example, a security chip may include a Trusted Platform Module (TPM) or a Secure Element (SE). A security chip is a device capable of independently generating, encrypting, and decrypting keys. It has its own processor and storage unit, capable of storing keys and signature data, thereby providing encryption and security authentication services. When a network device uses a security chip for encryption, the keys are stored in hardware, and stolen data cannot be decrypted, thus protecting data security.

[0084] Firmware resilience refers to the ability of a network device to withstand attacks. For network devices with firmware resilience, a portion of the device's storage space (such as flash memory) is locked and cannot be rewritten, ensuring that the protected code area is not altered during an attack. Generally, firmware resilience is used to protect the BIOS so that the network device can always boot normally even under attack.

[0085] Step 202: Based on one or more security capabilities indicated by the first message and the security capabilities possessed by the first network device, the first network device determines a master device and a slave device in the first network device and the second network device. The master device is used to generate a key and distribute the key to the slave device during the key negotiation process. The security capabilities of the master device are higher than those of the slave device.

[0086] For example, when the first network device determines that its security capabilities are higher than those of the second network device based on one or more security capabilities in the first message and the security capabilities it possesses, the first network device determines that the first network device is the master device and the second network device is the slave device.

[0087] When the first network device determines that its security capabilities are lower than those of the second network device based on one or more security capabilities in the first message and the security capabilities it possesses, the first network device determines that the first network device is the slave device and the second network device is the master device.

[0088] Optionally, when the first network device determines that its security capabilities are the same as those of the second network device based on one or more security capabilities in the first message and the security capabilities it possesses, the first network device determines the master and slave devices through other means. For example, the first network device determines the master and slave devices by comparing the size between the first network device's Internet Protocol (IP) address and the second network device's IP address; or, the first network device determines the master and slave devices by comparing the size between the first network device's port number and the second network device's port number.

[0089] After determining the master and slave devices, the master device generates a key and distributes it to the slave device via a key negotiation message. For example, the master device distributes the key to the slave device via a SAK generation and installation message.

[0090] In this embodiment, during the key negotiation process, the network device at one end of the key negotiation receives a message indicating security capabilities sent by the other network device at the other end of the key negotiation. Based on this message, the security capabilities of the two network devices undergoing key negotiation are compared, thereby determining the network device with the highest security as the master device, effectively ensuring the security of the key negotiation process and data transmission.

[0091] Optionally, in step 201 above, the first message used to indicate one or more security capabilities of the second network device can be implemented in various different ways.

[0092] In implementation method 1, the first message uses the value of a bit to represent one or more security capabilities possessed by the second network device.

[0093] For example, the first message includes a first field, which includes at least one bit, and each bit in the at least one bit is used to indicate whether a security capability is possessed. For example, when the value of a bit is 1, it indicates that the second network device possesses the security capability represented by the bit; when the value of a bit is 0, it indicates that the second network device does not possess the security capability represented by the bit.

[0094] Furthermore, when the first field includes multiple bits, different bits within the first field represent different security capabilities. For example, suppose the first field includes five bits: the first bit represents secure boot capability, the second bit represents hardware-level key management capability, the third bit represents trusted execution environment capability, the fourth bit represents security chip capability, and the fifth bit represents firmware resilience capability. Then, when the value of the first field is 11000, it indicates that the second network device possesses secure boot capability and hardware-level key management capability, but lacks trusted execution environment capability, security chip capability, and firmware resilience capability; when the value of the first field is 10011, it indicates that the second network device possesses secure boot capability, security chip capability, and firmware resilience capability, but lacks hardware-level key management capability and trusted execution environment capability.

[0095] In implementation method 2, the first message indicates one or more security capabilities possessed by the second network device by carrying an identifier of security capabilities.

[0096] For example, the first message includes a first field, which includes at least one identifier, and the at least one identifier is used to represent one or more security capabilities. Specifically, different security capabilities are represented by different identifiers, and the identifiers included in the first field represent the security capabilities possessed by the second network device. When the first field includes one identifier, it means that the second network device possesses one security capability; when the first field includes multiple identifiers, it means that the second network device possesses multiple security capabilities.

[0097] For example, suppose identifier 001 represents secure boot capability, identifier 010 represents hardware-level key management capability, identifier 011 represents trusted execution environment capability, identifier 100 represents secure chip capability, and identifier 101 represents firmware resilience capability. Then, when the value of the first field is 001 101, the first field indicates that the second network device has secure boot capability and firmware resilience capability; when the value of the first field is 001 010 011, the first field indicates that the second network device has secure boot capability, hardware-level key management capability, and trusted execution environment capability.

[0098] Generally, different security capabilities contribute differently to ensuring key security. For example, secure boot capability can significantly improve key security in network devices, while firmware resilience capability offers little benefit. Therefore, to facilitate the first network device's comparison of the security capabilities of two network devices, this embodiment ranks the capabilities based on their contribution to key security, assigning different priorities to different security capabilities. In this way, the first network device can compare the security capabilities of two network devices based on their priority, thereby determining the network device with the highest security.

[0099] For example, after receiving the first message, the first network device compares the one or more security capabilities indicated in the first message with the security capabilities possessed by the first network device in descending order of security capability priority, in order to determine the master device and the slave device among the first network device and the second network device. The master device possesses the target security capability while the slave device does not, and the target security capability is the highest priority security capability among the one or more security capabilities that differ between the master device and the slave device. A security capability that differs between the master device and the slave device refers to a capability possessed by either the master device or the slave device that the other does not possess; for example, a security capability possessed by the master device but not by the slave device, or a security capability not possessed by the master device but possessed by the slave device.

[0100] Specifically, during the process of the first network device comparing security capabilities in sequence, the first network device first sorts the security capabilities indicated by the first message in descending order of priority, and sorts the security capabilities possessed by the first network device in descending order of priority.

[0101] Then, the first network device compares the priority of the highest-priority security capability in the first message with the priority of the highest-priority security capability in the first network device.

[0102] If the highest priority security capability in the first message has a higher priority than the highest priority security capability in the first network device, the first network device determines that the security of the second network device is higher than that of the first network device, and thus determines that the second network device is the master device.

[0103] If the highest priority security capability in the first message has a lower priority than the highest priority security capability in the first network device, the first network device determines that the security of the second network device is lower than that of the first network device, and thus determines that the first network device is the master device.

[0104] If the highest priority security capability in the first message has the same priority as the highest priority security capability in the first network device, the first network device compares the next priority security capability in the second message with the next priority security capability in the first network device, until the first network device can determine the master device and the slave device.

[0105] In general, the higher the priority of the security capabilities of a network device, the higher its security; conversely, the lower the priority of the security capabilities of a network device, the lower its security.

[0106] In this embodiment, the first network device can select the master and slave devices from the perspective of the contribution of security capabilities to the security of the two network devices by comparing the priority of security capabilities. This allows the device with the highest security to be accurately selected as the master device.

[0107] Optionally, when the first message indicates the security capabilities of the second network device through the above-described implementation method 1, the first network device can determine the level of security between the two network devices by comparing the magnitude of the two values.

[0108] For example, in the first field of the first message, the priority of the security capabilities represented by each bit in the multiple bits from left to right in the first field decreases sequentially from the most significant bit to the least significant bit. For instance, suppose the first field includes five bits, the security capability represented by the first bit has the highest priority, the security capability represented by the second bit has a lower priority than the first bit, the security capability represented by the third bit has a lower priority than the second bit, and so on. That is, from the first bit to the fifth bit, the priority of the security capabilities represented by the bits decreases sequentially.

[0109] Upon receiving the first message, the first network device generates a capability value consisting of multiple bits from left to right, based on its security capabilities. The priority of each security capability represented by these bits decreases sequentially from the most significant bit to the least significant bit. In other words, the capability value generated by the first network device represents its security capabilities in the same way as the first field in the first message.

[0110] After generating the capability value, the first network device determines the master and slave devices by comparing the values ​​represented by multiple bits in the first field with the capability value. When the values ​​represented by multiple bits in the first field are greater than the capability value generated by the first network device, the first network device determines the second network device as the master device; when the values ​​represented by multiple bits in the first field are less than the capability value generated by the first network device, the first network device determines the first network device as the master device.

[0111] For example, if the second network device has secure boot capability and trusted execution environment capability, the value of multiple bits in the first field is 10100; if the first network device has secure boot capability and hardware-level key management capability, the capability value generated by the first network device is 11000. In this way, by comparing the value between 10100 and 11000, the first network device can determine that the value represented by multiple bits in the first field is less than the capability value, and thus determine that the first network device is the master device.

[0112] In this embodiment, multiple bits sorted according to the priority of security capabilities are used to represent the security capabilities of the network device. This allows the network device to quickly select the device with the highest security as the master device by comparing the values ​​used to represent security capabilities, thereby improving the efficiency of the network device in determining the master and slave devices.

[0113] In this embodiment, in order to ensure that the first field received by the first network device has not been tampered with, the first network device performs integrity verification on the content of the first field to ensure the security of the first field.

[0114] Optionally, the first message received by the first network device may also include a second field, which includes a first verification value. The first verification value is obtained by the second network device encrypting the first field using a preset key stored in the second network device.

[0115] After receiving the first message, the first network device performs an integrity check on the content of the first field to obtain a second verification value. Optionally, the process of the first network device performing the integrity check on the content of the first field includes: the first network device encrypting the first field according to a preset key in the first network device to obtain the second verification value. After obtaining the first verification value and the second verification value, in response to the first verification value being the same as the second verification value, the first network device determines that the content of the first field has passed the integrity check. Thus, if the content of the first field passes the integrity check, the first network device determines that the content of the first field is authentic and valid, and therefore the first network device can determine the master and slave devices based on the content of the first field.

[0116] It should be noted that the preset key in the first network device and the preset key in the second network device are the same key. For example, the preset key in the first network device and the second network device may be a pre-shared key, a key derived from the pre-shared key, or a working key in a key negotiation protocol (such as SAK in MACsec). This embodiment does not specifically limit the preset key.

[0117] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating a process for performing integrity verification on a first field, as provided in an embodiment of this application. Figure 3 As shown, the second network device encrypts the first field based on a preset key in the second network device to obtain a first verification value, which is then appended to the first field. After receiving a first message from the second network device, the first network device encrypts the first field in the first message using its preset key to obtain a second verification value. Then, the first network device compares the first verification value in the first message with the encrypted first verification value to complete the integrity verification of the first field.

[0118] Optionally, the first message includes a third field, which includes a third checksum. The third checksum is obtained by the second network device encrypting the content of the first message, excluding the third field, using a preset key within the second network device.

[0119] After receiving the first message, the first network device performs an integrity check on the content of the first message excluding the third field, thereby obtaining a fourth verification value. Optionally, the process of the first network device performing the integrity check on the content of the first message excluding the third field includes: the first network device encrypts the content of the first message excluding the third field according to a preset key in the first network device, thereby obtaining a fourth verification value. In response to the third verification value being the same as the fourth verification value, the first network device determines that the first message has passed the integrity check.

[0120] Understandably, if the first message passes the integrity check, the first field will also pass the integrity check since it is actually part of the first message.

[0121] In general, the first network device performs integrity verification on the first field indicating security capabilities in the first message, or the first network device performs integrity verification on the first field and other content in the first message together. Furthermore, the first network device can also perform integrity verification on the content of the first message twice, that is, the first network device first performs integrity verification on the first field, and then performs integrity verification on the first field and other content.

[0122] It should be understood that the above describes the process by which the first network device determines the master and slave devices based on the security capability indication message sent by the second network device. In practical applications, the first network device also sends a security capability indication message to the second network device so that the second network device can determine the master and slave devices.

[0123] For example, the first network device sends a second message to the second network device, the second message indicating one or more security capabilities possessed by the first network device. Upon receiving the second message, the second network device can then determine the one or more security capabilities possessed by the first network device, and thus determine the master device and slave device based on the one or more security capabilities possessed by the first network device and its own security capabilities. The method by which the second network device determines the master device and slave device can refer to step 202 described above, and will not be repeated here.

[0124] In other words, by having the first network device and the second network device send messages indicating security capabilities to each other, both the first network device and the second network device can determine the master device and the slave device based on the received messages, so that the first network device and the second network device can perform the subsequent key negotiation process.

[0125] To facilitate understanding, the following will describe the specific method by which the first network device generates the second message.

[0126] In one implementation, the first network device generates a fourth field, which indicates one or more security capabilities possessed by the first network device. The implementation of the fourth field is similar to that of the first field described above; for details, refer to implementation methods 1 and 2 of the first field, which will not be repeated here. Then, the first network device encrypts the fourth field using a preset key to obtain a fifth field. Finally, the first network device generates a second message based on the fourth and fifth fields, which includes both the fourth and fifth fields. The fifth field is used by the second network device to perform integrity verification of the first field; for example, the fifth field can be appended to the fourth field.

[0127] In another implementation, the first network device generates a fourth field, which indicates one or more security capabilities possessed by the first network device. Then, the first network device generates a third message based on the fourth field, which includes the fourth field. The third message includes all content from the second message except for the checksum, such as a message header. Next, the first network device encrypts the third message using a preset key to obtain a sixth field, and adds the sixth field to the third message to obtain the second message.

[0128] To facilitate understanding, the method for determining master and slave devices during the key negotiation process provided in this embodiment will be described in detail below with specific examples. Please refer to... Figure 4 , Figure 4 This is a flowchart illustrating the method for determining master and slave devices during key negotiation, as provided in an embodiment of this application. Figure 4 As shown, the method for determining the master and slave devices during the key negotiation process includes the following steps 401-407.

[0129] Step 401: The second network device sends a first message to the first network device.

[0130] In this embodiment, step 401 is similar to step 201 described above. Please refer to step 201 for details, which will not be repeated here.

[0131] Step 402: The first network device sends a second message to the second network device.

[0132] The second message indicates one or more security capabilities possessed by the first network device. Furthermore, both the first and second messages can be carried within a key negotiation message.

[0133] It should be noted that the order of steps 401 and 402 is not limited in this embodiment. For example, in practical applications, the second network device and the first network device may execute steps 401 and 402 simultaneously; or, the second network device may execute step 401 first, and then the first network device may execute step 402.

[0134] Step 403: The first network device determines that it is the master device and the second network device is the slave device based on the first message.

[0135] Upon receiving the first message, the first network device determines that its security is higher than that of the second network device based on the security capabilities of the second network device indicated by the first message and the security capabilities of the first network device itself. Thus, the first network device is determined to be the master device and the second network device is the slave device.

[0136] Step 404: The second network device determines that the first network device is the master device and the second network device is the slave device based on the second message.

[0137] Upon receiving the second message, the second network device determines, based on the security capabilities of the first network device indicated by the second message and the security capabilities of the second network device itself, that the security of the second network device is lower than that of the first network device, thereby determining that the first network device is the master device and the second network device is the slave device.

[0138] Similarly, this embodiment does not limit the order of steps 403 and 404.

[0139] Step 405: The first network device generates a key.

[0140] After the first network device determines itself to be the master device, it generates a key for encrypting data. For example, the first network device derives the key from a TPM.

[0141] Step 406: The first network device sends a key to the second network device.

[0142] Step 407: The first network device and the second network device transmit data encrypted with the key to each other.

[0143] After the second network device receives the key sent by the first network device, both the first and second network devices possess the key for encrypting data. Therefore, the first and second network devices use the key to encrypt the data to be transmitted and then send the encrypted data to the other device.

[0144] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating the structure of a key negotiation message provided in an embodiment of this application. The first message or second message mentioned in the above embodiment may be carried in... Figure 5 The key negotiation message shown. Figure 5 The key negotiation shown is, for example, a key server selection message. The following will combine... Figure 5 This section explains how to include a first message or a second message in a key negotiation message.

[0145] like Figure 5 As shown, the key negotiation message includes an Ethernet header and an Ethernet body. The Ethernet header includes a destination address field, a source address field, and an Ethernet message type field, where the Ethernet message type field indicates that the message is a physical layer encrypted negotiation message.

[0146] The Ethernet body includes a .1x protocol header and a .1x protocol body. The .1x protocol header includes a protocol version number field and a protocol message type field. The protocol version number field indicates that the message is an 802.1x protocol version, and the protocol message type field indicates that the message is a physical layer encrypted negotiation message.

[0147] In addition, the .1x protocol body includes basic fields and an integrity check value (ICV) field.

[0148] The basic fields include a Key Server Priority field, a Key Server field, and a Capability field. The Key Server Priority field indicates the security capabilities of the network device. For example, the Key Server Priority might be the first field in the first message mentioned above; or, the Key Server Priority field might include both the first and second fields in the first message mentioned above. The Key Server field indicates whether the network device is the key server. For example, a value of 0 indicates that the network device is not the key server; a value of 1 indicates that the network device is the key server. Before determining the key server, the value of the Key Server field is 0. The Capability field indicates the security actions the network device will perform, which may include: encryption only, integrity verification only, encryption and integrity verification, or no action.

[0149] The integrity check value field includes an ICV index field and an ICV value field. The ICV index field indicates that the field following the ICV index field is an ICV-related field. The ICV value field indicates the ICV value calculated based on all the content preceding the ICV value field; that is, the ICV value field is, for example, the third field in the first message mentioned above.

[0150] Please see Figure 6 , Figure 6 This is a schematic diagram illustrating the structure of the master device priority field in a key negotiation message, as provided in an embodiment of this application. Figure 6 As shown, the master device priority field includes 5 bits. The first bit indicates whether the network device has secure boot capability; the second bit indicates whether the network device has hardware-level key management capability; the third bit indicates whether the network device has trusted execution environment capability; the fourth bit indicates whether the network device has security chip capability; and the fifth bit indicates whether the network device has firmware resilience capability. Among these, secure boot capability is related to the root of trust in the network device's system-on-chip (SoC); hardware-level key management capability is related to the hardware key management module in the SoC; trusted execution environment capability is related to the trusted execution environment in the network device; security chip capability is related to the TPM in the network device; and firmware resilience capability is related to the flash memory in the network device.

[0151] The above describes the process by which the first network device and the second network device determine the master and slave devices by receiving messages indicating security capabilities sent by the other side device. The following will describe the process by which one side device receives messages sent by the other side device to determine the master and slave devices, and then notifies the other side device of the determination result.

[0152] Please see Figure 7 , Figure 7 This is a flowchart illustrating another method for determining master and slave devices during key negotiation, provided in an embodiment of this application. Figure 7 As shown, the method for determining the master and slave devices during the key negotiation process includes the following steps 701-704.

[0153] Step 701: The first network device sends a first message to the second network device. The first message indicates one or more security capabilities possessed by the first network device, and these one or more security capabilities help ensure key security.

[0154] In this embodiment, step 701 is similar to step 201 described above. Please refer to step 201 for details, which will not be repeated here.

[0155] Step 702: The second network device determines the master device and the slave device based on the first message, wherein the master device is used to generate a key and distribute the key to the slave device during the key negotiation process, and the security capability of the master device is higher than that of the slave device.

[0156] In this embodiment, step 702 is similar to step 202 described above. Please refer to step 202 for details, which will not be repeated here.

[0157] Step 703: The second network device generates a second message based on the determined master and slave devices.

[0158] In this embodiment, the second message is used to indicate the master device and / or slave device determined in the first network device and the second network device. For example, after the second network device determines that the first network device is the master device and the second network device is the slave device based on the first message, the second network device generates the second message, which is used to indicate that the first network device is the master device.

[0159] Step 704: The second network device sends a second message to the first network device.

[0160] Optionally, the first message includes a first field, which includes at least one bit, each bit of which is used to indicate whether a security capability is present.

[0161] Optionally, the first message includes a first field, which includes at least one identifier, which is used to represent one or more security capabilities.

[0162] Optionally, before the first network device sends the first message to the second network device, the first network device generates a first field, which indicates one or more security capabilities possessed by the first network device. The first network device encrypts the first field using a preset key to obtain a second field. Then, the first network device generates a first message based on the first field and the second field, and the first message includes the first field and the second field.

[0163] Optionally, before the first network device sends the first message to the second network device, the first network device generates a first field, which indicates one or more security capabilities possessed by the first network device. Then, the first network device generates a third message based on the first field, the third message including the first field. Next, the first network device encrypts the third message using a preset key to obtain the third field. The first network device adds the third field to the third message to obtain the first message.

[0164] The above describes the method for determining master and slave devices during key negotiation provided in the embodiments of this application. The following will describe the execution subject used to perform the above method for determining master and slave devices during key negotiation.

[0165] Please see Figure 8 , Figure 8 This is a schematic diagram of a device for determining master and slave devices during key negotiation, provided as an embodiment of this application. Figure 8 As shown, the device for determining the master and slave devices during the key negotiation process is deployed in the first network device. The device includes: a receiving unit 801, used to receive a first message sent by the second network device, the first message indicating one or more security capabilities possessed by the second network device, the one or more security capabilities helping to ensure key security; and a processing unit 802, used to determine the master device and the slave device in the first network device and the second network device based on the one or more security capabilities and the security capabilities possessed by the first network device, the master device being used to generate a key and distribute the key to the slave device during the key negotiation process, the security capabilities of the master device being higher than those of the slave device.

[0166] Optionally, the first message includes a first field, which includes at least one bit, each bit of which is used to indicate whether a security capability is present.

[0167] Optionally, the first message includes a first field, which includes at least one identifier, which is used to represent one or more security capabilities.

[0168] Optionally, the first message also includes a second field, which includes a first check value; the processing unit 802 is further configured to: perform integrity verification on the content of the first field to obtain a second check value; and determine that the content of the first field passes the integrity verification in response to the first check value being the same as the second check value.

[0169] Optionally, the first message includes a third field, and the third field includes a third check value; the processing unit 802 is further configured to: perform integrity verification on the content of the first message other than the third field, thereby obtaining a fourth check value; and determine that the first message passes the integrity verification in response to the third check value being the same as the fourth check value.

[0170] Optionally, the processing unit 802 is specifically used to: sequentially compare one or more security capabilities with the security capabilities possessed by the first network device in descending order of priority of security capabilities, so as to determine the master device and the slave device among the first network device and the second network device; wherein the master device possesses the target security capability and the slave device does not possess the target security capability, and the target security capability is the security capability with the highest priority among one or more security capabilities that differ between the master device and the slave device.

[0171] Optionally, the priority of the security capabilities represented by each bit in the multiple bits from left to right in the first field decreases sequentially from the most significant bit to the least significant bit; the processing unit 802 is specifically used to: generate a capability value including multiple bits from left to right based on the security capabilities possessed by the first network device, wherein the priority of the security capabilities represented by each bit in the multiple bits from left to right decreases sequentially from the most significant bit to the least significant bit; and determine the master device and the slave device in the first network device and the second network device by comparing the values ​​represented by the multiple bits with the capability value.

[0172] Optionally, the device further includes a sending unit 803, configured to send a second message to a second network device, the second message indicating one or more security capabilities possessed by the first network device.

[0173] Optionally, the processing unit 802 is further configured to: generate a fourth field, the fourth field being used to indicate one or more security capabilities possessed by the first network device; encrypt the fourth field using a preset key to obtain a fifth field; and generate a second message based on the fourth field and the fifth field, the second message including the fourth field and the fifth field.

[0174] Optionally, the processing unit 802 is further configured to: generate a fourth field, the fourth field being used to indicate one or more security capabilities possessed by the first network device; generate a third message based on the fourth field, the third message including the fourth field; encrypt the third message using a preset key to obtain a sixth field; and add the sixth field to the third message to obtain a second message.

[0175] Optionally, security capabilities may include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability.

[0176] Optionally, the first message is carried in the key negotiation message.

[0177] Please see Figure 9 , Figure 9 This is a schematic diagram of a device for determining master and slave devices during key negotiation, provided as an embodiment of this application. Figure 9 As shown, the device for determining the master and slave devices during the key negotiation process is deployed in the first network device. The device includes: a sending unit 901, used to send a first message to the second network device, the first message indicating one or more security capabilities possessed by the first network device, the one or more security capabilities helping to ensure key security; and a receiving unit 902, used to receive a second message sent by the second network device, the second message indicating the master device and / or slave device determined in the first network device and the second network device, the master device generating a key and distributing the key to the slave device during the key negotiation process, the master device having higher security capabilities than the slave device.

[0178] Optionally, the first message includes a first field, which includes at least one bit, each bit of which is used to indicate whether a security capability is present.

[0179] Optionally, the first message includes a first field, which includes at least one identifier, which is used to represent one or more security capabilities.

[0180] Optionally, the device further includes a processing unit 903, which is configured to: generate a first field, the first field being used to indicate one or more security capabilities possessed by the first network device; encrypt the first field using a preset key to obtain a second field; and generate a first message based on the first field and the second field, the first message including the first field and the second field.

[0181] Optionally, the device further includes a processing unit 903, which is configured to: generate a first field, the first field being used to indicate one or more security capabilities possessed by the first network device; generate a third message based on the first field, the third message including the first field; encrypt the third message using a preset key to obtain the third field; and add the third field to the third message to obtain the first message.

[0182] Optionally, the first message is carried in the key negotiation message.

[0183] Figure 10 This is a schematic diagram of the structure of a network device 1000 provided in an embodiment of this application. The network device 1000 is equipped with the master-slave device determination device described above in the key negotiation process. The network device 1000 is implemented using a general bus architecture.

[0184] The network device 1000 includes at least one processor 1001, a communication bus 1002, a memory 1003, and at least one communication interface 1004.

[0185] Optionally, the processor 1001 is a general-purpose CPU, NP, microprocessor, or one or more integrated circuits for implementing the solutions of this application, such as application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.

[0186] The communication bus 1002 is used to transmit information between the aforementioned components. The communication bus 1002 includes an address bus, a data bus, and a control bus. For ease of representation, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus.

[0187] Optionally, memory 1003 is read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions. Alternatively, memory 1003 is random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions. Alternatively, memory 1003 may be electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited to these. Optionally, memory 1003 exists independently and is connected to processor 1001 via communication bus 1002. Optionally, memory 1003 and processor 1001 are integrated together.

[0188] Communication interface 1004 uses any transceiver-like device for communicating with other devices or communication networks. Communication interface 1004 includes a wired communication interface. Optionally, communication interface 1004 also includes a wireless communication interface. The wired communication interface is, for example, an Ethernet interface. An Ethernet interface is an optical interface, an electrical interface, or a combination thereof. The wireless communication interface is a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof, etc.

[0189] In a specific implementation, as one example, the processor 1001 includes one or more CPUs, such as... Figure 10 CPU0 and CPU1 are shown in the diagram.

[0190] In a specific implementation, as one example, the network device 1000 includes multiple processors, such as... Figure 10 The processors 1001 and 1005 shown are illustrated. Each of these processors is either a single-core processor (SCPU) or a multi-core processor (Multi-CPU). Here, a processor refers to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0191] In some embodiments, the memory 1003 is used to store program code 1010 for executing the scheme of this application, and the processor 1001 executes the program code 1010 stored in the memory 1003. That is, the network device 1000 implements the above-described method embodiments through the processor 1001 and the program code 1010 in the memory 1003.

[0192] This application also provides a key negotiation system, which includes two network devices participating in key negotiation. The interaction process between these two network devices in this key negotiation system is described in the appendix. Figure 4 The description of the relevant embodiments will not be repeated here.

[0193] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0194] A references B, which means that A is the same as B or A is a simple variation of B.

[0195] The terms "first" and "second," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order of objects, and should not be construed as indicating or implying relative importance. For example, "first speed limit lane" and "second speed limit lane" are used to distinguish different speed limit lanes, not to describe a specific order of speed limit lanes, and should not be construed as the first speed limit lane being more important than the second speed limit lane.

[0196] In the embodiments of this application, unless otherwise stated, "at least one" means one or more, and "multiple" means two or more.

[0197] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. When implemented in software, they can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0198] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for determining master and slave devices during key negotiation, characterized in that, include: The first network device receives a first message sent by the second network device. The first message is used to indicate one or more security capabilities possessed by the second network device. The one or more security capabilities help ensure key security. The security capabilities include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability. Based on the aforementioned one or more security capabilities and the security capabilities possessed by the first network device, the first network device determines a master device and a slave device among the first network device and the second network device. The master device is used to generate a key during the key negotiation process and distribute the key to the slave device. The security capabilities of the master device are higher than those of the slave device. The first network device sends a second message to the second network device. The second message is used to indicate one or more security capabilities of the first network device, so that the second network device can determine the master device and the slave device among the first network device and the second network device. The first message and the second message are carried in a key negotiation message.

2. The method according to claim 1, characterized in that, The first message includes a first field, which includes at least one bit, each of which is used to indicate whether a security capability is present.

3. The method according to claim 1, characterized in that, The first message includes a first field, which includes at least one identifier, the at least one identifier being used to represent the one or more security capabilities.

4. The method according to claim 2 or 3, characterized in that, The first message also includes a second field, which includes a first check value; The method further includes: The first network device performs integrity verification on the content of the first field to obtain a second verification value; In response to the first check value being the same as the second check value, the first network device determines that the content of the first field has passed the integrity check.

5. The method according to any one of claims 1-3, characterized in that, The first message includes a third field, which includes a third check value; The method further includes: The first network device performs integrity verification on the content of the first message other than the third field, thereby obtaining a fourth verification value; In response to the fact that the third check value is the same as the fourth check value, the first network device determines that the first message has passed the integrity check.

6. The method according to any one of claims 1-3, characterized in that, Based on the aforementioned one or more security capabilities and the security capabilities possessed by the first network device, the first network device determines the master device and slave device among the first network device and the second network device, including: The first network device compares one or more security capabilities with the security capabilities it possesses in descending order of security capability priority, in order to determine the master device and the slave device among the first network device and the second network device; Wherein, the master device has the target security capability and the slave device does not have the target security capability, and the target security capability is the highest priority security capability among one or more security capabilities that differ between the master device and the slave device.

7. The method according to claim 2, characterized in that, In the first field, the security capabilities represented by each bit from left to right decrease sequentially from the most significant bit to the least significant bit. Based on the aforementioned one or more security capabilities and the security capabilities possessed by the first network device, the first network device determines the master device and slave device among the first network device and the second network device, including: The first network device generates a capability value consisting of multiple bits from left to right based on the security capabilities it possesses. The priority of the security capabilities represented by each bit in the multiple bits from left to right decreases sequentially from the highest bit to the lowest bit. The first network device determines the master device and the slave device among the first network device and the second network device by comparing the values ​​represented by the plurality of bits with the capability value.

8. The method according to any one of claims 1-3, characterized in that, The method further includes: The first network device generates a fourth field, which is used to indicate one or more security capabilities possessed by the first network device; The first network device encrypts the fourth field using a preset key to obtain the fifth field; The first network device generates the second message based on the fourth field and the fifth field, and the second message includes the fourth field and the fifth field.

9. The method according to any one of claims 1-3, characterized in that, The method further includes: The first network device generates a fourth field, which is used to indicate one or more security capabilities possessed by the first network device; The first network device generates a third message based on the fourth field, the third message including the fourth field; The first network device encrypts the third message using a preset key to obtain the sixth field; The first network device adds the sixth field to the third message to obtain the second message.

10. A method for determining master and slave devices during key negotiation, characterized in that, include: A first network device sends a first message to a second network device. The first message indicates one or more security capabilities possessed by the first network device, enabling the second network device to determine the master and slave devices among the first and second network devices. The one or more security capabilities help ensure key security. The security capabilities include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability. The first network device receives a second message sent by the second network device. The second message is used to indicate a master device and / or a slave device determined in the first network device and the second network device. The master device is used to generate a key and distribute the key to the slave device during the key negotiation process. The security capability of the master device is higher than that of the slave device. The first message and the second message are carried in the key negotiation message.

11. The method according to claim 10, characterized in that, The first message includes a first field, which includes at least one bit, each of which is used to indicate whether a security capability is present.

12. The method according to claim 10, characterized in that, The first message includes a first field, which includes at least one identifier, the at least one identifier being used to represent the one or more security capabilities.

13. The method according to any one of claims 10-12, characterized in that, The method further includes: The first network device generates a first field, which is used to indicate one or more security capabilities possessed by the first network device; The first network device encrypts the first field using a preset key to obtain the second field; The first network device generates the first message based on the first field and the second field, and the first message includes the first field and the second field.

14. The method according to any one of claims 10-12, characterized in that, The method further includes: The first network device generates a first field, which is used to indicate one or more security capabilities possessed by the first network device; The first network device generates a third message based on the first field, and the third message includes the first field; The first network device encrypts the third message using a preset key to obtain the third field; The first network device adds the third field to the third message to obtain the first message.

15. A device for determining master and slave devices during key negotiation, characterized in that, The device is deployed in a first network device, and the device includes: The receiving unit is configured to receive a first message sent by the second network device. The first message is used to indicate one or more security capabilities possessed by the second network device. The one or more security capabilities help ensure key security. The security capabilities include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability. A processing unit is configured to determine a master device and a slave device in the first network device and the second network device based on the one or more security capabilities and the security capabilities possessed by the first network device. The master device is configured to generate a key during the key negotiation process and distribute the key to the slave device. The security capabilities of the master device are higher than those of the slave device. The sending unit is configured to send a second message to the second network device. The second message is used to indicate one or more security capabilities possessed by the first network device, so that the second network device can determine the master device and the slave device among the first network device and the second network device. The first message and the second message are carried in a key negotiation message.

16. The apparatus according to claim 15, characterized in that, The first message includes a first field, which includes at least one bit, each of which is used to indicate whether a security capability is present.

17. The apparatus according to claim 15, characterized in that, The first message includes a first field, which includes at least one identifier, the at least one identifier being used to represent the one or more security capabilities.

18. The apparatus according to claim 16 or 17, characterized in that, The first message also includes a second field, which includes a first check value; The processing unit is also used for: Perform integrity verification on the content of the first field to obtain the second verification value; In response to the first check value being the same as the second check value, it is determined that the content of the first field has passed the integrity check.

19. The apparatus according to any one of claims 15-17, characterized in that, The first message includes a third field, which includes a third check value; The processing unit is also used for: The integrity of the content in the first message, excluding the third field, is checked to obtain a fourth check value. In response to the fact that the third check value is the same as the fourth check value, it is determined that the first message has passed the integrity check.

20. The apparatus according to any one of claims 15-17, characterized in that, The processing unit is specifically used for: The security capabilities are ranked from highest to lowest priority, and the one or more security capabilities are compared with the security capabilities of the first network device in order to determine the master device and the slave device among the first network device and the second network device. Wherein, the master device has the target security capability and the slave device does not have the target security capability, and the target security capability is the highest priority security capability among one or more security capabilities that differ between the master device and the slave device.

21. The apparatus according to claim 16, characterized in that, In the first field, the security capabilities represented by each bit from left to right decrease sequentially from the most significant bit to the least significant bit. The processing unit is specifically used for: Based on the security capabilities of the first network device, a capability value including multiple bits from left to right is generated, wherein the priority of the security capabilities represented by each bit from left to right decreases sequentially from high bit to low bit. The master device and the slave device are determined in the first network device and the second network device by comparing the values ​​represented by the plurality of bits with the capability value.

22. The apparatus according to any one of claims 15-17, characterized in that, The processing unit is also used for: Generate a fourth field, which is used to indicate one or more security capabilities possessed by the first network device; The fifth field is obtained by encrypting the fourth field using a preset key; The second message is generated based on the fourth field and the fifth field, and the second message includes the fourth field and the fifth field.

23. The apparatus according to any one of claims 15-17, characterized in that, The processing unit is also used for: The first network device generates a fourth field, which is used to indicate one or more security capabilities possessed by the first network device; The first network device generates a third message based on the fourth field, the third message including the fourth field; The first network device encrypts the third message using a preset key to obtain the sixth field; The first network device adds the sixth field to the third message to obtain the second message.

24. A device for determining master and slave devices during key negotiation, characterized in that, The device is deployed in a first network device, and the device includes: The sending unit is configured to send a first message to the second network device. The first message is configured to indicate one or more security capabilities possessed by the first network device, so that the second network device can determine the master device and the slave device among the first network device and the second network device. The one or more security capabilities help to ensure key security. The security capabilities include one or more of the following: secure boot capability, hardware-level key management capability, trusted execution environment capability, secure chip capability, or firmware resilience capability. A receiving unit is configured to receive a second message sent by the second network device. The second message is used to indicate a master device and / or a slave device determined in the first network device and the second network device. The master device is used to generate a key and distribute the key to the slave device during the key negotiation process. The security capability of the master device is higher than that of the slave device. The first message and the second message are carried in a key negotiation message.

25. The apparatus according to claim 24, characterized in that, The first message includes a first field, which includes at least one bit, each of which is used to indicate whether a security capability is present.

26. The apparatus according to claim 24, characterized in that, The first message includes a first field, which includes at least one identifier, the at least one identifier being used to represent the one or more security capabilities.

27. The apparatus according to any one of claims 24-26, characterized in that, The device further includes a processing unit, the processing unit being used for: Generate a first field, which is used to indicate one or more security capabilities possessed by the first network device; The second field is obtained by encrypting the first field with a preset key; The first message is generated based on the first field and the second field, and the first message includes the first field and the second field.

28. The apparatus according to any one of claims 24-26, characterized in that, The device further includes a processing unit, the processing unit being used for: Generate a first field, which is used to indicate one or more security capabilities possessed by the first network device; A third message is generated based on the first field, and the third message includes the first field. The third message is encrypted using a preset key to obtain the third field; The first message is obtained by adding the third field to the third message.

29. A network device comprising a processor and a memory, the memory for storing program code, the processor for calling the program code in the memory to cause the network device to perform the method as claimed in any one of claims 1-14.

30. A computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-14.

Citation Information

Patent Citations

  • Authentication mechanism for 5g technologies

    CN113411308A

  • Distributed on-demand key management for rangeless environments

    US10356064B1

  • Method for establishing a master-slave relationship in a peer-to-peer network

    US6192397B1